18 #ifndef __otbNormalizeVectorImageFilter_h
19 #define __otbNormalizeVectorImageFilter_h
21 #include <vnl/vnl_math.h>
23 #include <itkNumericTraits.h>
38 template <
class TInput,
class TOutput >
46 typedef typename itk::NumericTraits< typename RealVectorType::ValueType >::RealType
RealType;
50 unsigned int length = input.Size();
51 TOutput output ( length );
52 for (
unsigned int i = 0; i < length; ++i )
54 output[i] =
static_cast<typename TOutput::ValueType
>(
65 for (
unsigned int i = 0; i <
m_Mean.Size(); ++i )
66 m_Mean[i] = static_cast< RealType >( m[i] );
78 for (
unsigned int i = 0; i <
m_StdDev.Size(); ++i )
81 if (
m_StdDev[i] == itk::NumericTraits< RealType >::Zero )
84 "Cannot divide by zero !", ITK_LOCATION);
93 for (
unsigned int i = 0; i <
m_StdDev.Size(); ++i )
95 m_StdDev[i] = vcl_sqrt( static_cast< RealType >( var[i] ) );
96 if (
m_StdDev[i] == itk::NumericTraits< RealType >::Zero )
99 "Cannot divide by zero !", ITK_LOCATION);
129 template <
class TInputImage,
class TOutputImage >
132 Functor::NormalizeVectorImageFunctor<
133 typename TInputImage::PixelType,
134 typename TOutputImage::PixelType > >
141 typename TInputImage::PixelType,
155 typedef typename itk::NumericTraits< typename TInputImage::PixelType >::RealType
RealVectorType;
156 typedef typename itk::NumericTraits< typename RealVectorType::ValueType >::RealType
RealType;
166 this->GetFunctor().SetMean( m );
167 m_IsGivenMean =
true;
175 this->GetFunctor().SetStdDev( sigma );
176 m_IsGivenStdDev =
true;
184 this->GetFunctor().SetVariance( var );
185 m_IsGivenStdDev =
true;
191 itkSetMacro(UseMean,
bool);
192 itkSetMacro(UseStdDev,
bool);
198 void BeforeThreadedGenerateData();
202 void operator=(
const Self & );
216 #ifndef OTB_MANUAL_INSTANTIATION
220 #endif // __otbNormalizeVectorImageFilter_h