All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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  \ingroup rp
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.
69  \param segmenterIdsManager The segments IDs manager to be used when
70  acquiring/releaseing unique segment IDs.
71  \param inputRaster Input raster.
72  \param inputRasterBands Input raster bands.
73  \param inputRasterGains Normalization gain values to be appliet over the respective input raster bands.
74  \param inputRasterOffsets Normalization offset values to be appliet over the respective input raster bands.
75  \param outputRaster Output raster.
76  \param outputRasterBand Output raster band.
77  \param enableProgressInterface Enable the internal strategy to update
78  the progress interface.
79  \return true if OK, false on errors.
80  */
81  virtual bool execute(
82  SegmenterIdsManager& segmenterIdsManager,
83  const te::rst::Raster& inputRaster,
84  const std::vector< unsigned int >& inputRasterBands,
85  const std::vector< double >& inputRasterGains,
86  const std::vector< double >& inputRasterOffsets,
87  te::rst::Raster& outputRaster,
88  const unsigned int outputRasterBand,
89  const bool enableProgressInterface ) throw( te::rp::Exception ) = 0;
90 
91  /*!
92  \brief Returns a memory estimation (bytes).
93  \details This parameter is used by the segmenter to guess the sub-image blocks size.
94  \param bandsToProcess The number of input raster bands that will be processed at the strategy execution time.
95  \param pixelsNumber The number of pixels.
96  \return A positive memory use estimation.
97  */
98  virtual double getMemUsageEstimation( const unsigned int bandsToProcess,
99  const unsigned int pixelsNumber ) const = 0;
100 
101  /*!
102  \brief Returns a optimal blocks overlap size (number of border pixels
103  overlapped between blocks, under one direction).
104  \note This value will be used in the case
105  where the image is splitted into blocks for segmentation.
106  \return The blocks overlap size.
107  */
108  virtual unsigned int getOptimalBlocksOverlapSize() const = 0;
109 
110  protected:
111 
113 
114  private:
115 
117 
118  const SegmenterStrategy& operator=( const SegmenterStrategy& );
119  };
120 
121  } // end namespace rp
122 } // end namespace te
123 
124 #endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
125 
Exception class.
Raster segmenter strategy parameters base class.
Segments IDs manager.
Segmenter segments IDs manager.
Raster segmenter strategy base class.
Configuration flags for the Raster Processing module of TerraLib.
An abstract class for raster data strucutures.
Definition: Raster.h:70
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:91