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  class AlgorithmParametersSerializer;
39 
40  /*!
41  \class ClassifierSAMStrategy
42 
43  \brief Spectral Angle Mapper classification strategy.
44 
45  \details This algorithm maps the spectral similarity of input raster
46  to the given reference spectra wich can be either laboratory of field spectra.
47  This method assumes that the data have been reduced to apparent reflectance
48  with all dark current and path radiance biases removed.
49  Reference: The spectral image processing system (SIPS)- interactive
50  visualization and analysis of imaging spectrometer data. Kruse, F. A.;
51  Lefkoff, A. B.; Boardman, J. W.; Heidebrecht, K. B.; Shapiro, A. T.;
52  Barloon, P. J.; Goetz, A. F. H. The earth and space science information
53  system (ESSIS). AIP Conference Proceedings, Volume 283, pp. 192-201 (1993).
54 
55  \ingroup rp_class
56  */
58  {
59  public:
60 
61  typedef unsigned int ClassIDT; //!< Class ID type definition (zero means invalid ID).
62 
63  typedef std::vector< double > SampleT; //!< Class sample type definition.
64 
65  typedef std::vector< SampleT > SamplesT; //!< Class samples container type definition.
66 
67  typedef std::map< ClassIDT, SamplesT > ClassesSamplesT; //!< Classes samples container type definition.
68 
69  typedef boost::shared_ptr<ClassesSamplesT> ClassesSamplesTPtr; //!< A shared pointer to a multi classes samples container type definition.
70 
71  /*!
72  \class Parameters
73 
74  \brief Classifier Parameters
75  */
77  {
78  public:
79 
80  ClassesSamplesTPtr m_trainSamplesPtr; //!< A shared pointer to a always-valid structure where trainning samples are stored.
81 
82  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).
83 
85 
87 
88  //overload
89  const Parameters& operator=(const Parameters& params);
90 
91  //overload
92  void reset() ;
93 
94  //overload
95  AbstractParameters* clone() const;
96 
97  //overload
98  bool serialize ( AlgorithmParametersSerializer& serializer ) const;
99  };
100 
102 
104 
105  //overload
106  bool initialize(ClassifierStrategyParameters const* const strategyParams) ;
107 
108  //overload
109  bool execute() ;
110 
111  protected :
112 
113  bool m_isInitialized; //!< Is this instance initialized?
114 
116 
117  ClassifierSAMStrategy::Parameters m_initParams; //!< Initialization parameters.
118 
119  SamplesT m_classesMeans; //!< Classes means.
120 
121  std::vector< ClassIDT > m_classesIndex2ID; //!< An class index ordered vector of classes IDs;
122  };
123 
124  /*!
125  \class ClassifierSAMStrategyFactory
126 
127  \brief Spectral Angle Mapper strategy factory.
128  */
130  {
131  public:
132 
134 
136 
137  //overload
139  };
140 
141  } // end namespace rp
142 } // end namespace te
143 
144 #endif // __TERRALIB_RP_INTERNAL_CLASSIFIERSAMSTRATEGY_H
145 
Raster classifier strategy factory base class.
Raster classifier strategy base class.
A class to standardize algorithm parameters serialization.
Spectral Angle Mapper strategy factory.
te::rp::ClassifierStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
AbstractParameters * clone() const
Create a clone copy of this instance.
ClassesSamplesTPtr m_trainSamplesPtr
A shared pointer to a always-valid structure where trainning samples are stored.
bool serialize(AlgorithmParametersSerializer &serializer) const
Returns a parameter serialization object.
std::vector< double > m_maxAngularDistances
This is a vector of maximum acceptable angles (radians) between one pixel spectra and the reference s...
const Parameters & operator=(const Parameters &params)
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
Spectral Angle Mapper classification strategy.
unsigned int ClassIDT
Class ID type definition (zero means invalid ID).
ClassifierSAMStrategy::Parameters m_initParams
Initialization parameters.
boost::shared_ptr< ClassesSamplesT > ClassesSamplesTPtr
A shared pointer to a multi classes samples container type definition.
std::vector< ClassIDT > m_classesIndex2ID
An class index ordered vector of classes IDs;.
std::vector< SampleT > SamplesT
Class samples container type definition.
std::map< ClassIDT, SamplesT > ClassesSamplesT
Classes samples container type definition.
std::vector< double > SampleT
Class sample type definition.
bool m_isInitialized
Is this instance initialized?
bool execute()
Executes the classification strategy.
SamplesT m_classesMeans
Classes means.
bool initialize(ClassifierStrategyParameters const *const strategyParams)
Initialize the classification strategy.
Raster classifier strategy factory base class.
Raster classifier strategy base class.
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Proxy configuration file for TerraView (see terraview_config.h).