Loading...
Searching...
No Matches
RasterTransform.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 RasterTransform.h
22
23 \brief A Raster Transform is a class that defines functions to transform a styled raster.
24*/
25
26#ifndef __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H
27#define __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H
28
29// TerraLib
30#include "Config.h"
31#include "../color/RGBAColor.h"
32#include "../color/ColorBar.h"
33#include "../raster.h"
34#include "Exception.h"
35
36// STL
37#include <map>
38#include <cmath>
39
40namespace te
41{
42// Forward declarations
43 namespace se
44 {
45 class RasterSymbolizer;
46 }
47
48 namespace rst
49 {
50 class Raster;
51 class RasterProperty;
52 }
53
54 namespace map
55 {
56// Forward declarations
57
58 /*!
59 \class RasterTransform
60
61 \brief A Raster Transform is a class that defines functions to transform a styled raster.
62
63 \sa
64 */
66 {
67 public:
68
69 typedef void (RasterTransform::*TransformFunction)(double, double, double, double);
70 typedef te::color::RGBAColor (RasterTransform::*RGBAFunction)(double, double);
71 typedef void (RasterTransform::*ChannelDomainGetFunction)(unsigned int c, unsigned int r, double& value, std::size_t band);
72
73 typedef std::pair<double, double> RasterThreshold;
74
75 typedef std::map<RasterThreshold, te::color::RGBAColor> CategorizedMap;
76 typedef std::map<RasterThreshold, te::color::ColorBar> InterpolatedMap;
77 typedef std::map<int, te::color::RGBAColor> RecodedMap;
78
79 //! The channel domain (real, imaginary, i.e.) to use as source
80 /*! \enum The channel domain (real or imaginary) to use as source. */
82 {
83 REAL_CHANNEL_DOMAIN=0, /**< Use real numbers domain */
84 IMAGINARY_CHANNEL_DOMAIN=1, /**< Use imaginary numbers domain */
85 SQRT_CHANNEL_DOMAIN=2 /**< Use the square root of the sum of squared real and imaginary values */
86 };
87
88 //! The channels of a display
90 {
91 RED_CHANNEL=0,
92 GREEN_CHANNEL=1,
93 BLUE_CHANNEL=2,
94 ALPHA_CHANNEL=3,
95 MONO_CHANNEL=4
96 };
97
98 // The raster transform functions type
100 {
101 NO_TRANSF=0,
102 MONO2THREE_TRANSF=1,
103 EXTRACT2RGB_TRANSF=2,
104 RED2THREE_TRANSF=3,
105 GREEN2THREE_TRANSF=4,
106 BLUE2THREE_TRANSF=5,
107 CATEGORIZE_TRANSF=6,
108 INTERPOLATE_TRANSF=7,
109 RECODE_TRANSF = 8,
110 BAND2BAND_TRANSF=9,
112 CONTRAST_TRANSF /*!< Apply a contrast method ( ContrastType ) to the given raster - Use the methods getGain, setOffset and setOffset2 to setup contrast parameters. */
113 };
114
115 /*! \enum Allowed contrast types. */
117 {
118 LINEAR_CONTRAST, /*!< The histogram range will be changed to the supplied min/max range ( linear function ). */
119 SQUARE_CONTRAST, /*!< The contrasted image will be created by using a square function. */
120 SQUARE_ROOT_CONTRAST, /*!< The contrasted image will be created by using a square root function. */
121 LOG_CONTRAST /*!< The contrasted image will be created by using a log function. */
122 };
123
124 /*!
125 \brief Constructor
126
127 \param input
128 \param output
129
130 \note
131 */
133
134 /*! \brief Destructor. */
136
137 /*! \brief Gets the input raster. */
138 te::rst::Raster* getInputRaster() { return m_rasterIn; }
139
140 /*! \brief Gets the output raster. */
141 te::rst::Raster* getOutputRaster() { return m_rasterOut; }
142
143 /*! \brief Sets the transparency. */
144 void setTransparency(double value) { m_transp = value; }
145
146 /*! \brief Gets the transparency. */
147 double getTransparency() { return m_transp; }
148
149 /*! \brief Sets the gain. */
150 void setGain(double value, int band);
151
152 /*! \brief Gets the gain. */
153 std::vector< double > getGain() const;
154
155 /*! \brief Sets the offset 1. */
156 void setOffset(double value, int band);
157
158 /*! \brief Gets the offset. */
159 std::vector< double > getOffset();
160
161 /*!
162 \brief Set the current contrast type.
163 \param newType New contrast type.
164 */
165 void setContrastType( const ContrastType& newType );
166
167 /*! \brief Sets the constrast value for red band. */
168 void setGammaR(double value);
169
170 /*! \brief Gets the constrast value for red band. */
171 double getGammaR();
172
173 /*! \brief Sets the constrast value for green band. */
174 void setGammaG(double value);
175
176 /*! \brief Gets the constrast value for green band. */
177 double getGammaG();
178
179 /*! \brief Sets the constrast value for blue band. */
180 void setGammaB(double value);
181
182 /*! \brief Gets the constrast value for blue band. */
183 double getGammaB();
184
185 /*! \brief Sets the constrast value for gray band. */
186 void setGammaM(double value);
187
188 /*! \brief Gets the constrast value for gray band. */
189 double getGammaM();
190
191 /*! \brief Sets the rgb map values. */
192 void setRGBMap(std::map<RGBChannels, short>& rgbMap);
193
194 /*! Sets the mapping from a particular input band to a particular output channel */
195 void setBChannelMapping(short bIn, RGBChannels bOut);
196
198
199 /*! Clears current mapping from bands to channel */
201
202 /*! Returns the mapping from a particular input band to a particular output channel */
203 std::map<RGBChannels, short> getRGBMap();
204
205 /*! Sets the categorize map information */
206 void setCategorizedMap(CategorizedMap map) { m_categorizeMap = map; }
207
208 /*! Gets the categorize map information */
209 CategorizedMap& getCategorizedMap() { return m_categorizeMap; }
210
211 /*! Sets the interpolate map information */
212 void setInterpolatedMap(InterpolatedMap map) { m_interpolateMap = map; }
213
214 /*! Gets the categorize map information */
215 InterpolatedMap& getInterpolatedMap() { return m_interpolateMap; }
216
217 /*! Sets the recode map information */
218 void setRecodedMap(RecodedMap map) { m_recodeMap = map; }
219
220 /*! Gets the recode map information */
221 RecodedMap& getRecodedMap() { return m_recodeMap; }
222
223 /*!
224 \brief Set parameters of linear transformation
225
226 \param vmin smallest input value
227 \param vmax largest input value
228 \param rmin smallest value of the output range
229 \param rmax largest value of the output range
230
231 */
232 void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax);
233
234 /*!
235 \brief Set parameters of linear transformation for each band
236
237 \param vmin smallest input value
238 \param vmax largest input value
239 \param rmin smallest value of the output range
240 \param rmax largest value of the output range
241 \param band band id
242 */
243 void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax, int band);
244
245 /*!
246 \brief Set parameters of a non linear transformation for each band
247
248 \param rmin smallest value of the output range
249 \param rmax largest value of the output range
250 \param gain value used as gain
251 \param offset1 value used as offset
252 \param offset2 value used as offset2
253 \param band band id
254 */
255 void setTransfParameters(double rmin, double rmax, double gain, double offset1, double offset2, int band);
256
257 /*!
258 \brief Set the input/output window that will be transformed. This method enables cache strategy.
259
260 \param inputX0 Start point (upper left X) from input image
261 \param inputY0 Start point (upper left Y) from input image
262 \param inputWidth Width of input image that will be transformed
263 \param inputHeight Height of input image that will be transformed
264 \param outWidth Width of output image that will receive the transformed input image (canvas size)
265 \param outHeight Height of output image that will receive the transformed input image (canvas size)
266
267 \NOTE: This method was defined to increase draw speed.
268 */
269 void setInputRasterResampleSize(int inputX0, int inputY0, int inputWidth, int inputHeight, int outWidth, int outHeight);
270
271 /*! Returns the identifier of the transformation function currently set */
273
274 /*! Sets the associated transformation function from an identifier */
276
277 /*! Sets the transformation method to be used */
278 void setTransfFunction(RasterTransform::TransformFunction transfFuncPtr) { m_transfFuncPtr = transfFuncPtr; }
279
280 /*! Sets the transformation method to be used */
281 void setRGBAFunction(RasterTransform::RGBAFunction transfFuncPtr) { m_RGBAFuncPtr = transfFuncPtr; }
282
283 /*! Applies the selected transformation method */
284 void apply(double icol, double ilin, double ocol, double olin) {(this->*m_transfFuncPtr)(icol,ilin,ocol,olin); }
285
286 te::color::RGBAColor apply(double icol, double ilin){return (this->*m_RGBAFuncPtr)(icol,ilin); }
287
288 /*!
289 \brief Set gain and offset parameters to be used by the CONTRAST_TRANSF method.
290 \param contrastGains A vector of gains for each raster band.
291 \param contrastOffsets1 A vector of offsets1 for each raster band.
292 \param contrastOffsets2 A vector of offsets2 for each raster band.
293 */
294 void setContrastGainsAndOffsets( const std::vector< double >& contrastGains,
295 const std::vector< double >& contrastOffsets1,
296 const std::vector< double >& contrastOffsets2 );
297
298 /*!
299 \brief Set the used channels domain.
300 \param domain The new domain.
301 */
302 void setChannelDomain( const ChannelDomain domain );
303
304 /*!
305 \brief Return the used channels domain.
306 \return Return the used channels domain.
307 */
309
310 protected:
311
312 /*!
313 \brief Type definition for the internal contrast transform function.
314 \note void ContrastTransformFunction( bandNumber, inputValue, outputValue )
315 */
316 typedef void (RasterTransform::*ContrastTransformFunction)(const unsigned int&, const double&, double&) const;
317
319 {
320 public :
321
322 BandBufferInfo( const int bandDataType, const int width,
323 const int height, void* buffer,
324 const RasterTransform::ChannelDomain domain )
325 :
326 m_dataType(bandDataType),
327 m_width(width),
328 m_height(height),
329 m_buffer(buffer)
330 {
331 te::rst::SetBlockFunctions(&m_getBuff, &m_getBuffI, &m_setBuff, &m_setBuffI, m_dataType);
332
333 if( domain == REAL_CHANNEL_DOMAIN )
334 {
335 m_channelDomainGetFuncPtr = &BandBufferInfo::getRealValueChannelDomainGetFunction;
336 }
337 else if( domain == IMAGINARY_CHANNEL_DOMAIN )
338 {
339 m_channelDomainGetFuncPtr = &BandBufferInfo::getImaginaryValueChannelDomainGetFunction;
340 }
341 else if( domain == SQRT_CHANNEL_DOMAIN )
342 {
343 m_channelDomainGetFuncPtr = &BandBufferInfo::getSQRTChannelDomainGetFunction;
344 }
345 else
346 {
347 throw Exception(TE_TR("Invalid channel domain"));
348 }
349 }
350
351 void getValue(const unsigned int c,
352 const unsigned int r, double& value ) const
353 {
354 (this->*(m_channelDomainGetFuncPtr))( c, r, value );
355 }
356
358 {
359 unsigned char* buffer = static_cast<unsigned char*>(m_buffer);
360 delete[] buffer;
361 }
362
363 protected :
364
365 typedef void (BandBufferInfo::*ChannelDomainGetFunction)(
366 const unsigned int c, const unsigned int r, double& value ) const;
367
371 void* m_buffer;
372 mutable double m_auxRealValue;
373 mutable double m_auxImagValue;
374
375 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, ...).
376 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).
377 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, ...).
378 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).
379 BandBufferInfo::ChannelDomainGetFunction m_channelDomainGetFuncPtr; //!< Function used to get raster data from the selected domain (real/imaginary).
380
381
382 void getRealValueChannelDomainGetFunction( const unsigned int c,
383 const unsigned int r, double& value) const
384 {
385 assert(m_buffer);
386 m_getBuff( c + ( r * m_width ), m_buffer, &value );
387 }
388
390 const unsigned int r, double& value) const
391 {
392 assert(m_buffer);
393 m_getBuffI( c + ( r * m_width ), m_buffer, &value );
394 }
395
396 void getSQRTChannelDomainGetFunction(const unsigned int c,
397 const unsigned int r, double& value) const
398 {
399 assert(m_buffer);
400 m_getBuff( c + ( r * m_width ), m_buffer, &m_auxRealValue );
401 m_getBuffI( c + ( r * m_width ), m_buffer, &m_auxImagValue );
402 value = std::sqrt( ( m_auxRealValue * m_auxRealValue )
403 + ( m_auxImagValue * m_auxImagValue ) ) ;
404 }
405 };
406
408 {
409 double m_rstMinValue; //!< Min value from input raster.
410 double m_rstMaxValue; //!< Max value from input raster.
411
412 double m_gamma; //!< Gamma gain for this band.
413
414 double m_contrastGain; //!< Gains for this band used by the CONTRAST method.
415 double m_contrastOffset1; //!< Offsets1 for this band used by the CONTRAST method.
416 double m_contrastOffset2; //!< Offsets2 for this band used by the CONTRAST method.
417
418 double m_noDataValue; //!< No data value for this band from input raster.
419
421 m_rstMinValue(-std::numeric_limits<double>::max()),
422 m_rstMaxValue(std::numeric_limits<double>::max()),
423 m_gamma(1.0),
424 m_contrastGain(1.0),
425 m_contrastOffset1(0.0),
426 m_contrastOffset2(0.0),
427 m_noDataValue(std::numeric_limits<double>::max())
428 {
429
430 }
431
433 {
434
435 }
436
437 };
438
439 /*!
440 \brief Configures the contrast function pointer.
441 \param contrastType Contrast type..
442 */
444
445 /*! This transformation repeats the value of the first band in input three bands of the output */
446 void setMono2ThreeBand(double icol, double ilin, double ocol, double olin);
447
448 /*! This transformation repeats the value of the first band in input three bands of the output */
449 te::color::RGBAColor getMono2ThreeBand(double icol, double ilin);
450
451 /*! This transformation is used to define a particular mapping from input bands to RGB channels */
452 void setExtractRGB(double icol, double ilin, double ocol, double olin);
453
454 /*! This transformation is used to define a particular mapping from input bands to RGB channels */
455 te::color::RGBAColor getExtractRGB(double icol, double ilin);
456
457 /*! This transformation is used to define a particular mapping from input bands to RGBA channels */
458 void setExtractRGBA(double icol, double ilin, double ocol, double olin);
459
460 /*! This transformation is used to define a particular mapping from input bands to RGBA channels */
461 te::color::RGBAColor getExtractRGBA(double icol, double ilin);
462
463 /*! This transformation repeats the value of the first band in input three bands of the output */
464 void setRed2ThreeBand(double icol, double ilin, double ocol, double olin);
465
466 /*! This transformation repeats the value of the first band in input three bands of the output */
467 te::color::RGBAColor getRed2ThreeBand(double icol, double ilin);
468
469 /*! This transformation repeats the value of the first band in input three bands of the output */
470 void setGreen2ThreeBand(double icol, double ilin, double ocol, double olin);
471
472 /*! This transformation repeats the value of the first band in input three bands of the output */
473 te::color::RGBAColor getGreen2ThreeBand(double icol, double ilin);
474
475 /*! This transformation repeats the value of the first band in input three bands of the output */
476 void setBlue2ThreeBand(double icol, double ilin, double ocol, double olin);
477
478 /*! This transformation repeats the value of the first band in input three bands of the output */
479 te::color::RGBAColor getBlue2ThreeBand(double icol, double ilin);
480
481 /*! This transformation get the value of the selected band in input and set the categorized value in output bands of the output */
482 void setCategorize(double icol, double ilin, double ocol, double olin);
483
484 /*! This transformation get the value of the selected band in input and get the categorized value */
485 te::color::RGBAColor getCategorize(double icol, double ilin);
486
487 /*! This transformation get the value of the selected band in input and set the interpolated value in output bands of the output */
488 void setInterpolate(double icol, double ilin, double ocol, double olin);
489
490 /*! This transformation get the value of the selected band in input and get the interpolated value */
491 te::color::RGBAColor getInterpolate(double icol, double ilin);
492
493 /*! This transformation get the value of the selected band in input and set the recoded value in output bands of the output */
494 void setRecode(double icol, double ilin, double ocol, double olin);
495
496 /*! This transformation get the value of the selected band in input and get the recoded value */
497 te::color::RGBAColor getRecode(double icol, double ilin);
498
499 /*! This transformation repeats the value of the n band in input to b band in output */
500 void setBand2Band(double icol, double ilin, double ocol, double olin);
501
502 /*! This transformation aplies a linear contrast */
503 inline void applyLinearContrast(const unsigned int& bandIdx, const double& inputValue, double& outputValue) const
504 {
505 assert( bandIdx < m_inputNBands );
506 outputValue = ( ( inputValue + m_transformBandInfo[bandIdx]->m_contrastOffset1 ) *
507 m_transformBandInfo[bandIdx]->m_contrastGain ) + m_transformBandInfo[bandIdx]->m_contrastOffset2;
508 }
509
510 /*! This transformation aplies a square contrast */
511 inline void applySquareContrast(const unsigned int& bandIdx, const double& inputValue, double& outputValue) const
512 {
513 assert( bandIdx < m_inputNBands );
514 outputValue = std::pow( inputValue, 2.0 ) * m_transformBandInfo[bandIdx]->m_contrastGain;
515 }
516
517 /*! This transformation aplies a square root contrast */
518 inline void applySquareRootContrast(const unsigned int& bandIdx, const double& inputValue, double& outputValue) const
519 {
520 assert( bandIdx < m_inputNBands );
521 outputValue = std::sqrt( inputValue ) * m_transformBandInfo[bandIdx]->m_contrastGain;
522 }
523
524 /*! This transformation aplies a log contrast */
525 inline void applyLogContrast(const unsigned int& bandIdx, const double& inputValue, double& outputValue) const
526 {
527 assert( bandIdx < m_inputNBands );
528 outputValue = std::log10( inputValue + m_transformBandInfo[bandIdx]->m_contrastOffset1 + 1.0 ) *
529 m_transformBandInfo[bandIdx]->m_contrastGain;
530 }
531
532 /*! Function used to adjust the value in raster range */
533 inline void fixValue(double& value, short& band) const
534 {
535 value = std::max(m_transformBandInfo[band]->m_rstMinValue, std::min(m_transformBandInfo[band]->m_rstMaxValue, value));
536 }
537
538 /*!
539 \brief Function used to check if value is or not a valid value
540
541 \return True if the value is EQUAL to NoValue and false in other case.
542 */
543 inline bool checkNoValue(double& value, int band) const
544 {
545 return (m_transformBandInfo[band]->m_noDataValue == value);
546 }
547
548 /*!
549 \brief Function used to check the alpha value
550
551 \return Return the alpha value.
552 */
553 double checkAlphaValue(double icol, double ilin);
554
555 /*! Function used to get the interpolated color given a pixel value */
557
558 /*! Function used to get the categorized color given a pixel value */
560
561 /*! Function used to get the recoded color given a pixel value */
563
564 void getRealValueChannelDomainGetFunction(unsigned int c, unsigned int r, double& value, std::size_t b)
565 {
566 assert(m_rasterIn);
567 m_rasterIn->getValue(c, r, value, b );
568 }
569
570 void getImaginaryValueChannelDomainGetFunction(unsigned int c, unsigned int r, double& value, std::size_t b)
571 {
572 assert(m_rasterIn);
573 std::complex<double> cValue;
574 m_rasterIn->getValue(c, r, cValue, b );
575 value = cValue.imag();
576 }
577
578 void getSQRTChannelDomainGetFunction(unsigned int c, unsigned int r, double& value, std::size_t b)
579 {
580 assert(m_rasterIn);
581 std::complex<double> cValue;
582 m_rasterIn->getValue(c, r, cValue, b );
583 value = std::sqrt( ( cValue.real() * cValue.real() )
584 + ( cValue.imag() * cValue.imag() ) ) ;
585 }
586 private:
587
588 te::rst::Raster* m_rasterIn; //!< Pointer to a input raster.
589 te::rst::Raster* m_rasterOut; //!< Pointer to a output raster.
590
591 std::size_t m_inputNBands; //!< Number of bands from input raster.
592
593 short m_monoBand; //!< Value for the gray band.
594 short m_redBand; //!< Value for the red band.
595 short m_greenBand; //!< Value for the green band.
596 short m_blueBand; //!< Value for the blue band.
597 short m_alphaBand; //!< Value for the alpha band.
598
599 double m_transp; //!< Global transparency value for transformation.
600
601 ContrastType m_currentContrastType; //!< Current contrast type.
602 ChannelDomain m_currentChannelDomain; //!< Current channel domain.
603 ChannelDomainGetFunction m_channelDomainGetFuncPtr; //!< Function used to get raster data from the selected domain (real/imaginary).
604 ContrastTransformFunction m_contrastTransfFuncPtr; //!< Function used in contrast transformation operation.
605
606 TransformFunction m_transfFuncPtr; //!< Function used in transformation operation.
607 RGBAFunction m_RGBAFuncPtr; //!< Function used in transformation operation.
608
609 CategorizedMap m_categorizeMap; //!< Attribute to define the categorized transformation.
610 InterpolatedMap m_interpolateMap; //!< Attribute to define the interpolated transformation.
611 RecodedMap m_recodeMap; //!< Attribute to define the recoded transformation.
612
613 bool m_useBufferCache; //!< Flag used to indicate if a buffer from input image will be used.
614 BandBufferInfo** m_arrayBuffer; //!< Array of band buffer info from input data.
615
616 TransformBandInfo** m_transformBandInfo; //!< Array of band transformation information.
617 };
618
619 } // end namespace map
620} // end namespace te
621
622#endif // __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:264
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:58
BandBufferInfo(const int bandDataType, const int width, const int height, void *buffer, const RasterTransform::ChannelDomain domain)
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...
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 getValue(const unsigned int c, const unsigned int r, double &value) const
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
void getImaginaryValueChannelDomainGetFunction(const unsigned int c, const unsigned int r, double &value) const
void getSQRTChannelDomainGetFunction(const unsigned int c, const unsigned int r, double &value) const
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
BandBufferInfo::ChannelDomainGetFunction m_channelDomainGetFuncPtr
Function used to get raster data from the selected domain (real/imaginary).
void getRealValueChannelDomainGetFunction(const unsigned int c, const unsigned int r, double &value) const
A Raster Transform is a class that defines functions to transform a styled raster.
BandBufferInfo ** m_arrayBuffer
Array of band buffer info from input data.
void setExtractRGBA(double icol, double ilin, double ocol, double olin)
double getGammaR()
Gets the constrast value for red band.
te::rst::Raster * getOutputRaster()
Gets the output raster.
ChannelDomain m_currentChannelDomain
Current channel domain.
void apply(double icol, double ilin, double ocol, double olin)
CategorizedMap m_categorizeMap
Attribute to define the categorized transformation.
InterpolatedMap m_interpolateMap
Attribute to define the interpolated transformation.
double getGammaG()
Gets the constrast value for green band.
RGBChannels
The channels of a display.
void setOffset(double value, int band)
Sets the offset 1.
void setGain(double value, int band)
Sets the gain.
void setInterpolate(double icol, double ilin, double ocol, double olin)
ContrastType m_currentContrastType
Current contrast type.
short m_greenBand
Value for the green band.
std::map< RGBChannels, short > getRGBMap()
te::color::RGBAColor getCategorizedColor(double value)
te::color::RGBAColor getRecode(double icol, double ilin)
te::rst::Raster * getInputRaster()
Gets the input raster.
RasterTransform(te::rst::Raster *input, te::rst::Raster *output)
Constructor.
void setRecode(double icol, double ilin, double ocol, double olin)
RasterTransfFunctions getTransfFunction()
void setExtractRGB(double icol, double ilin, double ocol, double olin)
bool checkNoValue(double &value, int band) const
Function used to check if value is or not a valid value.
double m_transp
Global transparency value for transformation.
void setContrastType(const ContrastType &newType)
Set the current contrast type.
void setTransfFunction(RasterTransfFunctions func)
double getTransparency()
Gets the transparency.
void setInterpolatedMap(InterpolatedMap map)
void setInputRasterResampleSize(int inputX0, int inputY0, int inputWidth, int inputHeight, int outWidth, int outHeight)
Set the input/output window that will be transformed. This method enables cache strategy.
short m_alphaBand
Value for the alpha band.
te::rst::Raster * m_rasterOut
Pointer to a output raster.
short m_blueBand
Value for the blue band.
void setContrastGainsAndOffsets(const std::vector< double > &contrastGains, const std::vector< double > &contrastOffsets1, const std::vector< double > &contrastOffsets2)
Set gain and offset parameters to be used by the CONTRAST_TRANSF method.
void setBChannelMapping(short bIn, RGBChannels bOut)
te::color::RGBAColor getExtractRGBA(double icol, double ilin)
te::color::RGBAColor getRecodedColor(double value)
void setGammaR(double value)
Sets the constrast value for red band.
ChannelDomainGetFunction m_channelDomainGetFuncPtr
Function used to get raster data from the selected domain (real/imaginary).
void setCategorize(double icol, double ilin, double ocol, double olin)
RecodedMap & getRecodedMap()
void getImaginaryValueChannelDomainGetFunction(unsigned int c, unsigned int r, double &value, std::size_t b)
short getBChannelMapping(RGBChannels channel)
~RasterTransform()
Destructor.
void fixValue(double &value, short &band) const
short m_redBand
Value for the red band.
ChannelDomain getChannelDomain() const
Return the used channels domain.
void applySquareRootContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
te::color::RGBAColor getGreen2ThreeBand(double icol, double ilin)
std::map< RasterThreshold, te::color::ColorBar > InterpolatedMap
bool m_useBufferCache
Flag used to indicate if a buffer from input image will be used.
void setCategorizedMap(CategorizedMap map)
void setRecodedMap(RecodedMap map)
void setChannelDomain(const ChannelDomain domain)
Set the used channels domain.
void applyLinearContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
te::color::RGBAColor getCategorize(double icol, double ilin)
void setGreen2ThreeBand(double icol, double ilin, double ocol, double olin)
RGBAFunction m_RGBAFuncPtr
Function used in transformation operation.
short m_monoBand
Value for the gray band.
void setRed2ThreeBand(double icol, double ilin, double ocol, double olin)
te::color::RGBAColor getInterpolatedColor(double value)
std::map< int, te::color::RGBAColor > RecodedMap
void setRGBMap(std::map< RGBChannels, short > &rgbMap)
Sets the rgb map values.
ContrastTransformFunction m_contrastTransfFuncPtr
Function used in contrast transformation operation.
te::color::RGBAColor getRed2ThreeBand(double icol, double ilin)
RecodedMap m_recodeMap
Attribute to define the recoded transformation.
void setContrastFuncPtr(const RasterTransform::ContrastType contrastType)
Configures the contrast function pointer.
void setBand2Band(double icol, double ilin, double ocol, double olin)
TransformFunction m_transfFuncPtr
Function used in transformation operation.
CategorizedMap & getCategorizedMap()
std::size_t m_inputNBands
Number of bands from input raster.
te::color::RGBAColor getInterpolate(double icol, double ilin)
void setRGBAFunction(RasterTransform::RGBAFunction transfFuncPtr)
void setMono2ThreeBand(double icol, double ilin, double ocol, double olin)
double getGammaB()
Gets the constrast value for blue band.
void setTransfParameters(double rmin, double rmax, double gain, double offset1, double offset2, int band)
Set parameters of a non linear transformation for each band.
void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax, int band)
Set parameters of linear transformation for each band.
void setGammaB(double value)
Sets the constrast value for blue band.
std::vector< double > getGain() const
Gets the gain.
te::color::RGBAColor getMono2ThreeBand(double icol, double ilin)
void setTransfFunction(RasterTransform::TransformFunction transfFuncPtr)
void getSQRTChannelDomainGetFunction(unsigned int c, unsigned int r, double &value, std::size_t b)
void getRealValueChannelDomainGetFunction(unsigned int c, unsigned int r, double &value, std::size_t b)
void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax)
Set parameters of linear transformation.
double getGammaM()
Gets the constrast value for gray band.
void setGammaM(double value)
Sets the constrast value for gray band.
std::map< RasterThreshold, te::color::RGBAColor > CategorizedMap
std::vector< double > getOffset()
Gets the offset.
void setTransparency(double value)
Sets the transparency.
te::color::RGBAColor getExtractRGB(double icol, double ilin)
void setGammaG(double value)
Sets the constrast value for green band.
std::pair< double, double > RasterThreshold
te::color::RGBAColor getBlue2ThreeBand(double icol, double ilin)
void setBlue2ThreeBand(double icol, double ilin, double ocol, double olin)
te::rst::Raster * m_rasterIn
Pointer to a input raster.
void applySquareContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
te::color::RGBAColor apply(double icol, double ilin)
TransformBandInfo ** m_transformBandInfo
Array of band transformation information.
double checkAlphaValue(double icol, double ilin)
Function used to check the alpha value.
void applyLogContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
InterpolatedMap & getInterpolatedMap()
An abstract class for raster data strucutures.
Definition: Raster.h:72
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
TERASTEREXPORT void SetBlockFunctions(GetBufferValueFPtr *gb, GetBufferValueFPtr *gbi, SetBufferValueFPtr *sb, SetBufferValueFPtr *sbi, int type)
Sets the pointers to functions that helps to extract a double or complex value from a specific buffer...
TerraLib.
Base exception class for plugin module.
Definition: Exception.h:42
double m_rstMaxValue
Max value from input raster.
double m_contrastOffset2
Offsets2 for this band used by the CONTRAST method.
double m_contrastOffset1
Offsets1 for this band used by the CONTRAST method.
double m_contrastGain
Gains for this band used by the CONTRAST method.
double m_noDataValue
No data value for this band from input raster.
double m_gamma
Gamma gain for this band.
double m_rstMinValue
Min value from input raster.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
Proxy configuration file for TerraView (see terraview_config.h).
An exception class for the XML module.