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 
40 namespace 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 */
200  void clearRGBMap();
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 
369  int m_width;
370  int m_height;
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 
389  void getImaginaryValueChannelDomainGetFunction(const unsigned int c,
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
te::map::RasterTransform::setCategorize
void setCategorize(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::getTransparency
double getTransparency()
Gets the transparency.
Definition: RasterTransform.h:147
te::map::RasterTransform::setExtractRGBA
void setExtractRGBA(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::m_categorizeMap
CategorizedMap m_categorizeMap
Attribute to define the categorized transformation.
Definition: RasterTransform.h:609
te::map::RasterTransform::applyLinearContrast
void applyLinearContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
Definition: RasterTransform.h:503
te::map::RasterTransform::getImaginaryValueChannelDomainGetFunction
void getImaginaryValueChannelDomainGetFunction(unsigned int c, unsigned int r, double &value, std::size_t b)
Definition: RasterTransform.h:570
te::map::RasterTransform::m_rasterIn
te::rst::Raster * m_rasterIn
Pointer to a input raster.
Definition: RasterTransform.h:588
te::map::RasterTransform::applySquareRootContrast
void applySquareRootContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
Definition: RasterTransform.h:518
te::map::RasterTransform::BandBufferInfo::m_setBuff
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...
Definition: RasterTransform.h:377
te::map::RasterTransform::BandBufferInfo::m_dataType
int m_dataType
Definition: RasterTransform.h:368
te::map::RasterTransform::setRGBAFunction
void setRGBAFunction(RasterTransform::RGBAFunction transfFuncPtr)
Definition: RasterTransform.h:281
te::map::RasterTransform::setTransfFunction
void setTransfFunction(RasterTransfFunctions func)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::map::RasterTransform::setGammaM
void setGammaM(double value)
Sets the constrast value for gray band.
te::map::RasterTransform::ChannelDomain
ChannelDomain
Definition: RasterTransform.h:82
te::map::RasterTransform::setGreen2ThreeBand
void setGreen2ThreeBand(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::SQUARE_ROOT_CONTRAST
@ SQUARE_ROOT_CONTRAST
Definition: RasterTransform.h:120
te::map::RasterTransform::BandBufferInfo::BandBufferInfo
BandBufferInfo(const int bandDataType, const int width, const int height, void *buffer, const RasterTransform::ChannelDomain domain)
Definition: RasterTransform.h:322
te::map::RasterTransform::setRGBMap
void setRGBMap(std::map< RGBChannels, short > &rgbMap)
Sets the rgb map values.
te::rst::SetBufferValueFPtr
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:40
te::map::RasterTransform::setGammaB
void setGammaB(double value)
Sets the constrast value for blue band.
te::map::RasterTransform::setContrastGainsAndOffsets
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.
te::map::RasterTransform::getTransfFunction
RasterTransfFunctions getTransfFunction()
te::map::RasterTransform::TransformBandInfo::m_noDataValue
double m_noDataValue
No data value for this band from input raster.
Definition: RasterTransform.h:418
te::map::RasterTransform::RasterThreshold
std::pair< double, double > RasterThreshold
Definition: RasterTransform.h:73
te::map::RasterTransform
A Raster Transform is a class that defines functions to transform a styled raster.
Definition: RasterTransform.h:66
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::map::RasterTransform::checkNoValue
bool checkNoValue(double &value, int band) const
Function used to check if value is or not a valid value.
Definition: RasterTransform.h:543
te::map::RasterTransform::getRecodedMap
RecodedMap & getRecodedMap()
Definition: RasterTransform.h:221
te::map::RasterTransform::BandBufferInfo::getValue
void getValue(const unsigned int c, const unsigned int r, double &value) const
Definition: RasterTransform.h:351
te::map::RasterTransform::TransformFunction
void(RasterTransform::* TransformFunction)(double, double, double, double)
Definition: RasterTransform.h:69
te::map::RasterTransform::setRecode
void setRecode(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::setContrastFuncPtr
void setContrastFuncPtr(const RasterTransform::ContrastType contrastType)
Configures the contrast function pointer.
te::map::RasterTransform::setInterpolate
void setInterpolate(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::setChannelDomain
void setChannelDomain(const ChannelDomain domain)
Set the used channels domain.
te::map::RasterTransform::setRecodedMap
void setRecodedMap(RecodedMap map)
Definition: RasterTransform.h:218
te::map::RasterTransform::m_currentChannelDomain
ChannelDomain m_currentChannelDomain
Current channel domain.
Definition: RasterTransform.h:602
te::map::RasterTransform::setGammaG
void setGammaG(double value)
Sets the constrast value for green band.
te::map::RasterTransform::getRecode
te::color::RGBAColor getRecode(double icol, double ilin)
te::map::RasterTransform::applySquareContrast
void applySquareContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
Definition: RasterTransform.h:511
te::map::RasterTransform::TransformBandInfo::m_contrastOffset1
double m_contrastOffset1
Offsets1 for this band used by the CONTRAST method.
Definition: RasterTransform.h:415
te::map::RasterTransform::setMono2ThreeBand
void setMono2ThreeBand(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::BandBufferInfo
Definition: RasterTransform.h:319
te::map::RasterTransform::setTransparency
void setTransparency(double value)
Sets the transparency.
Definition: RasterTransform.h:144
te::map::RasterTransform::EXTRACT2RGBA_TRANSF
@ EXTRACT2RGBA_TRANSF
Definition: RasterTransform.h:111
te::map::RasterTransform::RGBAFunction
te::color::RGBAColor(RasterTransform::* RGBAFunction)(double, double)
Definition: RasterTransform.h:70
te::map::RasterTransform::getChannelDomain
ChannelDomain getChannelDomain() const
Return the used channels domain.
te::map::RasterTransform::setTransfFunction
void setTransfFunction(RasterTransform::TransformFunction transfFuncPtr)
Definition: RasterTransform.h:278
te::map::RasterTransform::TransformBandInfo
Definition: RasterTransform.h:408
te::map::RasterTransform::m_contrastTransfFuncPtr
ContrastTransformFunction m_contrastTransfFuncPtr
Function used in contrast transformation operation.
Definition: RasterTransform.h:604
te::map::RasterTransform::getInterpolatedMap
InterpolatedMap & getInterpolatedMap()
Definition: RasterTransform.h:215
te::map::RasterTransform::LINEAR_CONTRAST
@ LINEAR_CONTRAST
Definition: RasterTransform.h:118
te::map::RasterTransform::m_recodeMap
RecodedMap m_recodeMap
Attribute to define the recoded transformation.
Definition: RasterTransform.h:611
te::map::RasterTransform::BandBufferInfo::m_getBuffI
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
Definition: RasterTransform.h:376
te::map::RasterTransform::setTransfParameters
void setTransfParameters(double rmin, double rmax, double gain, double offset1, double offset2, int band)
Set parameters of a non linear transformation for each band.
te::map::RasterTransform::getMono2ThreeBand
te::color::RGBAColor getMono2ThreeBand(double icol, double ilin)
te::map::RasterTransform::TransformBandInfo::m_rstMinValue
double m_rstMinValue
Min value from input raster.
Definition: RasterTransform.h:409
te::map::RasterTransform::m_greenBand
short m_greenBand
Value for the green band.
Definition: RasterTransform.h:595
te::map::RasterTransform::setGain
void setGain(double value, int band)
Sets the gain.
te::map::RasterTransform::m_transfFuncPtr
TransformFunction m_transfFuncPtr
Function used in transformation operation.
Definition: RasterTransform.h:606
te::map::RasterTransform::getOutputRaster
te::rst::Raster * getOutputRaster()
Gets the output raster.
Definition: RasterTransform.h:141
te::map::RasterTransform::m_transformBandInfo
TransformBandInfo ** m_transformBandInfo
Array of band transformation information.
Definition: RasterTransform.h:616
te::map::RasterTransform::setLinearTransfParameters
void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax)
Set parameters of linear transformation.
te::map::RasterTransform::BandBufferInfo::m_height
int m_height
Definition: RasterTransform.h:370
te::map::RasterTransform::TransformBandInfo::m_contrastGain
double m_contrastGain
Gains for this band used by the CONTRAST method.
Definition: RasterTransform.h:414
te::map::RasterTransform::BandBufferInfo::m_setBuffI
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
Definition: RasterTransform.h:378
te::map::RasterTransform::getGreen2ThreeBand
te::color::RGBAColor getGreen2ThreeBand(double icol, double ilin)
te::map::RasterTransform::m_currentContrastType
ContrastType m_currentContrastType
Current contrast type.
Definition: RasterTransform.h:601
te::rst::SetBlockFunctions
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...
te::map::RasterTransform::getRGBMap
std::map< RGBChannels, short > getRGBMap()
te::map::RasterTransform::~RasterTransform
~RasterTransform()
Destructor.
te::map::RasterTransform::TransformBandInfo::TransformBandInfo
TransformBandInfo()
Definition: RasterTransform.h:420
te::map::RasterTransform::m_RGBAFuncPtr
RGBAFunction m_RGBAFuncPtr
Function used in transformation operation.
Definition: RasterTransform.h:607
te::map::RasterTransform::setInterpolatedMap
void setInterpolatedMap(InterpolatedMap map)
Definition: RasterTransform.h:212
te::map::RasterTransform::RGBChannels
RGBChannels
The channels of a display.
Definition: RasterTransform.h:90
te::map::RasterTransform::m_interpolateMap
InterpolatedMap m_interpolateMap
Attribute to define the interpolated transformation.
Definition: RasterTransform.h:610
te::map::RasterTransform::checkAlphaValue
double checkAlphaValue(double icol, double ilin)
Function used to check the alpha value.
Exception.h
An exception class for the XML module.
te::map::RasterTransform::setCategorizedMap
void setCategorizedMap(CategorizedMap map)
Definition: RasterTransform.h:206
te::map::RasterTransform::CategorizedMap
std::map< RasterThreshold, te::color::RGBAColor > CategorizedMap
Definition: RasterTransform.h:75
te::map::RasterTransform::RasterTransform
RasterTransform(te::rst::Raster *input, te::rst::Raster *output)
Constructor.
te::Exception
Base exception class for plugin module.
Definition: Exception.h:42
te::map::RasterTransform::clearRGBMap
void clearRGBMap()
te::map::RasterTransform::RasterTransfFunctions
RasterTransfFunctions
Definition: RasterTransform.h:100
te::map::RasterTransform::getSQRTChannelDomainGetFunction
void getSQRTChannelDomainGetFunction(unsigned int c, unsigned int r, double &value, std::size_t b)
Definition: RasterTransform.h:578
te::map::RasterTransform::setOffset
void setOffset(double value, int band)
Sets the offset 1.
te::map::RasterTransform::getRealValueChannelDomainGetFunction
void getRealValueChannelDomainGetFunction(unsigned int c, unsigned int r, double &value, std::size_t b)
Definition: RasterTransform.h:564
te::map::RasterTransform::BandBufferInfo::m_buffer
void * m_buffer
Definition: RasterTransform.h:371
te::map::RasterTransform::m_redBand
short m_redBand
Value for the red band.
Definition: RasterTransform.h:594
te::map::RasterTransform::getCategorizedColor
te::color::RGBAColor getCategorizedColor(double value)
te::map::RasterTransform::getBChannelMapping
short getBChannelMapping(RGBChannels channel)
te::map::RasterTransform::BandBufferInfo::m_channelDomainGetFuncPtr
BandBufferInfo::ChannelDomainGetFunction m_channelDomainGetFuncPtr
Function used to get raster data from the selected domain (real/imaginary).
Definition: RasterTransform.h:379
te::map::RasterTransform::BandBufferInfo::m_auxRealValue
double m_auxRealValue
Definition: RasterTransform.h:372
te::map::RasterTransform::TransformBandInfo::m_contrastOffset2
double m_contrastOffset2
Offsets2 for this band used by the CONTRAST method.
Definition: RasterTransform.h:416
te::map::RasterTransform::setBChannelMapping
void setBChannelMapping(short bIn, RGBChannels bOut)
te::map::RasterTransform::TransformBandInfo::m_gamma
double m_gamma
Gamma gain for this band.
Definition: RasterTransform.h:412
te::map::RasterTransform::m_arrayBuffer
BandBufferInfo ** m_arrayBuffer
Array of band buffer info from input data.
Definition: RasterTransform.h:614
te::map::RasterTransform::BandBufferInfo::m_getBuff
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...
Definition: RasterTransform.h:375
te::map::RasterTransform::getGammaB
double getGammaB()
Gets the constrast value for blue band.
te::map::RasterTransform::getBlue2ThreeBand
te::color::RGBAColor getBlue2ThreeBand(double icol, double ilin)
te::map::RasterTransform::fixValue
void fixValue(double &value, short &band) const
Definition: RasterTransform.h:533
te::map::RasterTransform::setRed2ThreeBand
void setRed2ThreeBand(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::BandBufferInfo::getRealValueChannelDomainGetFunction
void getRealValueChannelDomainGetFunction(const unsigned int c, const unsigned int r, double &value) const
Definition: RasterTransform.h:382
te::map::RasterTransform::InterpolatedMap
std::map< RasterThreshold, te::color::ColorBar > InterpolatedMap
Definition: RasterTransform.h:76
te::map::RasterTransform::ContrastType
ContrastType
Definition: RasterTransform.h:117
te::map::RasterTransform::getOffset
std::vector< double > getOffset()
Gets the offset.
te::map::RasterTransform::getInterpolate
te::color::RGBAColor getInterpolate(double icol, double ilin)
te::map::RasterTransform::m_alphaBand
short m_alphaBand
Value for the alpha band.
Definition: RasterTransform.h:597
te::map::RasterTransform::getGammaG
double getGammaG()
Gets the constrast value for green band.
te::map::RasterTransform::SQUARE_CONTRAST
@ SQUARE_CONTRAST
Definition: RasterTransform.h:119
te::map::RasterTransform::applyLogContrast
void applyLogContrast(const unsigned int &bandIdx, const double &inputValue, double &outputValue) const
Definition: RasterTransform.h:525
te::map::RasterTransform::TransformBandInfo::m_rstMaxValue
double m_rstMaxValue
Max value from input raster.
Definition: RasterTransform.h:410
te::map::RasterTransform::setGammaR
void setGammaR(double value)
Sets the constrast value for red band.
te::map::RasterTransform::BandBufferInfo::m_width
int m_width
Definition: RasterTransform.h:369
te::map::RasterTransform::getInputRaster
te::rst::Raster * getInputRaster()
Gets the input raster.
Definition: RasterTransform.h:138
te::map::RasterTransform::BandBufferInfo::getSQRTChannelDomainGetFunction
void getSQRTChannelDomainGetFunction(const unsigned int c, const unsigned int r, double &value) const
Definition: RasterTransform.h:396
te::color::RGBAColor
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:58
te::map::RasterTransform::getGammaR
double getGammaR()
Gets the constrast value for red band.
TEMAPEXPORT
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
te::map::RasterTransform::setBlue2ThreeBand
void setBlue2ThreeBand(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::RecodedMap
std::map< int, te::color::RGBAColor > RecodedMap
Definition: RasterTransform.h:77
te::map::RasterTransform::m_monoBand
short m_monoBand
Value for the gray band.
Definition: RasterTransform.h:593
te::map::RasterTransform::m_rasterOut
te::rst::Raster * m_rasterOut
Pointer to a output raster.
Definition: RasterTransform.h:589
te::map::RasterTransform::BandBufferInfo::~BandBufferInfo
~BandBufferInfo()
Definition: RasterTransform.h:357
te::map::RasterTransform::m_inputNBands
std::size_t m_inputNBands
Number of bands from input raster.
Definition: RasterTransform.h:591
te::map::RasterTransform::m_transp
double m_transp
Global transparency value for transformation.
Definition: RasterTransform.h:599
te::map::RasterTransform::getGammaM
double getGammaM()
Gets the constrast value for gray band.
te::map::RasterTransform::getRed2ThreeBand
te::color::RGBAColor getRed2ThreeBand(double icol, double ilin)
te::map::RasterTransform::BandBufferInfo::m_auxImagValue
double m_auxImagValue
Definition: RasterTransform.h:373
te::map::RasterTransform::setInputRasterResampleSize
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.
te::map::RasterTransform::BandBufferInfo::getImaginaryValueChannelDomainGetFunction
void getImaginaryValueChannelDomainGetFunction(const unsigned int c, const unsigned int r, double &value) const
Definition: RasterTransform.h:389
te::map::RasterTransform::m_useBufferCache
bool m_useBufferCache
Flag used to indicate if a buffer from input image will be used.
Definition: RasterTransform.h:613
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::map::RasterTransform::getCategorizedMap
CategorizedMap & getCategorizedMap()
Definition: RasterTransform.h:209
te::rst::GetBufferValueFPtr
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:37
te::map::RasterTransform::apply
void apply(double icol, double ilin, double ocol, double olin)
Definition: RasterTransform.h:284
te::map::RasterTransform::setExtractRGB
void setExtractRGB(double icol, double ilin, double ocol, double olin)
te::map::RasterTransform::m_blueBand
short m_blueBand
Value for the blue band.
Definition: RasterTransform.h:596
te::map::RasterTransform::setLinearTransfParameters
void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax, int band)
Set parameters of linear transformation for each band.
te::map::RasterTransform::setContrastType
void setContrastType(const ContrastType &newType)
Set the current contrast type.
te::map::RasterTransform::getGain
std::vector< double > getGain() const
Gets the gain.
te::map::RasterTransform::getExtractRGBA
te::color::RGBAColor getExtractRGBA(double icol, double ilin)
te::map::RasterTransform::TransformBandInfo::~TransformBandInfo
~TransformBandInfo()
Definition: RasterTransform.h:432
te::map::RasterTransform::apply
te::color::RGBAColor apply(double icol, double ilin)
Definition: RasterTransform.h:286
te::map::RasterTransform::getRecodedColor
te::color::RGBAColor getRecodedColor(double value)
TE_TR
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:264
te::map::RasterTransform::getExtractRGB
te::color::RGBAColor getExtractRGB(double icol, double ilin)
te::map::RasterTransform::getCategorize
te::color::RGBAColor getCategorize(double icol, double ilin)
te::map::RasterTransform::m_channelDomainGetFuncPtr
ChannelDomainGetFunction m_channelDomainGetFuncPtr
Function used to get raster data from the selected domain (real/imaginary).
Definition: RasterTransform.h:603
te::map::RasterTransform::getInterpolatedColor
te::color::RGBAColor getInterpolatedColor(double value)
te::map::RasterTransform::setBand2Band
void setBand2Band(double icol, double ilin, double ocol, double olin)