18 #ifndef __itkNormalizeVectorImageFilter_h 19 #define __itkNormalizeVectorImageFilter_h 21 #include "itkUnaryFunctorImageFilter.h" 33 template<
class TInput,
class TOutput>
43 return !( *
this == other );
59 unsigned int vectorSize = A.GetSize();
62 output.SetSize( vectorSize );
66 for (
unsigned int k=0; k < vectorSize; k++ )
67 norm += std::fabs(A[k]);
79 for (
unsigned int k=0; k < vectorSize; k++ )
85 for (
unsigned int k=0; k < vectorSize; k++ )
87 norm = std::sqrt(norm);
91 for (
unsigned int k=0; k < vectorSize; k++ )
92 output[k] = A[k] / norm;
96 for (
unsigned int k=0; k < vectorSize; k++ )
102 for (
unsigned int k=0; k < vectorSize; k++ )
124 template <
class TInputImage,
class TOutputImage>
127 UnaryFunctorImageFilter<TInputImage,TOutputImage,
128 Functor::NormalizeVectorImageFunctor< typename TInputImage::PixelType,
129 typename TOutputImage::PixelType> >
134 typedef UnaryFunctorImageFilter<
135 TInputImage,TOutputImage,
146 UnaryFunctorImageFilter);
155 this->GetFunctor().SetNormalizeType(norm);
161 return this->GetFunctor().GetNormalizeType();
174 void operator=(
const Self&);
TOutput operator()(const TInput &A) const
NormalizeType m_NormalizeType
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::NormalizeVectorImageFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
FunctorType::NormalizeType NormalizeType
SmartPointer< Self > Pointer
NormalizeVectorImageFunctor()
virtual ~NormalizeVectorImageFilter()
Functor::NormalizeVectorImageFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
bool operator==(const NormalizeVectorImageFunctor &other) const
Pixel-wise vector normalization.
void SetNormalizeType(NormalizeType norm)
bool operator!=(const NormalizeVectorImageFunctor &other) const
NormalizeType GetNormalizeType() const
NormalizeVectorImageFilter Self
NormalizeVectorImageFilter()
~NormalizeVectorImageFunctor()
NormalizeType GetNormalizeType() const
void SetNormalizeType(NormalizeType norm)
SmartPointer< const Self > ConstPointer