SegmenterRegionGrowingMeanStrategy.h
Go to the documentation of this file.
1 /* Copyright (C) 2015 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/SegmenterRegionGrowingMeanStrategy.h
22  \brief Raster region growing segmenter Mean strategy.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_SEGMENTERREGIONGROWINGMEANSTRATEGY_H
26 #define __TERRALIB_RP_INTERNAL_SEGMENTERREGIONGROWINGMEANSTRATEGY_H
27 
29 #include "SegmenterStrategy.h"
34 #include "SegmenterSegmentsBlock.h"
36 #include "Matrix.h"
37 #include "Config.h"
38 
39 #include <vector>
40 #include <list>
41 #include <set>
42 
43 namespace te
44 {
45  namespace rp
46  {
47  /*!
48  \class SegmenterRegionGrowingMeanStrategy
49  \brief Raster region growing segmenter strategy.
50  \ingroup rp_seg
51  */
53  {
54  public :
55 
56  /*!
57  \class Parameters
58  \brief Segmenter Parameters
59  */
61  {
62  public:
64 
66 
67  //overload
68  const Parameters& operator=( const Parameters& params );
69 
70  //overload
71  void reset() ;
72 
73  //overload
74  AbstractParameters* clone() const;
75 
76  //overload
77  bool initialize( SegmenterStrategyParameters const* const strategyParams );
78 
79  //overload
80  bool serialize( AlgorithmParametersSerializer& serializer ) const;
81  };
82 
84 
86 
87  //overload
88  bool initialize(
89  SegmenterStrategyParameters const* const strategyParams );
90 
91  //overload
92  void reset();
93 
94  //overload
95  bool execute(
96  SegmenterIdsManager& segmenterIdsManager,
97  const te::rp::SegmenterSegmentsBlock& block2ProcessInfo,
98  const te::rst::Raster& inputRaster,
99  const std::vector< unsigned int >& inputRasterBands,
100  const std::vector< std::complex< double > >& inputRasterNoDataValues,
101  const std::vector< std::complex< double > >& inputRasterBandMinValues,
102  const std::vector< std::complex< double > >& inputRasterBandMaxValues,
103  te::rst::Raster& outputRaster,
104  const unsigned int outputRasterBand,
105  const bool enableProgressInterface ) ;
106 
107  //overload
108  double getMemUsageEstimation( const unsigned int bandsToProcess,
109  const unsigned int pixelsNumber ) const;
110 
111  //overload
112  unsigned int getOptimalBlocksOverlapSize() const;
113 
114  //overload
116 
117  //overload
119 
120  protected :
121  /*!
122  \brief Internal segments ids matrix type definition.
123  */
126 
127  /*!
128  \brief true if this instance is initialized.
129  */
131 
132  /*!
133  \brief Internal execution parameters.
134  */
136 
137  /*! \brief A pool of segments that can be reused on each strategy execution. */
139 
140  /*! \brief A internal segments IDs matrix that can be reused on each strategy execution. */
142 
143  /*!
144  \brief Initialize the segment objects container and the segment IDs container.
145  \param segmenterIdsManager A segments ids manager to acquire unique segments ids.
146  \param block2ProcessInfo Info about the block to process.
147  \param inputRaster The input raster.
148  \param inputRasterBands Input raster bands to use.
149  \param inputRasterNoDataValues A vector of values to be used as input raster no-data values.
150  \param inputRasterBandMinValues The minimum value present on each band.
151  \param inputRasterBandMinValues The maximum value present on each band.
152  \param actSegsListHeadPtr A pointer the the active segments list head or a null points if no segments were initialized (entire image with no data, i.e.).
153  \return true if OK, false on errors.
154  */
155  bool initializeSegments( SegmenterIdsManager& segmenterIdsManager,
156  const te::rp::SegmenterSegmentsBlock& block2ProcessInfo,
157  const te::rst::Raster& inputRaster,
158  const std::vector< unsigned int >& inputRasterBands,
159  const std::vector< std::complex< double > >& inputRasterNoDataValues,
160  const std::vector< std::complex< double > >& inputRasterBandMinValues,
161  const std::vector< std::complex< double > >& inputRasterBandMaxValues,
163  };
164 
165  /*!
166  \class SegmenterRegionGrowingMeanStrategyFactory
167  \brief Raster region growing segmenter strategy factory.
168  \note Factory key: RegionGrowingMean
169  */
172  {
173  public:
174 
176 
178 
179  //overload
181 
182  };
183 
184  } // end namespace rp
185 } // end namespace te
186 
187 #endif // __TERRALIB_RP_INTERNAL_SEGMENTERREGIONGROWINGMEANSTRATEGY_H
Generic template matrix.
Segmenter merger used in region growing process.
Region Growing segment.
Raster segmenter strategy factory base class.
Raster segmenter strategy base class.
A class to standardize algorithm parameters serialization.
Segmenter segments IDs manager.
Raster region growing segmenter strategy factory.
te::rp::SegmenterStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
bool serialize(AlgorithmParametersSerializer &serializer) const
Returns a parameter serialization object.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
AbstractParameters * clone() const
Create a clone copy of this instance.
bool initialize(SegmenterStrategyParameters const *const strategyParams)
const Parameters & operator=(const Parameters &params)
double getMemUsageEstimation(const unsigned int bandsToProcess, const unsigned int pixelsNumber) const
Returns a memory estimation (bytes).
SegmenterRegionGrowingSegmentsPool< rg::MeanFeatureType > m_segmentsPool
A pool of segments that can be reused on each strategy execution.
BlocksMergingMethod getBlocksMergingMethod() const
Return the strategy blocks merging method.
SegmentsIdsMatrixT m_segmentsIdsMatrix
A internal segments IDs matrix that can be reused on each strategy execution.
Matrix< SegmenterSegmentsBlock::SegmentIdDataType > SegmentsIdsMatrixT
Internal segments ids matrix type definition.
bool execute(SegmenterIdsManager &segmenterIdsManager, const te::rp::SegmenterSegmentsBlock &block2ProcessInfo, const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::complex< double > > &inputRasterNoDataValues, const std::vector< std::complex< double > > &inputRasterBandMinValues, const std::vector< std::complex< double > > &inputRasterBandMaxValues, te::rst::Raster &outputRaster, const unsigned int outputRasterBand, const bool enableProgressInterface)
Executes the segmentation strategy over region delimited by the given block.
unsigned int getOptimalBlocksOverlapSize() const
Returns a optimal blocks overlap size (number of border pixels overlapped between blocks,...
void reset()
Clear all internal allocated resources and go back to the initial not-initialized state.
bool shouldComputeMinMaxValues() const
Returns if the min and max pixel values should be computed.
bool initializeSegments(SegmenterIdsManager &segmenterIdsManager, const te::rp::SegmenterSegmentsBlock &block2ProcessInfo, const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::complex< double > > &inputRasterNoDataValues, const std::vector< std::complex< double > > &inputRasterBandMinValues, const std::vector< std::complex< double > > &inputRasterBandMaxValues, SegmenterRegionGrowingSegment< rg::MeanFeatureType > **actSegsListHeadPtr)
Initialize the segment objects container and the segment IDs container.
bool m_isInitialized
true if this instance is initialized.
SegmenterRegionGrowingMeanStrategy::Parameters m_parameters
Internal execution parameters.
bool initialize(SegmenterStrategyParameters const *const strategyParams)
Initialize the segmentation strategy.
Segmenter segments block description class.
Raster segmenter strategy factory base class.
Raster segmenter strategy base class.
BlocksMergingMethod
Blocks merging method.
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
Proxy configuration file for TerraView (see terraview_config.h).