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() throw( te::rp::Exception );
72 
73  //overload
74  AbstractParameters* clone() const;
75  };
76 
78 
80 
81  //overload
82  bool initialize(
83  SegmenterStrategyParameters const* const strategyParams )
84  throw( te::rp::Exception );
85 
86  //overload
87  void reset();
88 
89  //overload
90  bool execute(
91  SegmenterIdsManager& segmenterIdsManager,
92  const te::rp::SegmenterSegmentsBlock& block2ProcessInfo,
93  const te::rst::Raster& inputRaster,
94  const std::vector< unsigned int >& inputRasterBands,
95  const std::vector< std::complex< double > >& inputRasterNoDataValues,
96  const std::vector< std::complex< double > >& inputRasterBandMinValues,
97  const std::vector< std::complex< double > >& inputRasterBandMaxValues,
98  te::rst::Raster& outputRaster,
99  const unsigned int outputRasterBand,
100  const bool enableProgressInterface ) throw( te::rp::Exception );
101 
102  //overload
103  double getMemUsageEstimation( const unsigned int bandsToProcess,
104  const unsigned int pixelsNumber ) const;
105 
106  //overload
107  unsigned int getOptimalBlocksOverlapSize() const;
108 
109  //overload
110  bool shouldComputeMinMaxValues() const;
111 
112  //overload
113  BlocksMergingMethod getBlocksMergingMethod() const;
114 
115  protected :
116  /*!
117  \brief Internal segments ids matrix type definition.
118  */
119  typedef Matrix< SegmenterSegmentsBlock::SegmentIdDataType >
121 
122  /*!
123  \brief true if this instance is initialized.
124  */
125  bool m_isInitialized;
126 
127  /*!
128  \brief Internal execution parameters.
129  */
131 
132  /*! \brief A pool of segments that can be reused on each strategy execution. */
134 
135  /*! \brief A internal segments IDs matrix that can be reused on each strategy execution. */
136  SegmentsIdsMatrixT m_segmentsIdsMatrix;
137 
138  /*!
139  \brief Initialize the segment objects container and the segment IDs container.
140  \param segmenterIdsManager A segments ids manager to acquire unique segments ids.
141  \param block2ProcessInfo Info about the block to process.
142  \param inputRaster The input raster.
143  \param inputRasterBands Input raster bands to use.
144  \param inputRasterNoDataValues A vector of values to be used as input raster no-data values.
145  \param inputRasterBandMinValues The minimum value present on each band.
146  \param inputRasterBandMinValues The maximum value present on each band.
147  \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.).
148  \return true if OK, false on errors.
149  */
150  bool initializeSegments( SegmenterIdsManager& segmenterIdsManager,
151  const te::rp::SegmenterSegmentsBlock& block2ProcessInfo,
152  const te::rst::Raster& inputRaster,
153  const std::vector< unsigned int >& inputRasterBands,
154  const std::vector< std::complex< double > >& inputRasterNoDataValues,
155  const std::vector< std::complex< double > >& inputRasterBandMinValues,
156  const std::vector< std::complex< double > >& inputRasterBandMaxValues,
157  SegmenterRegionGrowingSegment< rg::MeanFeatureType >** actSegsListHeadPtr );
158  };
159 
160  /*!
161  \class SegmenterRegionGrowingMeanStrategyFactory
162  \brief Raster region growing segmenter strategy factory.
163  \note Factory key: RegionGrowingMean
164  */
167  {
168  public:
169 
171 
173 
174  //overload
176 
177  };
178 
179  } // end namespace rp
180 } // end namespace te
181 
182 #endif // __TERRALIB_RP_INTERNAL_SEGMENTERREGIONGROWINGMEANSTRATEGY_H
te::rp::SegmenterStrategy
Raster segmenter strategy base class.
Definition: SegmenterStrategy.h:47
te::rp::Matrix
A generic template matrix.
Definition: Matrix.h:55
te
TerraLib.
Definition: AddressGeocodingOp.h:52
SegmenterSegmentsBlock.h
Segments block.
te::rp::SegmenterRegionGrowingMeanStrategy::Parameters
Segmenter Parameters.
Definition: SegmenterRegionGrowingMeanStrategy.h:61
Matrix.h
Generic template matrix.
te::rp::SegmenterRegionGrowingMeanStrategy
Raster region growing segmenter strategy.
Definition: SegmenterRegionGrowingMeanStrategy.h:53
te::rp::SegmenterStrategyParameters
Segmenter Strategy Parameters.
Definition: SegmenterStrategyParameters.h:40
te::rp::SegmenterRegionGrowingMeanStrategy::Parameters::operator=
const Parameters & operator=(const Parameters &params)
te::rp::SegmenterRegionGrowingMeanStrategyFactory::~SegmenterRegionGrowingMeanStrategyFactory
~SegmenterRegionGrowingMeanStrategyFactory()
te::rp::SegmenterRegionGrowingMeanStrategyFactory::build
te::rp::SegmenterStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
te::rp::SegmenterRegionGrowingMeanStrategyFactory::SegmenterRegionGrowingMeanStrategyFactory
SegmenterRegionGrowingMeanStrategyFactory()
te::rp::SegmenterRegionGrowingSegmentsPool
Segments pool.
Definition: SegmenterRegionGrowingSegmentsPool.h:46
SegmenterRegionGrowingSegmentsPool.h
Segments pool.
SegmenterRegionGrowingSegment.h
Region Growing segment.
te::rp::SegmenterStrategyFactory
Raster segmenter strategy factory base class.
Definition: SegmenterStrategyFactory.h:46
te::Exception
Base exception class for plugin module.
Definition: Exception.h:42
te::rp::SegmenterRegionGrowingStrategyParameters
Segmenter Region Growing Strategy Parameters.
Definition: SegmenterRegionGrowingStrategyParameters.h:41
TERPEXPORT
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
SegmenterRegionGrowingFunctions.h
te::rp::SegmenterRegionGrowingMeanStrategy::Parameters::~Parameters
~Parameters()
te::rp::SegmenterRegionGrowingMeanStrategyFactory
Raster region growing segmenter strategy factory.
Definition: SegmenterRegionGrowingMeanStrategy.h:167
te::rp::SegmenterRegionGrowingSegment
Region Growing segment.
Definition: SegmenterRegionGrowingSegment.h:42
te::rp::SegmenterRegionGrowingMeanStrategy::Parameters::reset
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
SegmenterStrategyFactory.h
Raster segmenter strategy factory base class.
SegmenterStrategy.h
Raster segmenter strategy base class.
te::rp::SegmenterRegionGrowingMeanStrategy::Parameters::Parameters
Parameters()
te::rp::SegmenterStrategy::BlocksMergingMethod
BlocksMergingMethod
Blocks merging method.
Definition: SegmenterStrategy.h:53
te::rp::SegmenterIdsManager
Segmenter segments IDs manager.
Definition: SegmenterIdsManager.h:45
te::rp::SegmenterSegmentsBlock
Segmenter segments block description class.
Definition: SegmenterSegmentsBlock.h:42
SegmenterRegionGrowingStrategyParameters.h
te::rp::rg::MeanFeatureType
float MeanFeatureType
Mean Strategy feature type.
Definition: SegmenterRegionGrowingFunctions.h:57
SegmenterRegionGrowingMerger.h
Segmenter merger used in region growing process.