18 #ifndef __otbImageWidgetTransferFunction_h
19 #define __otbImageWidgetTransferFunction_h
21 #include "vcl_deprecated_header.h"
36 template <
class TPixel>
80 virtual void PrintSelf(std::ostream& os,
itk::Indent indent)
const
82 Superclass::PrintSelf(os, indent);
83 os << indent <<
"Lower bound: " << m_LowerBound << std::endl;
84 os << indent <<
"Upper bound: " << m_UpperBound << std::endl;
89 void operator =(
const Self&);
100 template <
class TPixel>
122 if (value < this->GetLowerBound())
126 else if (value > this->GetUpperBound())
132 return static_cast<unsigned char>(vcl_floor(255. *
134 this->GetLowerBound()) /
135 (this->GetUpperBound() - this->GetLowerBound()) + 0.5));
145 void operator =(
const Self&);
151 template <
class TPixel>
173 if (value < this->GetLowerBound())
177 else if (value > this->GetUpperBound())
183 double b = vcl_sqrt(static_cast<double>(this->GetLowerBound()));
184 double a = 255. / (vcl_sqrt(static_cast<double>(this->GetUpperBound())) - b);
185 return static_cast<unsigned char>(vcl_floor(a * (vcl_sqrt(static_cast<double>(value)) - b) + 0.5));
195 void operator =(
const Self&);
201 template <
class TPixel>
223 if (value < this->GetLowerBound())
227 else if (value > this->GetUpperBound())
233 double b = vcl_log(1. + static_cast<double>(this->GetLowerBound()));
234 double a = 255. / (vcl_log(1. + static_cast<double>(this->GetUpperBound())) - b);
235 return static_cast<unsigned char>(vcl_floor(a * (vcl_log(1. + static_cast<double>(value)) - b) + 0.5));
245 void operator =(
const Self&);
251 template <
class TPixel>
273 if (value < this->GetLowerBound())
277 else if (value > this->GetUpperBound())
283 double b = vcl_pow(static_cast<double>(this->GetLowerBound()), 2);
284 double a = 255. / (vcl_pow(static_cast<double>(this->GetUpperBound()), 2) - b);
285 return static_cast<unsigned char>(vcl_floor(a * (vcl_pow(static_cast<double>(value), 2) - b) + 0.5));
295 void operator =(
const Self&);