All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SegmenterRegionGrowingSegmentsPool.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/SegmenterRegionGrowingSegmentsPool.h
22  \brief Segments pool.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_SEGMENTERREGIONGROWINGSEGMENTSPOOL_H
26 #define __TERRALIB_RP_INTERNAL_SEGMENTERREGIONGROWINGSEGMENTSPOOL_H
27 
28  #include "Config.h"
30  #include "SegmenterSegmentsBlock.h"
31  #include "Matrix.h"
32 
33  #include <boost/noncopyable.hpp>
34 
35  namespace te
36  {
37  namespace rp
38  {
39  /*!
40  \class SegmenterRegionGrowingSegmentsPool
41  \brief Segments pool.
42  \note The vector pointed by each SegmenterRegionGrowingSegment::m_neighborSegments will be deleted by the pool.
43  */
44  class TERPEXPORT SegmenterRegionGrowingSegmentsPool : private boost::noncopyable
45  {
46  public :
47 
49 
51 
52  /*!
53  \brief Pool initialization.
54  \param segsNumber The number of segments to allocate.
55  \param featuresNumber The number of features for each created segment.
56  \return true if ok, false on errors.
57  \note The segments pool will initiate just SegmenterRegionGrowingSegment::m_features vector and take the ownership of it.
58  */
59  bool initialize( const SegmenterSegmentsBlock::SegmentIdDataType segsNumber,
60  const unsigned int featuresNumber );
61 
62  /*!
63  \brief Retrive a stored segment.
64  \return A pointer to the next unused segment or null if all segments were used.
65  */
66  SegmenterRegionGrowingSegment* getNextSegment();
67 
68  /*!
69  \brief Clear all stored segments.
70  */
71  void clear();
72 
73  /*!
74  \brief Reset the segments use counter.
75  */
76  void resetUseCounter();
77 
78  /*!
79  \brief Return the current allocated segments number.
80  */
81  SegmenterSegmentsBlock::SegmentIdDataType getSegmentsNumber() const;
82 
83  /*!
84  \brief Return a reference to the internal segments matrix.
85  \return Return a reference to the internal segments matrix.
86  \note The number of matrix elemetns may be greater than the requested number of segments.
87  */
89  {
90  return m_segments;
91  };
92 
93  protected :
94 
95  /*!
96  \brief The number of segments allocated segments.
97  */
99 
100  /*!
101  \brief The number of features for each created segment.
102  */
103  unsigned int m_featuresNumber;
104 
105  /*!
106  \brief The next unused segment index.
107  */
109 
110  Matrix< SegmenterRegionGrowingSegment > m_segments; //!< Internal stored segments.
111 
113 
114  // Variables used by getNextSegment
115 
116  unsigned int m_getNextSegment_line;
117  unsigned int m_getNextSegment_col;
118 
119  };
120  } // namespace rp
121  } // namespace te
122 
123 #endif
Matrix< SegmenterRegionGrowingSegment > & getSegsMatrix()
Return a reference to the internal segments matrix.
unsigned int m_featuresNumber
The number of features for each created segment.
Matrix< SegmenterRegionGrowingSegment::FeatureType > m_segmentsFeatures
Internal stored segment features.
Region Growing segment.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:141
Generic template matrix.
Configuration flags for the Raster Processing module of TerraLib.
Segments block.
A generic template matrix.
Definition: Matrix.h:51
Matrix< SegmenterRegionGrowingSegment > m_segments
Internal stored segments.
SegmenterSegmentsBlock::SegmentIdDataType m_nextUnusedSegmentIdx
The next unused segment index.