26#ifndef __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H 
   27#define __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H 
   31#include "../color/RGBAColor.h" 
   32#include "../color/ColorBar.h" 
   45    class RasterSymbolizer;
 
   69        typedef void (
RasterTransform::*TransformFunction)(double, double, double, double);
 
   71        typedef void (
RasterTransform::*ChannelDomainGetFunction)(
unsigned int c, 
unsigned int r, 
double& value, std::size_t band);
 
   83          REAL_CHANNEL_DOMAIN=0, 
 
   84          IMAGINARY_CHANNEL_DOMAIN=1,  
 
  103          EXTRACT2RGB_TRANSF=2,
 
  105          GREEN2THREE_TRANSF=4,
 
  108          INTERPOLATE_TRANSF=7,
 
  255        void setTransfParameters(
double rmin, 
double rmax, 
double gain, 
double offset1, 
double offset2, 
int band);
 
  278        void setTransfFunction(RasterTransform::TransformFunction transfFuncPtr) { m_transfFuncPtr = transfFuncPtr; }
 
  281        void setRGBAFunction(RasterTransform::RGBAFunction transfFuncPtr) { m_RGBAFuncPtr = transfFuncPtr; }
 
  284        void apply(
double icol, 
double ilin, 
double ocol, 
double olin) {(this->*m_transfFuncPtr)(icol,ilin,ocol,olin); }
 
  295          const std::vector< double >& contrastOffsets1,
 
  296          const std::vector< double >& contrastOffsets2 );
 
  316        typedef void (
RasterTransform::*ContrastTransformFunction)(
const unsigned int&, 
const double&, 
double&) 
const;
 
  323              const int height, 
void* buffer, 
 
  326              m_dataType(bandDataType),
 
  333              if( domain == REAL_CHANNEL_DOMAIN )
 
  335                m_channelDomainGetFuncPtr = &BandBufferInfo::getRealValueChannelDomainGetFunction;
 
  337              else if( domain == IMAGINARY_CHANNEL_DOMAIN )
 
  339                m_channelDomainGetFuncPtr = &BandBufferInfo::getImaginaryValueChannelDomainGetFunction;
 
  341              else if( domain == SQRT_CHANNEL_DOMAIN )
 
  343                m_channelDomainGetFuncPtr = &BandBufferInfo::getSQRTChannelDomainGetFunction;
 
  352              const unsigned int r, 
double& value )
 const 
  354              (this->*(m_channelDomainGetFuncPtr))( c, r, value );
 
  359              unsigned char* buffer = 
static_cast<unsigned char*
>(m_buffer);
 
  366              const unsigned int c, 
const unsigned int r, 
double& value ) 
const;
 
  383              const unsigned int r, 
double& value)
 const 
  386              m_getBuff( c + ( r * m_width ), m_buffer, &value );
 
  390              const unsigned int r, 
double& value)
 const 
  393              m_getBuffI( c + ( r * m_width ), m_buffer, &value );
 
  397              const unsigned int r, 
double& value)
 const 
  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 ) ) ;
 
  421            m_rstMinValue(-std::numeric_limits<double>::max()),
 
  422            m_rstMaxValue(std::numeric_limits<double>::max()),
 
  425            m_contrastOffset1(0.0),
 
  426            m_contrastOffset2(0.0),
 
  427            m_noDataValue(std::numeric_limits<double>::max())
 
  494        void setRecode(
double icol, 
double ilin, 
double ocol, 
double olin);
 
  503        inline void applyLinearContrast(
const unsigned int& bandIdx, 
const double& inputValue, 
double& outputValue)
 const 
  505          assert( bandIdx < m_inputNBands );
 
  506          outputValue = ( ( inputValue + m_transformBandInfo[bandIdx]->m_contrastOffset1 ) *
 
  507            m_transformBandInfo[bandIdx]->m_contrastGain ) + m_transformBandInfo[bandIdx]->m_contrastOffset2;
 
  511        inline void applySquareContrast(
const unsigned int& bandIdx, 
const double& inputValue, 
double& outputValue)
 const 
  513          assert( bandIdx < m_inputNBands );
 
  514          outputValue = std::pow( inputValue, 2.0  ) * m_transformBandInfo[bandIdx]->m_contrastGain;
 
  520          assert( bandIdx < m_inputNBands );
 
  521          outputValue = std::sqrt( inputValue  ) *  m_transformBandInfo[bandIdx]->m_contrastGain;
 
  525        inline void applyLogContrast(
const unsigned int& bandIdx, 
const double& inputValue, 
double& outputValue)
 const 
  527          assert( bandIdx < m_inputNBands );
 
  528          outputValue = std::log10( inputValue + m_transformBandInfo[bandIdx]->m_contrastOffset1 + 1.0 ) *
 
  529            m_transformBandInfo[bandIdx]->m_contrastGain;
 
  533        inline void fixValue(
double& value, 
short& band)
 const 
  535          value = std::max(m_transformBandInfo[band]->m_rstMinValue, std::min(m_transformBandInfo[band]->m_rstMaxValue, value));
 
  545          return (m_transformBandInfo[band]->m_noDataValue == value);
 
  567          m_rasterIn->getValue(c, r, value, b );
 
  573          std::complex<double> cValue;
 
  574          m_rasterIn->getValue(c, r, cValue, b );
 
  575          value = cValue.imag();
 
  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() ) ) ;
 
#define TE_TR(message)
It marks a string in order to get translated.
 
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
 
An abstract class for raster data strucutures.
 
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
 
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
 
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...
 
Base exception class for plugin module.
 
Proxy configuration file for TerraView (see terraview_config.h).
 
An exception class for the XML module.