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 "itkImageToImageFilter.h"
00021 #include "itkImageRegionIteratorWithIndex.h"
00022
00023 namespace itk
00024 {
00025
00035 template <class TInputImage, class TOutputImage, class TFunction >
00036 class ITK_EXPORT UnaryFunctorImageFilter : public ImageToImageFilter<TInputImage,TOutputImage>
00037 {
00038 public:
00040 typedef UnaryFunctorImageFilter Self;
00041 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00042 typedef SmartPointer<Self> Pointer;
00043 typedef SmartPointer<const Self> ConstPointer;
00044
00046 itkNewMacro(Self);
00047
00049 itkTypeMacro(UnaryFunctorImageFilter, ImageToImageFilter);
00050
00052 typedef TFunction FunctorType;
00053 typedef TInputImage InputImageType;
00054 typedef typename InputImageType::ConstPointer InputImagePointer;
00055 typedef typename InputImageType::RegionType InputImageRegionType;
00056 typedef typename InputImageType::PixelType InputImagePixelType;
00057 typedef TOutputImage OutputImageType;
00058 typedef typename OutputImageType::Pointer OutputImagePointer;
00059 typedef typename OutputImageType::RegionType OutputImageRegionType;
00060 typedef typename OutputImageType::PixelType OutputImagePixelType;
00061
00066 FunctorType& GetFunctor() { return m_Functor; };
00067 const FunctorType& GetFunctor() const { return m_Functor; };
00068
00075 void SetFunctor(const FunctorType& functor)
00076 {
00077 m_Functor = functor;
00078 this->Modified();
00079 }
00080
00081 protected:
00082 UnaryFunctorImageFilter();
00083 virtual ~UnaryFunctorImageFilter() {};
00084
00095 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00096 int threadId );
00097
00098 private:
00099 UnaryFunctorImageFilter(const Self&);
00100 void operator=(const Self&);
00101
00102 FunctorType m_Functor;
00103 };
00104
00105 }
00106
00107 #ifndef ITK_MANUAL_INSTANTIATION
00108 #include "itkUnaryFunctorImageFilter.txx"
00109 #endif
00110
00111 #endif