26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H 27 #define __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H 31 #include "../color/RGBAColor.h" 32 #include "../color/ColorBar.h" 33 #include "../raster.h" 44 class RasterSymbolizer;
68 typedef void (
RasterTransform::*TransformFunction)(double, double, double, double);
92 m_dataType(bandDataType),
102 unsigned char* buffer =
static_cast<unsigned char*
>(m_buffer);
122 m_rstMinValue(-std::numeric_limits<double>::max()),
123 m_rstMaxValue(std::numeric_limits<double>::max()),
126 m_contrastOffset1(0.0),
127 m_contrastOffset2(0.0),
128 m_noDataValue(std::numeric_limits<double>::max())
155 EXTRACT2RGB_TRANSF=2,
157 GREEN2THREE_TRANSF=4,
160 INTERPOLATE_TRANSF=7,
204 void setGain(
double value,
int band);
207 std::vector< double > getGain()
const;
210 void setOffset(
double value,
int band);
213 std::vector< double > getOffset();
219 void setContrastType(
const ContrastType& newType );
222 void setGammaR(
double value);
228 void setGammaG(
double value);
234 void setGammaB(
double value);
240 void setGammaM(
double value);
246 void setRGBMap(std::map<RGBChannels, short>& rgbMap);
249 void setBChannelMapping(
short bIn, RGBChannels bOut);
251 short getBChannelMapping(RGBChannels channel);
257 std::map<RGBChannels, short> getRGBMap();
286 void setLinearTransfParameters(
double vmin,
double vmax,
double rmin,
double rmax);
297 void setLinearTransfParameters(
double vmin,
double vmax,
double rmin,
double rmax,
int band);
309 void setTransfParameters(
double rmin,
double rmax,
double gain,
double offset1,
double offset2,
int band);
323 void setInputRasterResampleSize(
int inputX0,
int inputY0,
int inputWidth,
int inputHeight,
int outWidth,
int outHeight);
326 RasterTransfFunctions getTransfFunction();
329 void setTransfFunction(RasterTransfFunctions func);
338 void apply(
double icol,
double ilin,
double ocol,
double olin) {(this->*m_transfFuncPtr)(icol,ilin,ocol,olin); }
348 void setContrastGainsAndOffsets(
const std::vector< double >& contrastGains,
349 const std::vector< double >& contrastOffsets1,
350 const std::vector< double >& contrastOffsets2 );
358 typedef void (
RasterTransform::*ContrastTransformFunction)(
const unsigned int&,
const double&,
double&)
const;
367 void setMono2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
373 void setExtractRGB(
double icol,
double ilin,
double ocol,
double olin);
379 void setExtractRGBA(
double icol,
double ilin,
double ocol,
double olin);
385 void setRed2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
391 void setGreen2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
397 void setBlue2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
403 void setCategorize(
double icol,
double ilin,
double ocol,
double olin);
409 void setInterpolate(
double icol,
double ilin,
double ocol,
double olin);
415 void setRecode(
double icol,
double ilin,
double ocol,
double olin);
421 void setBand2Band(
double icol,
double ilin,
double ocol,
double olin);
424 inline void applyLinearContrast(
const unsigned int& bandIdx,
const double& inputValue,
double& outputValue)
const 426 assert( bandIdx < m_inputNBands );
427 outputValue = ( ( inputValue + m_transformBandInfo[bandIdx]->m_contrastOffset1 ) *
428 m_transformBandInfo[bandIdx]->m_contrastGain ) + m_transformBandInfo[bandIdx]->m_contrastOffset2;
432 inline void applySquareContrast(
const unsigned int& bandIdx,
const double& inputValue,
double& outputValue)
const 434 assert( bandIdx < m_inputNBands );
435 outputValue = std::pow( inputValue, 2.0 ) * m_transformBandInfo[bandIdx]->m_contrastGain;
441 assert( bandIdx < m_inputNBands );
442 outputValue = std::sqrt( inputValue ) * m_transformBandInfo[bandIdx]->m_contrastGain;
446 inline void applyLogContrast(
const unsigned int& bandIdx,
const double& inputValue,
double& outputValue)
const 448 assert( bandIdx < m_inputNBands );
449 outputValue = std::log10( inputValue + m_transformBandInfo[bandIdx]->m_contrastOffset1 + 1.0 ) *
450 m_transformBandInfo[bandIdx]->m_contrastGain;
454 inline void fixValue(
double& value,
short& band)
const 456 value = std::max(m_transformBandInfo[band]->m_rstMinValue, std::min(m_transformBandInfo[band]->m_rstMaxValue, value));
466 return (m_transformBandInfo[band]->m_noDataValue == value);
474 double checkAlphaValue(
double icol,
double ilin);
519 #endif // __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H
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.
An abstract class for raster data strucutures.
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...
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.