21 #ifndef otbConvertTypeFunctor_h
22 #define otbConvertTypeFunctor_h
28 #include "itkNumericTraits.h"
29 #include <boost/type_traits/is_complex.hpp>
31 #include <type_traits>
39 template <
class TInputPixelType,
class TOutputPixelType>
54 static constexpr
bool m_cInPix = boost::is_complex<InputPixelType>::value;
55 static constexpr
bool m_cOutPix = boost::is_complex<OutputPixelType>::value;
56 static constexpr
bool m_cInInternalPix = boost::is_complex<InputInternalPixelType>::value;
57 static constexpr
bool m_cOutInternalPix = boost::is_complex<OutputInternalPixelType>::value;
79 unsigned int size = itk::NumericTraits<OutputPixelType>::GetLength(out);
101 assert( lowest <= highest );
115 auto first = r_in.begin();
116 auto const end = r_in.end();
117 auto dfirst = r_out.begin();
118 auto const dend = r_out.end();
120 static_assert(std::is_same<
OutputPixelValueType, std::decay_t<decltype(*dfirst)>>::value,
"They should match");
126 for (; first!=end && dfirst!=dend ; ++first, ++dfirst)
134 *dfirst =
static_cast<OutputPixelValueType>(otb::clamp<ThresholdPixelValueType>(*first, lo, hi));
139 std::fill(dfirst, dend,
m_Zero);
141 for (; dfirst != dend ; ++dfirst)