WisperFusion.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/rp/WisperFusion.cpp
22  \brief Creation of skeleton imagems.
23 */
24 
25 #include "WisperFusion.h"
27 #include "Macros.h"
28 #include "Functions.h"
29 #include "Matrix.h"
30 #include "../raster/BandProperty.h"
31 #include "../raster/RasterFactory.h"
32 #include "../raster/Band.h"
33 #include "../raster/Grid.h"
34 #include "../raster/Utils.h"
35 #include "../geometry/Envelope.h"
36 #include "../common/progress/TaskProgress.h"
37 #include "../memory/ExpansibleRaster.h"
38 
39 #include <cmath>
40 #include <limits>
41 
42 namespace te
43 {
44  namespace rp
45  {
46 
48  {
49  reset();
50  }
51 
53  {
54  reset();
55  operator=( other );
56  }
57 
59  {
60  reset();
61  }
62 
64  {
65  m_lowResRasterPtr = nullptr;
66  m_lowResRasterBands.clear();
69  m_highResRasterPtr = nullptr;
72  m_hiResRasterBandsSRFs.clear();
74  m_enableProgress = false;
77  m_userWaveletFilterPtr = nullptr;
78  m_enableMultiThread = true;
79  }
80 
82  const WisperFusion::InputParameters& params )
83  {
84  reset();
85 
100 
101  return *this;
102  }
103 
105  {
106  return new InputParameters( *this );
107  }
108 
110  {
111  reset();
112  }
113 
115  {
116  reset();
117  operator=( other );
118  }
119 
121  {
122  reset();
123  }
124 
126  {
127  m_rType.clear();
128  m_rInfo.clear();
129  m_outputRasterPtr.reset();
130  }
131 
133  const WisperFusion::OutputParameters& params )
134  {
135  reset();
136 
137  m_rType = params.m_rType;
138  m_rInfo = params.m_rInfo;
139 
140  return *this;
141  }
142 
144  {
145  return new OutputParameters( *this );
146  }
147 
149  {
150  reset();
151  }
152 
153  WisperFusion::~WisperFusion() = default;
154 
156  throw( te::rp::Exception )
157  {
158  if( ! m_isInitialized ) return false;
159 
160  WisperFusion::OutputParameters* outParamsPtr = dynamic_cast<
161  WisperFusion::OutputParameters* >( &outputParams );
162  TERP_TRUE_OR_THROW( outParamsPtr, "Invalid paramters" );
163 
164  // progress
165 
166  std::unique_ptr< te::common::TaskProgress > progressPtr;
168  {
169  progressPtr.reset( new te::common::TaskProgress );
170 
171  progressPtr->setTotalSteps( 3 );
172 
173  progressPtr->setMessage( "Fusing images" );
174  }
175 
176  // defining the wavelet filter
177 
178  boost::numeric::ublas::matrix< double > waveletFilter;
179 
181  {
182  waveletFilter = *( m_inputParameters.m_userWaveletFilterPtr );
183  }
184  else
185  {
186  waveletFilter = te::rp::CreateWaveletAtrousFilter(
188  }
189 
190  // loading the SRFs
191 
192  std::vector< std::map< double, double > > lowResSRFs;
193  std::map< double, double > highResSRFs;
194 
195  {
197  {
198  std::map< double, double > auxMap;
199 
200  for( unsigned int sensorIdx = 0 ; sensorIdx <
201  m_inputParameters.m_lowResRasterBandSensors.size() ; ++sensorIdx )
202  {
203  auxMap.clear();
205  auxMap );
206  lowResSRFs.push_back( auxMap );
207  }
208  }
209  else
210  {
212  }
213 
215  {
217  highResSRFs );
218  }
219  else
220  {
222  }
223  }
224 
225  // Computing the the intersetion of the area covered by each low resolution band pair
226  // and with the high resolution band
227 
228  te::rp::Matrix< double > lRBandXlRBandSRFIntersectionAreas; // the LRxLR bands intersection areas.
229  std::vector< unsigned int > lRInterceptedBandIndex; // the index of the band intercepted by another.
230  std::vector< double > lowResBandsSRFAreas;
231  std::vector< double > lRBandXHRBandIntersectionAreas;
232  double lRBandsXHRBandTotalExclusiveIntersectionSRFArea = 0.0; // The LRxLR bands overlap is taken into account.
233  const double hiResBandSRFArea = te::rp::srf::getSRFArea( highResSRFs );
234 
235  {
236  unsigned int lowResBandIdx1 = 0;
237  unsigned int lowResBandIdx2 = 0;
238  const unsigned int nLowResBands = static_cast<unsigned int>(m_inputParameters.m_lowResRasterBands.size());
239 
240  // low resolution
241 
242  std::map< double, double > lRBandsXHRBandTotalExclusiveIntersectionSRF;
243 
244  lRBandXlRBandSRFIntersectionAreas.reset( nLowResBands, nLowResBands );
245  lowResBandsSRFAreas.resize( nLowResBands, 0.0 );
246  lRBandXHRBandIntersectionAreas.resize( nLowResBands, 0.0 );
247  for( lowResBandIdx1 = 0 ; lowResBandIdx1 < nLowResBands ; ++lowResBandIdx1 )
248  {
249  for( lowResBandIdx2 = lowResBandIdx1 ; lowResBandIdx2 < nLowResBands ;
250  ++lowResBandIdx2 )
251  {
252  if( lowResBandIdx1 != lowResBandIdx2 )
253  {
254  std::map< double, double > lRXLRIntersectionSRF;
255  te::rp::srf::getIntersectionSRF( lowResSRFs[ lowResBandIdx1 ],
256  lowResSRFs[ lowResBandIdx2 ], lRXLRIntersectionSRF );
257 
258  lRBandXlRBandSRFIntersectionAreas[ lowResBandIdx1 ][ lowResBandIdx2 ] =
259  te::rp::srf::getSRFArea( lRXLRIntersectionSRF );
260  lRBandXlRBandSRFIntersectionAreas[ lowResBandIdx2 ][ lowResBandIdx1 ] =
261  lRBandXlRBandSRFIntersectionAreas[ lowResBandIdx1 ][ lowResBandIdx2 ];
262  }
263  else
264  {
265  lRBandXlRBandSRFIntersectionAreas[ lowResBandIdx1 ][ lowResBandIdx2 ] = 0.0;
266  }
267  }
268 
269  lowResBandsSRFAreas[ lowResBandIdx1 ] = te::rp::srf::getSRFArea( lowResSRFs[ lowResBandIdx1 ] );
270  TERP_INSTANCE_TRUE_OR_RETURN_FALSE( lowResBandsSRFAreas[ lowResBandIdx1 ] > 0.0,
271  "One low resolution band SRF is invalid" );
272 
273  std::map< double, double > lRXHRIntersectionSRF;
274  te::rp::srf::getIntersectionSRF( lowResSRFs[ lowResBandIdx1 ], highResSRFs, lRXHRIntersectionSRF );
275 
276  lRBandXHRBandIntersectionAreas[ lowResBandIdx1 ] = te::rp::srf::getSRFArea( lRXHRIntersectionSRF );
277  TERP_INSTANCE_TRUE_OR_RETURN_FALSE( lRBandXHRBandIntersectionAreas[ lowResBandIdx1 ] > 0.0,
278  "One low resolution band SRF does not intersects the high resolution band SRF" );
279 
280  std::map< double, double > auxUnionSRF;
281  te::rp::srf::getUnionSRF( lRXHRIntersectionSRF, lRBandsXHRBandTotalExclusiveIntersectionSRF, auxUnionSRF );
282  lRBandsXHRBandTotalExclusiveIntersectionSRF = auxUnionSRF;
283  }
284 
285  lRBandsXHRBandTotalExclusiveIntersectionSRFArea = te::rp::srf::getSRFArea(
286  lRBandsXHRBandTotalExclusiveIntersectionSRF );
287 
288  std::multimap< double, unsigned int > centralFrequency2BandIdxMap;
289  for( lowResBandIdx1 = 0 ; lowResBandIdx1 < nLowResBands ; ++lowResBandIdx1 )
290  {
291  std::map< double, double >::const_iterator lowResSRFsIt =
292  lowResSRFs[ lowResBandIdx1 ].begin();
293  std::map< double, double >::const_iterator lowResSRFsItEnd =
294  lowResSRFs[ lowResBandIdx1 ].end();
295  double highestResponse = -1.0 * std::numeric_limits< double >::max();
296  double highestResponseFrequency = 0;
297 
298  while( lowResSRFsIt != lowResSRFsItEnd )
299  {
300  if( highestResponse < lowResSRFsIt->second )
301  {
302  highestResponse = lowResSRFsIt->second;
303  highestResponseFrequency = lowResSRFsIt->first;
304  }
305 
306  ++lowResSRFsIt;
307  }
308 
309  centralFrequency2BandIdxMap.insert( std::pair< double, unsigned int>(
310  highestResponseFrequency, lowResBandIdx1 ) );
311  }
312 
313  lRInterceptedBandIndex.resize( nLowResBands, nLowResBands + 1 );
314  std::multimap< double, unsigned int >::iterator centralFrequency2BandIdxMapIt =
315  centralFrequency2BandIdxMap.begin();
316  std::multimap< double, unsigned int >::iterator centralFrequency2BandIdxMapItPrev;
317  std::multimap< double, unsigned int >::iterator centralFrequency2BandIdxMapItEnd =
318  centralFrequency2BandIdxMap.end();
319  while( centralFrequency2BandIdxMapIt != centralFrequency2BandIdxMapItEnd )
320  {
321  if( centralFrequency2BandIdxMapIt == centralFrequency2BandIdxMap.begin() )
322  {
323  lRInterceptedBandIndex[ centralFrequency2BandIdxMapIt->second ] =
324  centralFrequency2BandIdxMapIt->second;
325  centralFrequency2BandIdxMapItPrev = centralFrequency2BandIdxMapIt;
326  }
327  else
328  {
329  lRInterceptedBandIndex[ centralFrequency2BandIdxMapIt->second ] =
330  centralFrequency2BandIdxMapItPrev->second;
331 
332  ++centralFrequency2BandIdxMapItPrev;
333  }
334 
335  ++centralFrequency2BandIdxMapIt;
336  }
337  }
338 
339  // The wavelet decomposition levels
340 
341  const unsigned int highResWaveletLevels = (unsigned int)
344  :
345  (
346  static_cast<unsigned int>(0.5
347  +
348  std::max(
349  (
350  std::log(
351  (double)
352  (
354  )
355  /
356  (double)
357  (
359  )
360  )
361  /
362  std::log( 2.0 )
363  )
364  ,
365  (
366  std::log(
367  (double)
368  (
370  )
371  /
372  (double)
373  (
375  )
376  )
377  /
378  std::log( 2.0 )
379  )
380  ))
381  );
382  TERP_INSTANCE_TRUE_OR_RETURN_FALSE( highResWaveletLevels > 0,
383  "Minimal number of wavelet decompositions not reached" );
384 
385  // creating the ressampled input raster
386 
387  std::unique_ptr< te::rst::Raster > resampledLlowResRasterPtr;
388 
389  {
390  std::map< std::string, std::string > rinfo;
391  rinfo["MAXMEMPERCENTUSED"] = "30";
392 
397  0,
398  0,
403  rinfo,
404  "EXPANSIBLE",
405  resampledLlowResRasterPtr ),
406  "Low resolution raster resample error" );
407  }
408 
409 // TERP_TRUE_OR_THROW( te::rp::Copy2DiskRaster( *resampledLlowResRasterPtr,
410 // "resampledLlowResRaster.tif" ), "" );
411 
413  {
414  progressPtr->pulse();
415  if( ! progressPtr->isActive() ) return false;
416  }
417 
418 
419  // creating the high resolution raster wavelets
420 
421  std::unique_ptr< te::rst::Raster > highResWaveletsRasterPtr;
422 
423  {
424  std::map<std::string, std::string> auxRasterInfo;
425 
426  std::vector< te::rst::BandProperty * > bandProps;
427 
428  for( unsigned int levelIdx = 0 ; levelIdx < highResWaveletLevels ;
429  ++levelIdx )
430  {
431  bandProps.push_back( new te::rst::BandProperty(
434  bandProps.back()->m_blkh = 1;
435  bandProps.back()->m_blkw = m_inputParameters.m_highResRasterPtr->getNumberOfColumns();
436  bandProps.back()->m_nblocksx = 1;
437  bandProps.back()->m_nblocksy = m_inputParameters.m_highResRasterPtr->getNumberOfRows();
438  bandProps.back()->m_type = te::dt::DOUBLE_TYPE;
439 
440  bandProps.push_back( new te::rst::BandProperty(
443  bandProps.back()->m_blkh = 1;
444  bandProps.back()->m_blkw = m_inputParameters.m_highResRasterPtr->getNumberOfColumns();
445  bandProps.back()->m_nblocksx = 1;
446  bandProps.back()->m_nblocksy = m_inputParameters.m_highResRasterPtr->getNumberOfRows();
447  bandProps.back()->m_type = te::dt::DOUBLE_TYPE;
448  }
449 
450  std::vector< unsigned int > rasterBands;
451  rasterBands.push_back( m_inputParameters.m_highResRasterBand );
452 
453  highResWaveletsRasterPtr.reset( new te::mem::ExpansibleRaster(
454  60,
456  bandProps ) );
457  TERP_INSTANCE_TRUE_OR_RETURN_FALSE( highResWaveletsRasterPtr.get(), "Raster allocation error" );
458 
461  rasterBands,
462  *highResWaveletsRasterPtr,
463  highResWaveletLevels,
464  waveletFilter ),
465  "Low resolution raster wavelets creation error" );
466  }
467 
468 /* TERP_TRUE_OR_THROW( te::rp::Copy2DiskRaster( *highResWaveletsRasterPtr,
469  "highResWaveletsRaster.tif" ), "" ); */
470 
472  {
473  progressPtr->pulse();
474  if( ! progressPtr->isActive() ) return false;
475  }
476 
477  // Creating the output raster
478 
479  {
481 
482  std::vector< te::rst::BandProperty * > bandProperties;
483  std::vector< unsigned int > outputRasterBands;
484 
485  for( unsigned int bandIdx = 0 ; bandIdx <
486  resampledLlowResRasterPtr->getNumberOfBands() ; ++bandIdx )
487  {
488  bandProperties.push_back( new te::rst::BandProperty(
489  *resampledLlowResRasterPtr->getBand( bandIdx )->getProperty() ) );
490 
491  outputRasterBands.push_back( bandIdx );
492  }
493 
494  outParamsPtr->m_outputRasterPtr.reset(
496  outParamsPtr->m_rType,
497  gridPtr,
498  bandProperties,
499  outParamsPtr->m_rInfo,
500  nullptr,
501  nullptr ) );
503  "Output raster creation error" );
504  }
505 
506  // Recomposing levels for each band
507 
508  {
509  const unsigned int nRows = outParamsPtr->m_outputRasterPtr->getNumberOfRows();
510  const unsigned int nCols = outParamsPtr->m_outputRasterPtr->getNumberOfColumns();
511  const unsigned int nBands = static_cast<unsigned int>(outParamsPtr->m_outputRasterPtr->getNumberOfBands());
512  te::rst::Raster& resampledLlowResRaster = *resampledLlowResRasterPtr;
513  te::rst::Raster& outputRaster = *(outParamsPtr->m_outputRasterPtr);
514  te::rst::Raster& highResWaveletsRaster = *highResWaveletsRasterPtr;
515  const unsigned int highResWaveletsRasterBands = static_cast<unsigned int>(highResWaveletsRaster.getNumberOfBands());
516  unsigned int row = 0;
517  unsigned int col = 0;
518  unsigned int bandIdx = 0;
519  std::vector< double > resLRRasterValues( nBands );
520  unsigned int waveletBandIdx = 0;
521  double outputRasterValue = 0;
522  double resampledLlowResRasterValue = 0;
523  double wisperTerm = 0;
524  double highResWaveletsValue = 0.0;
525  std::vector< double > ropi( nBands );
526  double ropiMean = 0;
527 
528  std::vector< double > outBandsMinValue( nBands );
529  std::vector< double > outBandsMaxValue( nBands );
530  std::vector< double > resampledLlowResBandsGains( nBands );
531  for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
532  {
534  outParamsPtr->m_outputRasterPtr->getBandDataType( bandIdx ),
535  outBandsMinValue[ bandIdx ], outBandsMaxValue[ bandIdx ] );
536  }
537 
538  for( row = 0 ; row < nRows ; ++row )
539  {
540  for( col = 0 ; col < nCols ; ++col )
541  {
542  ropiMean = 0.0;
543  for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
544  {
545  resampledLlowResRaster.getValue( col, row, resampledLlowResRasterValue, bandIdx );
546 
547  resLRRasterValues[ bandIdx ] = resampledLlowResRasterValue;
548 
549  assert( lRBandXHRBandIntersectionAreas[ bandIdx ] > 0.0 );
550  ropi[ bandIdx ] =
551  (
552  (
553  lRBandXHRBandIntersectionAreas[ bandIdx ]
554  *
555  lRBandXHRBandIntersectionAreas[ bandIdx ]
556  *
557  resLRRasterValues[ bandIdx ]
558  )
559  /
560  lowResBandsSRFAreas[ bandIdx ]
561  );
562 
563  ropiMean += ropi[ bandIdx ];
564  }
565  ropiMean /= ((double)nBands);
566 
567  for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
568  {
569  wisperTerm =
570  (
571  // Si
572  (
573  ropi[ bandIdx ]
574  /
575  ropiMean
576  )
577  *
578  (
579  // alpha
580  (
581  lRBandsXHRBandTotalExclusiveIntersectionSRFArea
582  /
583  hiResBandSRFArea
584  )
585  *
586  // P( mi | pm )
587  (
588  lRBandXHRBandIntersectionAreas[ bandIdx ]
589  /
590  lRBandsXHRBandTotalExclusiveIntersectionSRFArea
591  )
592  /
593  // P( pm | mi )
594  (
595  lRBandXHRBandIntersectionAreas[ bandIdx ]
596  /
597  lowResBandsSRFAreas[ bandIdx ]
598  )
599  )
600  *
601  (
602  1.0
603  -
604  (
605  (
606  // beta
607  lRBandXlRBandSRFIntersectionAreas[ bandIdx ][ lRInterceptedBandIndex[ bandIdx ] ]
608  /
609  lRBandXHRBandIntersectionAreas[ bandIdx ]
610  )
611  /
612  2.0
613  )
614  )
615  );
616 
617  outputRasterValue = resLRRasterValues[ bandIdx ];
618 
619  for( waveletBandIdx = 1 ; waveletBandIdx < highResWaveletsRasterBands ;
620  waveletBandIdx += 2 )
621  {
622  highResWaveletsRaster.getValue( col, row, highResWaveletsValue,
623  waveletBandIdx );
624  outputRasterValue += ( wisperTerm * highResWaveletsValue );
625  }
626 
627  outputRasterValue = std::max( outBandsMinValue[ bandIdx ],
628  outputRasterValue );
629  outputRasterValue = std::min( outBandsMaxValue[ bandIdx ],
630  outputRasterValue );
631 
632  outputRaster.setValue( col, row, outputRasterValue, bandIdx );
633  }
634  }
635  }
636 
637  }
638 
640  {
641  progressPtr->pulse();
642  if( ! progressPtr->isActive() ) return false;
643  }
644 
645  return true;
646  }
647 
648  void WisperFusion::reset() throw( te::rp::Exception )
649  {
651 
653  m_isInitialized = false;
654  }
655 
657  throw( te::rp::Exception )
658  {
659  reset();
660 
661  WisperFusion::InputParameters const* inputParamsPtr = dynamic_cast<
662  WisperFusion::InputParameters const* >( &inputParams );
663  TERP_TRUE_OR_THROW( inputParamsPtr, "Invalid paramters pointer" );
664 
665  m_inputParameters = *inputParamsPtr;
666 
667  // Checking the low Resolution related parameters
668 
670  "Invalid low Resolution Raster Pointer" )
671 
674  "Invalid raster" );
675 
676  for( unsigned int lowResRasterBandsIdx = 0; lowResRasterBandsIdx <
678  ++lowResRasterBandsIdx )
679  {
681  m_inputParameters.m_lowResRasterBands[ lowResRasterBandsIdx ] <
683  "Invalid low resolution raster band" );
684  }
685 
687  {
690  "Invalid low resolution bands sensors" );
691 
692  for( unsigned int idx = 0 ; idx < m_inputParameters.m_lowResRasterBandSensors.size() ;
693  ++idx )
694  {
696  te::rp::srf::InvalidSensor, "Invalid low resolution sensor" );
697  }
698  }
699  else
700  {
703  "Missing low resolution bands SRFs" );
704 
705  for( unsigned int idx = 0 ; idx < m_inputParameters.m_lowResRasterBandsSRFs.size() ;
706  ++idx )
707  {
709  "Invalid low resolution SRF" );
710  }
711  }
712 
713  // Checking the m_highResRasterPtr and m_highResRasterBand
714 
716  "Invalid high resolution Raster Pointer" )
717 
720  "Invalid raster" );
721 
725  "Invalid raster band" );
726 
728  {
730  te::rp::srf::InvalidSensor, "Invalid high resolution sensor" );
731  }
732 
733  // others
734 
736  {
738  ( m_inputParameters.m_userWaveletFilterPtr->size1() > 2 ) &&
741  "Invalid user filter" );
742  }
743 
744  m_isInitialized = true;
745 
746  return true;
747  }
748 
750  {
751  return m_isInitialized;
752  }
753 
754  }
755 } // end namespace te
756 
bool m_isInitialized
Tells if this instance is initialized.
Definition: WisperFusion.h:163
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
Near neighborhood interpolation method.
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: WisperFusion.h:87
void getSRF(const SensorType &sensor, ContainerT &container)
Returns a Spectral Response Function from the given sensor.
te::rst::Raster const * m_lowResRasterPtr
Input low-resolution multi-band raster.
Definition: WisperFusion.h:69
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state.
AbstractParameters * clone() const
Create a clone copy of this instance.
A raster band description.
Definition: BandProperty.h:61
Base exception class for plugin module.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
void TERPEXPORT GetDataTypeRange(const int dataType, double &min, double &max)
Returns the real data type range (all values that can be represented by the given data type)...
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
Raster Processing algorithm output parameters base interface.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
Spectral Response Functions.
unsigned int m_hiResRasterWaveletLevels
The number of wavelet decomposition levels to use (0-automatically found, default:0).
Definition: WisperFusion.h:85
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
WisperFusion output parameters.
Definition: WisperFusion.h:117
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
unsigned int unsigned int nCols
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
const OutputParameters & operator=(const OutputParameters &params)
unsigned int m_highResRasterBand
Band to process from the high-resolution raster.
Definition: WisperFusion.h:79
WiSpeR fusion.
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: WisperFusion.h:89
WisperFusion input parameters.
Definition: WisperFusion.h:65
An abstract class for raster data strucutures.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
void getIntersectionSRF(const std::map< double, double > &sRF1, const std::map< double, double > &sRF2, std::map< double, double > &intersectionSRF)
Return the intersetction SRF.
BandProperty * getProperty()
Returns the band property.
URI C++ Library.
Definition: Attributes.h:37
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
const InputParameters & operator=(const InputParameters &params)
bool DirectWaveletAtrous(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, te::rst::Raster &waveletRaster, const unsigned int levelsNumber, const boost::numeric::ublas::matrix< double > &filter)
Generate all wavelet planes from the given input raster.
std::vector< std::map< double, double > > m_lowResRasterBandsSRFs
An optional vector of user supplied Spectral Response Functions for each low resolution band (The wav...
Definition: WisperFusion.h:75
std::vector< unsigned int > m_lowResRasterBands
Bands to processe from the low resolution raster.
Definition: WisperFusion.h:71
bool m_enableMultiThread
Enable/Disable the use of multi-threads (default:true).
Definition: WisperFusion.h:95
te::rst::Raster const * m_highResRasterPtr
Input high-resolution raster.
Definition: WisperFusion.h:77
void getUnionSRF(const std::map< double, double > &sRF1, const std::map< double, double > &sRF2, std::map< double, double > &unionSRF)
Return the union SRF.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
Grid * getGrid()
It returns the raster grid.
Generic template matrix.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
Definition: WisperFusion.h:123
te::rp::srf::SensorType m_hiResRasterBandSensor
The high resolution band sensor.
Definition: WisperFusion.h:81
void reset()
Reset (clear) the active instance data.
Definition: Matrix.h:502
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
AbstractParameters * clone() const
Create a clone copy of this instance.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output fused raster.
Definition: WisperFusion.h:125
boost::numeric::ublas::matrix< double > CreateWaveletAtrousFilter(const WaveletAtrousFilterType &filterType)
Create a Wavele Atrous Filter.
Abstract parameters base interface.
bool RasterResample(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const te::rst::Interpolator::Method interpMethod, const unsigned int firstRow, const unsigned int firstColumn, const unsigned int height, const unsigned int width, const unsigned int newheight, const unsigned int newwidth, const std::map< std::string, std::string > &rinfo, const std::string &dataSourceType, std::unique_ptr< te::rst::Raster > &resampledRasterPtr)
Resample a subset of the raster, given a box.
InputParameters m_inputParameters
Input execution parameters.
Definition: WisperFusion.h:161
A raster (stored in memory and eventually swapped to disk) where it is possible to dynamically add li...
static Raster * make()
It creates and returns an empty raster with default raster driver.
boost::numeric::ublas::matrix< double > const * m_userWaveletFilterPtr
An optional pointer to an user filter.
Definition: WisperFusion.h:93
std::map< double, double > m_hiResRasterBandsSRFs
An optional vector of user supplied Spectral Response Functions for the high resolution band (The wav...
Definition: WisperFusion.h:83
Raster Processing algorithm input parameters base interface.
Raster Processing functions.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: WisperFusion.h:121
virtual void reset() _NOEXCEPT_OP(false)
Clear all internal allocated objects and reset the algorithm to its initial state.
A rectified grid is the spatial support for raster data.
Definition: raster/Grid.h:68
#define TERP_INSTANCE_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged, the current instance erro...
Definition: Macros.h:200
double getSRFArea(const std::map< double, double > &sRFs)
Return the SRF area.
unsigned int col
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
Definition: Macros.h:150
std::vector< te::rp::srf::SensorType > m_lowResRasterBandSensors
The low resolution bands sensors.
Definition: WisperFusion.h:73
te::rp::WaveletAtrousFilterType m_waveletFilterType
The wavelet filter type to use (default: TriangleWAFilter);.
Definition: WisperFusion.h:91