ClassifierSAMStrategy.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/ClassifierSAMStrategy.h
22  \brief Spectral Angle Mapper classification strategy.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_CLASSIFIERSAMSTRATEGY_H
26 #define __TERRALIB_RP_INTERNAL_CLASSIFIERSAMSTRATEGY_H
27 
28 #include "ClassifierStrategy.h"
30 #include "Config.h"
31 
32 #include <boost/shared_ptr.hpp>
33 
34 namespace te
35 {
36  namespace rp
37  {
38  /*!
39  \class ClassifierSAMStrategy
40 
41  \brief Spectral Angle Mapper classification strategy.
42 
43  \details This algorithm maps the spectral similarity of input raster
44  to the given reference spectra wich can be either laboratory of field spectra.
45  This method assumes that the data have been reduced to apparent reflectance
46  with all dark current and path radiance biases removed.
47  Reference: The spectral image processing system (SIPS)- interactive
48  visualization and analysis of imaging spectrometer data. Kruse, F. A.;
49  Lefkoff, A. B.; Boardman, J. W.; Heidebrecht, K. B.; Shapiro, A. T.;
50  Barloon, P. J.; Goetz, A. F. H. The earth and space science information
51  system (ESSIS). AIP Conference Proceedings, Volume 283, pp. 192-201 (1993).
52 
53  \ingroup rp_class
54  */
56  {
57  public:
58 
59  typedef unsigned int ClassIDT; //!< Class ID type definition (zero means invalid ID).
60 
61  typedef std::vector< double > SampleT; //!< Class sample type definition.
62 
63  typedef std::vector< SampleT > SamplesT; //!< Class samples container type definition.
64 
65  typedef std::map< ClassIDT, SamplesT > ClassesSamplesT; //!< Classes samples container type definition.
66 
67  typedef boost::shared_ptr<ClassesSamplesT> ClassesSamplesTPtr; //!< A shared pointer to a multi classes samples container type definition.
68 
69  /*!
70  \class Parameters
71 
72  \brief Classifier Parameters
73  */
75  {
76  public:
77 
78  ClassesSamplesTPtr m_trainSamplesPtr; //!< A shared pointer to a always-valid structure where trainning samples are stored.
79 
80  std::vector< double > m_maxAngularDistances; //!< This is a vector of maximum acceptable angles (radians) between one pixel spectra and the reference spectra for each class (pixels with angular distance higher than this value will not be classifyed as belonging to each class (common used default:0.1 radians).
81 
82  Parameters();
83 
84  ~Parameters();
85 
86  //overload
87  const Parameters& operator=(const Parameters& params);
88 
89  //overload
90  void reset() throw( te::rp::Exception );
91 
92  //overload
93  AbstractParameters* clone() const;
94  };
95 
97 
99 
100  //overload
101  bool initialize(ClassifierStrategyParameters const* const strategyParams) throw(te::rp::Exception);
102 
103  //overload
104  bool execute(const te::rst::Raster& inputRaster, const std::vector<unsigned int>& inputRasterBands,
105  const std::vector<te::gm::Polygon*>& inputPolygons, te::rst::Raster& outputRaster,
106  const unsigned int outputRasterBand, const bool enableProgressInterface) throw(te::rp::Exception);
107 
108  // overload
109  std::vector< int > getOutputDataTypes() const;
110 
111  protected :
112 
113  bool m_isInitialized; //!< Is this instance initialized?
114 
115  ClassifierSAMStrategy::Parameters m_initParams; //!< Initialization parameters.
116 
117  SamplesT m_classesMeans; //!< Classes means.
118 
119  std::vector< ClassIDT > m_classesIndex2ID; //!< An class index ordered vector of classes IDs;
120  };
121 
122  /*!
123  \class ClassifierSAMStrategyFactory
124 
125  \brief Spectral Angle Mapper strategy factory.
126  */
128  {
129  public:
130 
132 
134 
135  //overload
137  };
138 
139  } // end namespace rp
140 } // end namespace te
141 
142 #endif // __TERRALIB_RP_INTERNAL_CLASSIFIERSAMSTRATEGY_H
143 
std::map< ClassIDT, SamplesT > ClassesSamplesT
Classes samples container type definition.
Base exception class for plugin module.
Definition: Exception.h:42
Spectral Angle Mapper strategy factory.
boost::shared_ptr< ClassesSamplesT > ClassesSamplesTPtr
A shared pointer to a multi classes samples container type definition.
ClassesSamplesTPtr m_trainSamplesPtr
A shared pointer to a always-valid structure where trainning samples are stored.
std::vector< double > SampleT
Class sample type definition.
Raster classifier strategy factory base class.
unsigned int ClassIDT
Class ID type definition (zero means invalid ID).
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
Raster classifier strategy factory base class.
Configuration flags for the Raster Processing module of TerraLib.
Raster classifier strategy base class.
std::vector< SampleT > SamplesT
Class samples container type definition.
Raster classifier strategy base class.
Spectral Angle Mapper classification strategy.
std::vector< double > m_maxAngularDistances
This is a vector of maximum acceptable angles (radians) between one pixel spectra and the reference s...