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);
140 void setGain(
double value);
143 double getGain()
const;
146 void setOffset(
double value);
152 void setContrastType(
const ContrastType& newType );
158 void setGammaR(
double value);
164 void setGammaG(
double value);
170 void setGammaB(
double value);
176 void setGammaM(
double value);
182 void setRGBMap(std::map<RGBChannels, short>& rgbMap);
191 std::map<RGBChannels, short>&
getRGBMap() {
return m_rgbMap; }
232 void setLinearTransfParameters(
double vmin,
double vmax,
double rmin,
double rmax);
244 void setLinearTransfParameters(
double vmin,
double vmax,
double rmin,
double rmax,
int band);
247 RasterTransfFunctions getTransfFunction();
250 void setTransfFunction(RasterTransfFunctions func);
259 void apply(
double icol,
double ilin,
double ocol,
double olin) {(this->*m_transfFuncPtr)(icol,ilin,ocol,olin); }
269 void setContrastGainsAndOffsets(
const std::vector< double >& contrastGains,
270 const std::vector< double >& contrastOffsets1,
271 const std::vector< double >& contrastOffsets2 );
279 typedef void (
RasterTransform::*ContrastTransformFunction)(
const unsigned int&,
const double&,
double&)
const;
288 void setMono2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
294 void setExtractRGB(
double icol,
double ilin,
double ocol,
double olin);
300 void setExtractRGBA(
double icol,
double ilin,
double ocol,
double olin);
306 void setRed2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
312 void setGreen2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
318 void setBlue2ThreeBand(
double icol,
double ilin,
double ocol,
double olin);
324 void setCategorize(
double icol,
double ilin,
double ocol,
double olin);
330 void setInterpolate(
double icol,
double ilin,
double ocol,
double olin);
336 void setRecode(
double icol,
double ilin,
double ocol,
double olin);
342 void setBand2Band(
double icol,
double ilin,
double ocol,
double olin);
345 inline void applyLinearContrast(
const unsigned int& bandIdx,
const double& inputValue,
double& outputValue)
const 347 assert( bandIdx < m_contrastOffsets1.size() );
348 outputValue = ( ( inputValue + m_contrastOffsets1[ bandIdx ] ) *
349 m_contrastGains[ bandIdx ] ) + m_contrastOffsets2[ bandIdx ];
353 inline void applySquareContrast(
const unsigned int& bandIdx,
const double& inputValue,
double& outputValue)
const 355 assert( bandIdx < m_contrastGains.size() );
356 outputValue = std::pow( inputValue, 2.0 ) * m_contrastGains[ bandIdx ];
362 assert( bandIdx < m_contrastGains.size() );
363 outputValue = std::sqrt( inputValue ) * m_contrastGains[ bandIdx ];
367 inline void applyLogContrast(
const unsigned int& bandIdx,
const double& inputValue,
double& outputValue)
const 369 assert( bandIdx < m_contrastOffsets1.size() );
370 outputValue = std::log10( inputValue + m_contrastOffsets1[ bandIdx ] + 1.0 ) *
371 m_contrastGains[ bandIdx ];
375 inline void fixValue(
double& value,
short& band)
const 377 value = std::max(m_rstMinValue[static_cast<size_t>(band)], std::min(m_rstMaxValue[static_cast<size_t>(band)], value));
387 return (m_rasterIn->getBand(static_cast<size_t>(band))->getProperty()->m_noDataValue == value);
395 double checkAlphaValue(
double icol,
double ilin);
438 #endif // __TERRALIB_MAPTOOLS_INTERNAL_RASTERTRANSFORM_H
An abstract class for raster data strucutures.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.