All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SegmenterStrategy.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/SegmenterStrategy.h
22  \brief Raster segmenter strategy base class.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_SEGMENTERSTRATEGY_H
26 #define __TERRALIB_RP_INTERNAL_SEGMENTERSTRATEGY_H
27 
28 #include "SegmenterIdsManager.h"
30 #include "SegmenterSegmentsBlock.h"
31 #include "Config.h"
32 #include "Exception.h"
33 
34 #include "../raster/Raster.h"
35 
36 #include <vector>
37 
38 namespace te
39 {
40  namespace rp
41  {
42  /*!
43  \class SegmenterStrategy
44  \brief Raster segmenter strategy base class.
45  */
47  {
48  public:
49 
50  virtual ~SegmenterStrategy();
51 
52  /*!
53  \brief Initialize the segmentation strategy.
54  \param strategyParams A pointer to the user given specific segmentation
55  strategy parameters ou NULL if no parameters are present.
56  \return true if OK, false on errors.
57  */
58  virtual bool initialize(
59  SegmenterStrategyParameters const* const strategyParams )
60  throw( te::rp::Exception ) = 0;
61 
62  /*!
63  \brief Clear all internal allocated resources and go back to the initial not-initialized state.
64  */
65  virtual void reset() = 0;
66 
67  /*!
68  \brief Executes the segmentation strategy over region delimited by the given block.
69  \param segmenterIdsManager The segments IDs manager to be used when acquiring/releaseing unique segment IDs.
70  \param block2ProcessInfo The information about the block of raster that must be processed.
71  \param inputRaster Input raster.
72  \param inputRasterBands Input raster bands.
73  \param inputRasterNoDataValues A vector of values to be used as input raster no-data values.
74  \param inputRasterBandMinValues The minimum value present on each band.
75  \param inputRasterBandMinValues The maximum value present on each band.
76  \param outputRaster Output raster.
77  \param outputRasterBand Output raster band.
78  \param enableProgressInterface Enable the internal strategy to update
79  the progress interface.
80  \return true if OK, false on errors.
81  \note The used gaind/ofset calcule: new_value = ( old_value + offset ) * gain
82  */
83  virtual bool execute(
84  SegmenterIdsManager& segmenterIdsManager,
85  const te::rp::SegmenterSegmentsBlock& block2ProcessInfo,
86  const te::rst::Raster& inputRaster,
87  const std::vector< unsigned int >& inputRasterBands,
88  const std::vector< double >& inputRasterNoDataValues,
89  const std::vector< double >& inputRasterBandMinValues,
90  const std::vector< double >& inputRasterBandMaxValues,
91  te::rst::Raster& outputRaster,
92  const unsigned int outputRasterBand,
93  const bool enableProgressInterface ) throw( te::rp::Exception ) = 0;
94 
95  /*!
96  \brief Returns a memory estimation (bytes).
97  \details This parameter is used by the segmenter to guess the sub-image blocks size.
98  \param bandsToProcess The number of input raster bands that will be processed at the strategy execution time.
99  \param pixelsNumber The number of pixels.
100  \return A positive memory use estimation.
101  */
102  virtual double getMemUsageEstimation( const unsigned int bandsToProcess,
103  const unsigned int pixelsNumber ) const = 0;
104 
105  /*!
106  \brief Returns a optimal blocks overlap size (number of border pixels
107  overlapped between blocks, under one direction).
108  \note This value will be used in the case
109  where the image is splitted into blocks for segmentation.
110  \return The blocks overlap size.
111  */
112  virtual unsigned int getOptimalBlocksOverlapSize() const = 0;
113 
114  protected:
115 
117 
118  private:
119 
121 
122  const SegmenterStrategy& operator=( const SegmenterStrategy& );
123  };
124 
125  } // end namespace rp
126 } // end namespace te
127 
128 #endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
129 
Segmenter segments IDs manager.
Exception class.
Segments IDs manager.
An abstract class for raster data strucutures.
Definition: Raster.h:71
Raster segmenter strategy base class.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:141
Configuration flags for the Raster Processing module of TerraLib.
Segments block.
Raster segmenter strategy parameters base class.
Segmenter segments block description class.