BandProperty.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/raster/BandProperty.h
22 
23  \brief It describes one band (or dimension) of a raster.
24 */
25 
26 #ifndef __TERRALIB_RASTER_INTERNAL_BANDPROPERTY_H
27 #define __TERRALIB_RASTER_INTERNAL_BANDPROPERTY_H
28 
29 // TerraLib
30 #include "../common/UnitOfMeasure.h"
31 #include "Config.h"
32 #include "Enums.h"
33 
34 // STL
35 #include <complex>
36 #include <string>
37 #include <vector>
38 
39 // Boost
40 #include <boost/shared_ptr.hpp>
41 
42 namespace te
43 {
44  namespace rst
45  {
46  /*!
47  \class BandProperty
48 
49  \brief A raster band description.
50 
51  The band property describes how to interpret (and use) values that
52  can be associated to each element of a raster, in one given dimension
53  (e.g. a band of multi-hiperspectral remote sensing image). Each instance
54  of this class refers to a particular dimension. This implementation defines
55  a set of information commonly used to describe any raster.
56 
57  \ingroup rst
58 
59  \sa RasterProperty, Raster, Band
60  */
62  {
63  public:
64 
65  /*!
66  \struct ColorEntry
67 
68  \brief An structure to represent a color tuple.
69  */
70  struct ColorEntry
71  {
72  short c1; //!< gray, red, cyan or hue.
73  short c2; //!< green, magenta, or lightness.
74  short c3; //!< blue, yellow, or saturation.
75  short c4; //!< alpha or blackband.
76  };
77 
78  /*!
79  \brief Constructor.
80 
81  \param idx The band index in the set of bands.
82  \param t The data type of the band elements.
83  \param desc The band description.
84  */
85  BandProperty(std::size_t idx, int t, const std::string& desc = std::string(""));
86 
87  /*!
88  \brief Copy constructor.
89 
90  \param rhs The right-hand-side copy that would be used to copy from.
91  */
92  BandProperty(const BandProperty& rhs);
93 
94  /*! \brief Destructor. */
95  ~BandProperty();
96 
97  /*!
98  \brief Assignment operator.
99 
100  \param rhs The right-hand-side copy that would be used to copy from.
101 
102  \return A reference to this object.
103  */
104  BandProperty& operator=(const BandProperty& rhs);
105 
106  /*!
107  \brief It returns the data type of the elements in the band.
108 
109  \note The types are listed in terralib/datatype/DataTypes.h
110 
111  \return The data type of the elements in the band.
112  */
113  int getType() const { return m_type; }
114 
115  /*! \brief It returns the unit of measure of the values. */
116  const te::common::UnitOfMeasurePtr& getUnitOfMeasure() const { return m_unit; }
117 
118  /*!
119  \brief Sets the unit of measure of the values;
120 
121  \param u The new unit of measure.
122 
123  \note The object does not take the ownership of the unit.
124  */
126 
127  /* \brief Returns if the band is complex (true) or not (false). */
128  bool isComplex() const;
129 
130  public:
131 
132  std::size_t m_idx; //!< The band index.
133  int m_type; //!< The data type of the elements in the band ( See te::dt namespace basic data types for reference ).
134  std::string m_description; //!< A description.
135  std::vector<std::pair<std::string, std::string> > m_metadata; //!< A list of metadata where each element consists of a (key, value).
136  double m_noDataValue; //!< Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
137  std::complex<double> m_valuesOffset; //!< Offset is the values (real and imaginary) to add to grid values for this sample dimension, default is 0.
138  std::complex<double> m_valuesScale; //!< Scale is the values (real and imaginary) which is multiplied to grid values for this sample dimension, default is 1.
139  std::vector<std::string> m_categoryNames; //!< Set of categoric names for the values contained in a dimension.
140  ColorInterp m_colorInterp; //!< The color interpretation.
141  PaletteInterpretation m_paletteInterp; //!< Pallete interpretation.
142  std::vector<ColorEntry> m_palette; //!< The color palette.
143  int m_blkw; //!< Block width (pixels).
144  int m_blkh; //!< Block height (pixels).
145  int m_nblocksx; //!< The number of blocks in x.
146  int m_nblocksy; //!< The number of blocks in y.
147 
148  protected:
149 
150  te::common::UnitOfMeasurePtr m_unit; //!< The unit of values.
151  };
152 
153  typedef boost::shared_ptr<BandProperty> BandPropertyPtr;
154 
155  } // end namespace rst
156 } // end namespace te
157 
158 #endif // __TERRALIB_RASTER_INTERNAL_BANDPROPERTY_H
const te::common::UnitOfMeasurePtr & getUnitOfMeasure() const
It returns the unit of measure of the values.
Definition: BandProperty.h:116
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:62
std::size_t m_idx
The band index.
Definition: BandProperty.h:132
std::vector< ColorEntry > m_palette
The color palette.
Definition: BandProperty.h:142
std::vector< std::string > m_categoryNames
Set of categoric names for the values contained in a dimension.
Definition: BandProperty.h:139
ColorInterp
Color model component use.
Definition: Enums.h:54
A raster band description.
Definition: BandProperty.h:61
int m_nblocksx
The number of blocks in x.
Definition: BandProperty.h:145
int m_nblocksy
The number of blocks in y.
Definition: BandProperty.h:146
void setUnitOfMeasure(te::common::UnitOfMeasurePtr u)
Sets the unit of measure of the values;.
Definition: BandProperty.h:125
short c4
alpha or blackband.
Definition: BandProperty.h:75
int m_type
The data type of the elements in the band ( See te::dt namespace basic data types for reference )...
Definition: BandProperty.h:133
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
Definition: BandProperty.h:136
Enumerations for the Raster module.
std::vector< std::pair< std::string, std::string > > m_metadata
A list of metadata where each element consists of a (key, value).
Definition: BandProperty.h:135
URI C++ Library.
std::complex< double > m_valuesScale
Scale is the values (real and imaginary) which is multiplied to grid values for this sample dimension...
Definition: BandProperty.h:138
int m_blkw
Block width (pixels).
Definition: BandProperty.h:143
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
short c1
gray, red, cyan or hue.
Definition: BandProperty.h:72
short c3
blue, yellow, or saturation.
Definition: BandProperty.h:74
An structure to represent a color tuple.
Definition: BandProperty.h:70
std::complex< double > m_valuesOffset
Offset is the values (real and imaginary) to add to grid values for this sample dimension, default is 0.
Definition: BandProperty.h:137
int getType() const
It returns the data type of the elements in the band.
Definition: BandProperty.h:113
std::string m_description
A description.
Definition: BandProperty.h:134
te::common::UnitOfMeasurePtr m_unit
The unit of values.
Definition: BandProperty.h:150
Configuration flags for the Raster module of TerraLib.
int m_blkh
Block height (pixels).
Definition: BandProperty.h:144
PaletteInterpretation
Palette interpratation types.
Definition: Enums.h:80
ColorInterp m_colorInterp
The color interpretation.
Definition: BandProperty.h:140
short c2
green, magenta, or lightness.
Definition: BandProperty.h:73
PaletteInterpretation m_paletteInterp
Pallete interpretation.
Definition: BandProperty.h:141
boost::shared_ptr< BandProperty > BandPropertyPtr
Definition: BandProperty.h:153