18 #ifndef __otbStandardRenderingFunction_h
19 #define __otbStandardRenderingFunction_h
44 template <
class TInputPixel,
class TOutputPixel>
56 return !(*
this != other);
61 return static_cast<TOutputPixel
>(A);
80 template <
class TPixel,
class TRGBPixel,
81 class TPixelRepresentationFunction = ChannelSelectorFunctor<TPixel>,
82 class TTransferFunction = Identity<
83 typename itk::NumericTraits<typename itk::NumericTraits<TPixel>::ValueType>::RealType,
84 typename itk::NumericTraits<typename itk::NumericTraits<TPixel>::ValueType>::RealType
106 typedef typename itk::NumericTraits<PixelType>::ValueType
ScalarType;
140 if ((spixel.
Size() != 1) && (spixel.
Size() != 3) && (spixel.
Size() != 2) && (spixel.
Size() != 4))
142 itkExceptionMacro(<<
"the PixelRepresentation function should give an output of "
143 <<
"size 1, 3 or 4 otherwise I don't know how to make an RGB of it !");
147 itkExceptionMacro(<<
" m_TransferedMinimum and pixel size do not correspond"
148 <<
" spixel.Size(): " << spixel.
Size()
158 if (spixel.
Size() == 1)
173 if ((spixel.
Size() == 4) && (output.Size() == 4))
175 assert((spixel[3] >= 0) && (spixel[3] <= 255));
204 std::vector<unsigned int> defaultDisplay = metadataInterface->GetDefaultDisplay();
218 <<
"Initialize(): " << nbComps <<
" components, quantile= " << 100 *
m_AutoMinMaxQuantile <<
" %");
232 for (
unsigned int comp = 0; comp < nbComps; ++comp)
236 static_cast<ScalarType> (this->
GetHistogramList()->GetNthElement(comp)->Quantile(0,
255 typename ExtremaVectorType::const_iterator minIt = this->
m_Minimum.begin();
256 typename ExtremaVectorType::const_iterator maxIt = this->
m_Maximum.begin();
277 std::ostringstream oss;
279 typename PixelRepresentationFunctionType::ChannelListType channels;
282 for (
unsigned int i = 0; i < channels.size(); ++i)
285 oss << channels[i] + 1 <<
" ";
294 <<
static_cast<typename itk::NumericTraits<PixelType>::PrintType
>(spixel) << std::endl;
296 <<
static_cast<typename itk::NumericTraits<InternalPixelType>::PrintType
>(spixelRepresentation) << std::endl;
299 <<
static_cast<typename itk::NumericTraits<OutputValueType>::PrintType
>(spixelDisplay[0]) <<
", ";
301 <<
static_cast<typename itk::NumericTraits<OutputValueType>::PrintType
>(spixelDisplay[1]) <<
", ";
303 <<
static_cast<typename itk::NumericTraits<OutputValueType>::PrintType
>(spixelDisplay[2]);
304 if (spixelDisplay.Size() == 4)
308 <<
static_cast<typename itk::NumericTraits<OutputValueType>::PrintType
>(spixelDisplay[3]);
323 if (parameters.
Size() % 2 != 0)
325 itkExceptionMacro(<<
"Min And Max should be provided for every band to display");
328 for (
unsigned int i = 0; i < parameters.
Size(); ++i)
350 for (
unsigned int i = 0; i < nbBands; ++i)
391 itkGetMacro(AutoMinMax,
bool);
392 itkBooleanMacro(AutoMinMax);
394 itkGetMacro(AutoMinMaxQuantile,
double);
416 else if (input < min)
423 255. * (static_cast<double> (input) - static_cast<double> (min))
424 / (static_cast<double> (max) - static_cast<double> (min))
434 itkExceptionMacro(<<
"m_Minimum and m_Maximum should have the same size");
438 for (
unsigned int i = 0; i <
m_Minimum.size(); ++i)