All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 "../statistics/core/NumericStatisticalSummary.h"
31 #include "Algorithm.h"
32 #include "Config.h"
33 #include "Exception.h"
34 
35 // Boost
36 #include <boost/numeric/ublas/matrix.hpp>
37 
38 // STL
39 #include <complex>
40 
41 namespace te
42 {
43 // Forward declaration
44  namespace gm
45  {
46  class Polygon;
47  }
48  namespace rst
49  {
50  class Band;
51  class Raster;
52  }
53 
54  namespace rp
55  {
56 
57  /*!
58  \class RasterAttributes
59 
60  \brief Extraction of attributes from Raster, Bands, and Polygons.
61  */
63  {
64  public:
65 
66  /*! \brief Public constructor. */
68 
70 
71  // overload
72  bool initialize(const AlgorithmInputParameters& inputParams) throw(te::rp::Exception);
73 
74  //overload
75  bool isInitialized() const;
76 
77  // overload
78  bool execute(AlgorithmOutputParameters& outputParams) throw(te::rp::Exception);
79 
80  // overload
81  void reset() throw(te::rp::Exception);
82 
83  /*!
84  \brief Returns the pixel values (real and imag) for the band, inside the polygon.
85 
86  \param raster The input raster.
87  \param band The position of the input band.
88  \param polygon The input polygon.
89 
90  \return The pixel values for the band, inside the polygon.
91 
92  \warning Band and polygon must fit.
93  */
94  std::vector<std::complex<double> > getComplexValuesFromBand(const te::rst::Raster& raster, unsigned int band, const te::gm::Polygon& polygon);
95 
96  /*!
97  \brief Returns the pixel values for the band, inside the polygon.
98 
99  \param raster The input raster.
100  \param band The position of the input band.
101  \param polygon The input polygon.
102 
103  \return The pixel values for the band, inside the polygon.
104 
105  \warning Band and polygon must fit.
106  */
107  std::vector<double> getValuesFromBand(const te::rst::Raster& raster, unsigned int band, const te::gm::Polygon& polygon);
108 
109  /*!
110  \brief Returns the pixel values (real and imag) for all the bands in raster, inside the polygon.
111 
112  \param raster The input band.
113  \param polygon The input polygon.
114  \param bands Bands to be processed from the input raster.
115 
116  \return A vector with the pixel values for all the bands in raster, inside the polygon, with values[band][pixel].
117 
118  \warning Bands and polygon must fit.
119  */
120  std::vector<std::vector<std::complex<double> > > getComplexValuesFromRaster(const te::rst::Raster& raster, const te::gm::Polygon& polygon, std::vector<unsigned int> bands);
121 
122  /*!
123  \brief Returns the pixel values for all the bands in raster, inside the polygon.
124 
125  \param raster The input band.
126  \param polygon The input polygon.
127  \param bands Bands to be processed from the input raster.
128 
129  \return A vector with the pixel values for all the bands in raster, inside the polygon, with values[band][pixel].
130 
131  \warning Bands and polygon must fit.
132  */
133  std::vector<std::vector<double> > getValuesFromRaster(const te::rst::Raster& raster, const te::gm::Polygon& polygon, std::vector<unsigned int> bands);
134 
135  /*!
136  \brief Returns several statistics from a set of pixels.
137 
138  \param pixels A vector of pixel values.
139 
140  \return A series of statistics (\sa te::stat::NumericStatisticalSummary).
141  */
142  te::stat::NumericStatisticalSummary getStatistics(std::vector<double>& pixels);
143 
144  /*!
145  \brief Returns the covariance matrix between vectors of pixel values.
146 
147  \param vpixels The vector of pixel vectors, with vpixels[band][pixel].
148  \param vmeans The vector of pixels means, one mean per vector of pixels.
149 
150  \return The covariance matrix between the vectors of pixel values.
151 
152  \warning All vectors sizes must fit.
153  */
154  boost::numeric::ublas::matrix<double> getCovarianceMatrix(const std::vector<std::vector<double> >& vpixels, const std::vector<double>& vmeans);
155  };
156 
157  } // end namespace rp
158 } // end namespace te
159 
160 #endif // __TERRALIB_RP_INTERNAL_RASTERATTRIBUTES_H
A structure to hold the set of statistics from a set of numerical values.
Raster Processing algorithm output parameters base interface.
Extraction of attributes from Raster, Bands, and Polygons.
Exception class.
Raster Processing algorithm base interface.
Definition: Algorithm.h:41
An abstract class for raster data strucutures.
Definition: Raster.h:71
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:111
Raster Processing algorithm base interface class.
Configuration flags for the Raster Processing module of TerraLib.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
Raster Processing algorithm input parameters base interface.