18 #ifndef __otbGaussianRenderingFunction_h
19 #define __otbGaussianRenderingFunction_h
45 template <
class TPixel,
class TRGBPixel,
46 class TPixelRepresentationFunction = ChannelSelectorFunctor<TPixel>,
47 class TTransferFunction = Identity<
48 typename itk::NumericTraits<typename itk::NumericTraits<TPixel>::ValueType>::RealType,
49 typename itk::NumericTraits<typename itk::NumericTraits<TPixel>::ValueType>::RealType
74 typedef typename itk::NumericTraits<PixelType>::ValueType
ScalarType;
102 if ((spixel.
Size() != 1) && (spixel.
Size() != 3) && (spixel.
Size() != 4))
104 itkExceptionMacro( <<
"the PixelRepresentation function should give an output of "
105 <<
"size 1, 3 or 4 otherwise I don't know how to make an RGB of it !" );
110 itkExceptionMacro( <<
" m_TransferedMinimum and pixel size do not correspond"
111 <<
" spixel.Size(): " << spixel.
Size()
117 if (spixel.
Size() == 1)
131 if ((spixel.
Size() == 4) && (output.Size() == 4))
153 psup.SetSize(p.GetSize() - 2);
154 for (
unsigned int i = 0; i < psup.GetSize(); ++i)
163 otbMsgDevMacro(<<
"GaussianRenderingFunction::SetParameters: Gaussian curve mean = "
181 p.SetSize(psup.GetSize() + 2);
185 for (
unsigned int i = 0; i < psup.GetSize(); ++i)
228 for (
unsigned int histIndex = 0; histIndex < nbHist; histIndex++)
230 std::vector<double> blb;
240 double binMinValue = this->
GetHistogramList()->GetNthElement(histIndex)->Quantile(0, cdfValue);
242 blb.push_back(binMinValue);
256 std::vector<double>::const_iterator it;
259 it = std::lower_bound(blb.begin(), blb.end(),
static_cast<double>(input));
265 else if (it != blb.begin())
267 output = int(it - blb.begin()) - 1;