Loading...
Searching...
No Matches
GainOffsetProxyBand.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#ifndef __TERRALIB_RASTER_INTERNAL_GAINOFFSETPROXYBAND_H
21#define __TERRALIB_RASTER_INTERNAL_GAINOFFSETPROXYBAND_H
22
23// TerraLib
24#include "Band.h"
25#include "Config.h"
26#include "BlockUtils.h"
27
28namespace te
29{
30 namespace rst
31 {
33
34 /*!
35 \class GainOffsetProxyBand
36 \brief GainOffsetProxyRaster raster band.
37 \note OutputValue = ( InputValue * gain ) + offset
38 */
40 {
41 public:
42
43 /*!
44 \brief Default Constructor.
45
46 \param raster Related raster.
47 \param idx The band index.
48 */
50 GainOffsetProxyRaster& proxyRaster, std::size_t idx,
51 const double gain, const double offset, const double& noDataValue );
52
54
55 // mandatory overloads of pure virtual methods
56
57 inline te::rst::Raster* getRaster() const;
58 void getValue(unsigned int c, unsigned int r, double& value) const;
59 void setValue(unsigned int c, unsigned int r, const double value);
60 void getIValue(unsigned int c, unsigned int r, double& value) const;
61 void setIValue(unsigned int c, unsigned int r, const double value);
62 void read(int x, int y, void* buffer) const;
63 void* read(int x, int y);
64 void write(int x, int y, void* buffer);
65
66 protected :
67
68 te::rst::Raster* m_externalRasterPtr; //!< The original external raster instance.
69 te::rst::GainOffsetProxyRaster* m_proxyRasterPtr; //!< The proxy raster instance (parent raster).
70 Band* m_externalBandPtr; //!< Pointers the external bands.
71 double m_gain; //!< Gain to be applied to this band values.
72 double m_offset; //!< Offset to applied to this band values.
73 int m_blkPixelsNumber; //!< The blocks number of pixels;
74 double m_externalBandNoDataValue; //!< External band no-data value.
75 double m_newNoDataValue; //!< External value to be interpreted as No-data values.
76 void* m_internalBufferPtr; //!< A pointer to the internal data block buffer.
77
78 te::rst::GetBufferValueFPtr m_getBuff; //!< A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...).
79 te::rst::GetBufferValueFPtr m_getBuffI; //!< A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble).
80 te::rst::SetBufferValueFPtr m_setBuff; //!< A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...).
81 te::rst::SetBufferValueFPtr m_setBuffI; //!< A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble).
82
83 // variables used by setValue
84 mutable double m_setValue_auxValue;
85
86 // variables used by setIValue
87 mutable double m_setIValue_auxValue;
88
89 // variables used by read
90 mutable int m_read_blkIdx;
91 mutable double m_read_value;
92
93 // variables used by write
94 mutable int m_write_blkIdx;
95 mutable double m_write_value;
96
97 private:
98
100 };
101
102 } // end namespace rst
103} // end namespace te
104
105#endif // __TERRALIB_RASTER_INTERNAL_GAINOFFSETPROXYBAND_H
Utility functions for dealing with raster data blocks.
A raster band description.
Definition Band.h:64
Band(BandProperty *p, std::size_t idx)
Constructor.
void * m_internalBufferPtr
A pointer to the internal data block buffer.
te::rst::GainOffsetProxyRaster * m_proxyRasterPtr
The proxy raster instance (parent raster).
int m_blkPixelsNumber
The blocks number of pixels;.
te::rst::Raster * getRaster() const
Returns the associated raster.
double m_externalBandNoDataValue
External band no-data value.
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
GainOffsetProxyBand(const GainOffsetProxyBand &other)
double m_newNoDataValue
External value to be interpreted as No-data values.
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
te::rst::GetBufferValueFPtr m_getBuff
A pointer to a function that helps to extract a double or complex value from a specific buffer data t...
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer.
void getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
GainOffsetProxyBand(te::rst::Raster &raster, GainOffsetProxyRaster &proxyRaster, std::size_t idx, const double gain, const double offset, const double &noDataValue)
Default Constructor.
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
double m_gain
Gain to be applied to this band values.
te::rst::Raster * m_externalRasterPtr
The original external raster instance.
double m_offset
Offset to applied to this band values.
void * read(int x, int y)
It reads and returns a data block.
Band * m_externalBandPtr
Pointers the external bands.
te::rst::SetBufferValueFPtr m_setBuff
A pointer to a function that helps to insert a double or complex value into a specific buffer data ty...
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
A proxy class to dynamically apply gains/offsets to/from each input raster band.
An abstract class for raster data strucutures.
Definition Raster.h:72
Namespace for the Raster module of TerraLib.
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
Definition BlockUtils.h:40
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
Definition BlockUtils.h:37
TerraLib.
It gives access to values in one band (dimension) of a raster.
Configuration flags for the Raster module of TerraLib.
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:63