PCAFusion.h
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/PCAFusion.h
22  \brief Creation of skeleton imagems.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_PCAFUSION_H
26 #define __TERRALIB_RP_INTERNAL_PCAFUSION_H
27 
28 #include "Algorithm.h"
29 #include "../raster/Raster.h"
30 #include "../raster/Band.h"
31 #include "../raster/Interpolator.h"
32 
33 #include <vector>
34 #include <string>
35 #include <map>
36 #include <memory>
37 
38 namespace te
39 {
40  namespace rp
41  {
42  /*!
43  \class PCAFusion
44  \brief Fusion of a low-resolution multi-band image with a high resolution image using the PCA (Principal components analysis) method.
45  \details The PCA performs image fusion where the first principal component of the multi-spectral image is replaced by the histogram matched panchromatic imagery.
46  \note Reference: Tania Stathaki, "Image Fusion: Algorithms and Applications", Elsevier, First edition 2008.
47  \note This algorithm expects both images to be aligned over the same geographic region. No reprojection or crop operations are performed.
48  \ingroup rp_fus
49  */
51  {
52  public:
53 
54  /*!
55  \class InputParameters
56  \brief PCAFusion input parameters
57  */
59  {
60  public:
61 
62  te::rst::Raster const* m_lowResRasterPtr; //!< Input low-resolution multi-band raster.
63 
64  std::vector< unsigned int > m_lowResRasterBands; //!< The low-resolution raster band indexes.
65 
66  te::rst::Raster const* m_highResRasterPtr; //!< Input high-resolution raster.
67 
68  unsigned int m_highResRasterBand; //!< Band to process from the high-resolution raster.
69 
70  bool m_enableProgress; //!< Enable/Disable the progress interface (default:false).
71 
72  bool m_enableThreadedProcessing; //!< If true, threaded processing will be performed (best with multi-core or multi-processor systems (default:true).
73 
74  te::rst::Interpolator::Method m_interpMethod; //!< The raster interpolator method (default:NearestNeighbor).
75 
77 
79 
80  ~InputParameters();
81 
82  //overload
83  void reset() throw( te::rp::Exception );
84 
85  //overload
86  const InputParameters& operator=( const InputParameters& params );
87 
88  //overload
89  AbstractParameters* clone() const;
90  };
91 
92  /*!
93  \class OutputParameters
94  \brief PCAFusion output parameters
95  */
97  {
98  public:
99 
100  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
101 
102  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
103 
104  std::auto_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output fused raster.
105 
107 
109 
110  ~OutputParameters();
111 
112  //overload
113  void reset() throw( te::rp::Exception );
114 
115  //overload
116  const OutputParameters& operator=( const OutputParameters& params );
117 
118  //overload
119  AbstractParameters* clone() const;
120  };
121 
122  PCAFusion();
123 
124  ~PCAFusion();
125 
126  //overload
127  bool execute( AlgorithmOutputParameters& outputParams ) throw( te::rp::Exception );
128 
129  //overload
130  void reset() throw( te::rp::Exception );
131 
132  //overload
133  bool initialize( const AlgorithmInputParameters& inputParams ) throw( te::rp::Exception );
134 
135  //overload
136  bool isInitialized() const;
137 
138  protected:
139 
140  InputParameters m_inputParameters; //!< Input execution parameters.
141 
142  bool m_isInitialized; //!< Tells if this instance is initialized.
143 
144  /*!
145  \brief Load resampled data from the input image.
146  \param ressampledRasterPtr The loaded and ressampled raster data.
147  \return true if ok, false on errors.
148  */
149  bool loadRessampledRaster( std::auto_ptr< te::rst::Raster >& ressampledRasterPtr ) const;
150 
151  /*!
152  \brief Swap the band values by the normalized high resolution raster data.
153  \param pcaRaster The PCA raster.
154  \param pcaRasterBandIdx The band index where the values will be swapped.
155  \return true if ok, false on errors.
156  */
157  bool swapBandByHighResRaster( te::rst::Raster& pcaRaster, const unsigned int pcaRasterBandIdx );
158 
159  };
160 
161  } // end namespace rp
162 } // end namespace te
163 
164 #endif
165 
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: PCAFusion.h:70
bool m_enableThreadedProcessing
If true, threaded processing will be performed (best with multi-core or multi-processor systems (defa...
Definition: PCAFusion.h:72
te::rst::Raster const * m_highResRasterPtr
Input high-resolution raster.
Definition: PCAFusion.h:66
Base exception class for plugin module.
Definition: Exception.h:42
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: PCAFusion.h:100
Raster Processing algorithm output parameters base interface.
PCAFusion output parameters.
Definition: PCAFusion.h:96
Raster Processing algorithm base interface class.
Fusion of a low-resolution multi-band image with a high resolution image using the PCA (Principal com...
Definition: PCAFusion.h:50
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
te::rst::Raster const * m_lowResRasterPtr
Input low-resolution multi-band raster.
Definition: PCAFusion.h:62
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: PCAFusion.h:74
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
The generated output fused raster.
Definition: PCAFusion.h:104
Raster Processing algorithm base interface.
Definition: Algorithm.h:41
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
std::vector< unsigned int > m_lowResRasterBands
The low-resolution raster band indexes.
Definition: PCAFusion.h:64
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
Definition: PCAFusion.h:102
PCAFusion input parameters.
Definition: PCAFusion.h:58
Raster Processing algorithm input parameters base interface.
unsigned int m_highResRasterBand
Band to process from the high-resolution raster.
Definition: PCAFusion.h:68