All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RasterAttributes.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/RasterAttributes.h
22 
23  \brief Extraction of attributes from Raster, Bands, and Polygons.
24  */
25 
26 #ifndef __TERRALIB_RP_INTERNAL_RASTERATTRIBUTES_H
27 #define __TERRALIB_RP_INTERNAL_RASTERATTRIBUTES_H
28 
29 // TerraLib
30 #include "Algorithm.h"
31 #include "Config.h"
32 #include "Exception.h"
33 
34 // Boost
35 #include <boost/numeric/ublas/matrix.hpp>
36 
37 // STL
38 #include <complex>
39 
40 namespace te
41 {
42 // Forward declaration
43  namespace gm
44  {
45  class Polygon;
46  }
47  namespace rst
48  {
49  class Band;
50  class Raster;
51  }
52 
53  namespace rp
54  {
55 
56  /*!
57  \class RasterAttributes
58 
59  \brief Extraction of attributes from Raster, Bands, and Polygons.
60  */
62  {
63  public:
64 
65  /*! \brief Public constructor. */
67 
69 
70  // overload
71  bool initialize(const AlgorithmInputParameters& inputParams) throw(te::rp::Exception);
72 
73  //overload
74  bool isInitialized() const;
75 
76  // overload
77  bool execute(AlgorithmOutputParameters& outputParams) throw(te::rp::Exception);
78 
79  // overload
80  void reset() throw(te::rp::Exception);
81 
82  /*!
83  \brief Returns the pixel values for the band, inside the polygon.
84 
85  \param raster The input raster.
86  \param band The position of the input band.
87  \param polygon The input polygon.
88 
89  \return The pixel values for the band, inside the polygon.
90 
91  \warning Band and polygon must fit.
92  */
93  std::vector<std::complex<double> > getValuesFromBand(const te::rst::Raster& raster, unsigned int band, const te::gm::Polygon& polygon);
94 
95  /*!
96  \brief Returns the pixel values for all the bands in raster, inside the polygon.
97 
98  \param raster The input band.
99  \param polygon The input polygon.
100  \param bands Bands to be processed from the input raster.
101 
102  \return A vector with the pixel values for all the bands in raster, inside the polygon, with values[pixel][band].
103 
104  \warning Bands and polygon must fit.
105  */
106  std::vector<std::vector<std::complex<double> > > getValuesFromRaster(const te::rst::Raster& raster, const te::gm::Polygon& polygon, std::vector<unsigned int> bands);
107 
108  /*!
109  \brief Returns the mean value for the pixels of a band, inside the polygon.
110 
111  \param band The input band.
112  \param polygon The input polygon.
113 
114  \return The mean value for the band, inside the polygon.
115 
116  \warning Bands and polygon must fit.
117  */
118  std::complex<double> getMean(const te::rst::Band& band, const te::gm::Polygon& polygon);
119 
120  /*!
121  \brief Returns the mean value for the pixels of a band, inside the polygon.
122 
123  \param raster The input raster.
124  \param polygon The input polygon.
125  \param bands Bands to be processed from the input raster.
126 
127  \return A vector of means from the raster, inside the polygon.
128 
129  \warning Bands and polygon must fit, the bands to be processed must be available in the input raster.
130  */
131  std::vector<std::complex<double> > getMeans(const te::rst::Raster& raster, const te::gm::Polygon& polygon, std::vector<unsigned int> bands);
132 
133  /*!
134  \brief Returns the covariance matrix between raster bands, inside the polygon.
135 
136  \param raster The input raster.
137  \param polygon The input polygon.
138  \param bands Bands to be processed from the input raster.
139 
140  \return The covariance matrix between raster bands, inside the polygon.
141 
142  \warning Raster bands and polygon must fit.
143  */
144  boost::numeric::ublas::matrix<double> getCovarianceMatrix(const te::rst::Raster& raster, const te::gm::Polygon& polygon, std::vector<unsigned int> bands);
145  };
146 
147  } // end namespace rp
148 } // end namespace te
149 
150 #endif // __TERRALIB_RP_INTERNAL_RASTERATTRIBUTES_H
Exception class.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
Raster Processing algorithm base interface class.
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
A raster band description.
Definition: Band.h:63
Extraction of attributes from Raster, Bands, and Polygons.
Configuration flags for the Raster Processing module of TerraLib.
Raster Processing algorithm output parameters base interface.
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
Raster Processing algorithm input parameters base interface.