PostClassification.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/PostClassification.h
22 \brief Raster post classification.
23 */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_POSTCLASSIFICATION_H
26 #define __TERRALIB_RP_INTERNAL_POSTCLASSIFICATION_H
27 
28 #include "Algorithm.h"
29 #include "../raster/Raster.h"
30 
31 namespace te
32 {
33  namespace rp
34  {
35  /*!
36  \class PostClassification
37  \brief Raster post classification.
38  \ingroup rp_enh
39  */
41  {
42  public:
43 
44  /*!
45  \class InputParameters
46  \brief Filter input parameters
47  */
49  {
50  public:
51 
52  te::rst::Raster const* m_inRasterPtr; //!< Input raster.
53 
54  bool m_enableRasterCache; // Enable/disable input raster cache (default:true).
55 
56  unsigned int m_weight; //!< The weight value defines the number of times the frequency of the central point has to be considered.
57 
58  unsigned int m_threshold; //!< The threshold value is the frequency value above which the central point is modified.
59 
61 
63 
65 
66  //overload
67  void reset() _NOEXCEPT_OP(false);
68 
69  //overload
70  const InputParameters& operator=(const InputParameters& params);
71 
72  //overload
73  AbstractParameters* clone() const;
74 
75  //overload
76  bool serialize ( AlgorithmParametersSerializer& serializer ) const;
77  };
78 
79  /*!
80  \class OutputParameters
81  \brief PostClassification output parameters
82  */
84  {
85  public:
86 
87  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
88 
89  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the raster (as described in te::raster::RasterFactory).
90 
91  std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< A pointer the ge generated output raster (label image).
92 
94 
96 
98 
99  //overload
100  void reset() _NOEXCEPT_OP(false);
101 
102  //overload
103  const OutputParameters& operator=(const OutputParameters& params);
104 
105  //overload
106  AbstractParameters* clone() const;
107  };
108 
110 
112 
113  //overload
114  bool execute(AlgorithmOutputParameters& outputParams) _NOEXCEPT_OP(false);
115 
116  //overload
117  void reset() _NOEXCEPT_OP(false);
118 
119  //overload
120  bool initialize(const AlgorithmInputParameters& inputParams) _NOEXCEPT_OP(false);
121 
122  //overload
123  bool isInitialized() const;
124 
125  protected:
126 
127  bool m_isInitialized; //!< Is this instance already initialized?
128 
129  PostClassification::InputParameters m_inputParameters; //!< Input parameters.
130 
131  /*!
132  \brief Apply the post classification.
133  \param srcRaster Source raster.
134  \param srcBandIdx Source raster band index.
135  \param dstRaster Destination raster.
136  \param dstBandIdx Destination raster band index.
137  \param weight Weight value.
138  \param threshold Threshold value.
139  \param useProgress if true, the progress interface must be used.
140  */
141  bool runPostClassification(const te::rst::Raster& srcRaster, te::rst::Raster& dstRaster,
142  unsigned int weight, unsigned int threshold);
143  };
144 
145  } // end namespace rp
146 } // end namespace te
147 
148 #endif
149 
#define _NOEXCEPT_OP(x)
Raster Processing algorithm input parameters base interface.
Raster Processing algorithm output parameters base interface.
A class to standardize algorithm parameters serialization.
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
InputParameters(const InputParameters &)
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
unsigned int m_weight
The weight value defines the number of times the frequency of the central point has to be considered.
te::rst::Raster const * m_inRasterPtr
Input raster.
unsigned int m_threshold
The threshold value is the frequency value above which the central point is modified.
PostClassification output parameters.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
OutputParameters(const OutputParameters &)
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
A pointer the ge generated output raster (label image).
Raster post classification.
An abstract class for raster data strucutures.
Definition: Raster.h:72
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Abstract algorithm.