00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSquareImageFilter_h
00018 #define __itkSquareImageFilter_h
00019
00020 #include "itkUnaryFunctorImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00031 namespace Function {
00032
00033 template< class TInput, class TOutput>
00034 class Square
00035 {
00036 public:
00037 typedef typename NumericTraits<TInput>::RealType RealType;
00038 Square() {}
00039 ~Square() {}
00040 inline TOutput operator()( const TInput & A )
00041 {
00042 const RealType ra = static_cast<RealType>( A );
00043 return static_cast<TOutput>( ra * ra );
00044 }
00045 };
00046 }
00047 template <class TInputImage, class TOutputImage>
00048 class ITK_EXPORT SquareImageFilter :
00049 public
00050 UnaryFunctorImageFilter<TInputImage,TOutputImage,
00051 Function::Square< typename TInputImage::PixelType,
00052 typename TOutputImage::PixelType> >
00053 {
00054 public:
00056 typedef SquareImageFilter Self;
00057 typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,
00058 Function::Square< typename TInputImage::PixelType,
00059 typename TOutputImage::PixelType> > Superclass;
00060 typedef SmartPointer<Self> Pointer;
00061 typedef SmartPointer<const Self> ConstPointer;
00062
00064 itkNewMacro(Self);
00065
00066 protected:
00067 SquareImageFilter() {}
00068 virtual ~SquareImageFilter() {}
00069
00070 private:
00071 SquareImageFilter(const Self&);
00072 void operator=(const Self&);
00073
00074 };
00075
00076 }
00077
00078
00079 #endif