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) 2001-2009 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 "Config.h"
31 #include "Exception.h"
32 
33 #include "../raster/Raster.h"
34 
35 #include <vector>
36 
37 namespace te
38 {
39  namespace rp
40  {
41  /*!
42  \class SegmenterStrategy
43  \brief Raster segmenter strategy base class.
44  */
46  {
47  public:
48 
49  virtual ~SegmenterStrategy();
50 
51  /*!
52  \brief Initialize the segmentation strategy.
53  \param strategyParams A pointer to the user given specific segmentation
54  strategy parameters ou NULL if no parameters are present.
55  \return true if OK, false on errors.
56  */
57  virtual bool initialize(
58  SegmenterStrategyParameters const* const strategyParams )
59  throw( te::rp::Exception ) = 0;
60 
61  /*!
62  \brief Clear all internal allocated resources and go back to the initial not-initialized state.
63  */
64  virtual void reset() = 0;
65 
66  /*!
67  \brief Executes the segmentation strategy.
68  \param segmenterIdsManager The segments IDs manager to be used when
69  acquiring/releaseing unique segment IDs.
70  \param inputRaster Input raster.
71  \param inputRasterBands Input raster bands.
72  \param inputRasterGains Normalization gain values to be appliet over the respective input raster bands.
73  \param inputRasterOffsets Normalization offset values to be appliet over the respective input raster bands.
74  \param outputRaster Output raster.
75  \param outputRasterBand Output raster band.
76  \param enableProgressInterface Enable the internal strategy to update
77  the progress interface.
78  \return true if OK, false on errors.
79  */
80  virtual bool execute(
81  SegmenterIdsManager& segmenterIdsManager,
82  const te::rst::Raster& inputRaster,
83  const std::vector< unsigned int >& inputRasterBands,
84  const std::vector< double >& inputRasterGains,
85  const std::vector< double >& inputRasterOffsets,
86  te::rst::Raster& outputRaster,
87  const unsigned int outputRasterBand,
88  const bool enableProgressInterface ) throw( te::rp::Exception ) = 0;
89 
90  /*!
91  \brief Returns a memory estimation (bytes).
92  \details This parameter is used by the segmenter to guess the sub-image blocks size.
93  \param bandsToProcess The number of input raster bands that will be processed at the strategy execution time.
94  \param pixelsNumber The number of pixels.
95  \return A positive memory use estimation.
96  */
97  virtual double getMemUsageEstimation( const unsigned int bandsToProcess,
98  const unsigned int pixelsNumber ) const = 0;
99 
100  /*!
101  \brief Returns a optimal blocks overlap size (number of border pixels
102  overlapped between blocks, under one direction).
103  \note This value will be used in the case
104  where the image is splitted into blocks for segmentation.
105  \return The blocks overlap size.
106  */
107  virtual unsigned int getOptimalBlocksOverlapSize() const = 0;
108 
109  protected:
110 
112 
113  private:
114 
116 
117  const SegmenterStrategy& operator=( const SegmenterStrategy& );
118  };
119 
120  } // end namespace rp
121 } // end namespace te
122 
123 #endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
124 
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:111
Configuration flags for the Raster Processing module of TerraLib.
Raster segmenter strategy parameters base class.