00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkUnaryFunctorImageFilter_h
00018 #define __itkUnaryFunctorImageFilter_h
00019
00020 #include "itkInPlaceImageFilter.h"
00021 #include "itkImageRegionIteratorWithIndex.h"
00022
00023 namespace itk
00024 {
00025
00040 template <class TInputImage, class TOutputImage, class TFunction >
00041 class ITK_EXPORT UnaryFunctorImageFilter : public InPlaceImageFilter<TInputImage,TOutputImage>
00042 {
00043 public:
00045 typedef UnaryFunctorImageFilter Self;
00046 typedef InPlaceImageFilter<TInputImage,TOutputImage> Superclass;
00047 typedef SmartPointer<Self> Pointer;
00048 typedef SmartPointer<const Self> ConstPointer;
00049
00051 itkNewMacro(Self);
00052
00054 itkTypeMacro(UnaryFunctorImageFilter, InPlaceImageFilter);
00055
00057 typedef TFunction FunctorType;
00058 typedef TInputImage InputImageType;
00059 typedef typename InputImageType::ConstPointer InputImagePointer;
00060 typedef typename InputImageType::RegionType InputImageRegionType;
00061 typedef typename InputImageType::PixelType InputImagePixelType;
00062 typedef TOutputImage OutputImageType;
00063 typedef typename OutputImageType::Pointer OutputImagePointer;
00064 typedef typename OutputImageType::RegionType OutputImageRegionType;
00065 typedef typename OutputImageType::PixelType OutputImagePixelType;
00066
00071 FunctorType& GetFunctor() { return m_Functor; };
00072 const FunctorType& GetFunctor() const { return m_Functor; };
00073
00080 void SetFunctor(const FunctorType& functor)
00081 {
00082 m_Functor = functor;
00083 this->Modified();
00084 }
00085
00086 protected:
00087 UnaryFunctorImageFilter();
00088 virtual ~UnaryFunctorImageFilter() {};
00089
00098 virtual void GenerateOutputInformation();
00099
00110 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00111 int threadId );
00112
00113 private:
00114 UnaryFunctorImageFilter(const Self&);
00115 void operator=(const Self&);
00116
00117 FunctorType m_Functor;
00118 };
00119
00120 }
00121
00122 #ifndef ITK_MANUAL_INSTANTIATION
00123 #include "itkUnaryFunctorImageFilter.txx"
00124 #endif
00125
00126 #endif