00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkUnaryFunctorImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2004/02/10 16:26:38 $ 00007 Version: $Revision: 1.22 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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&); //purposely not implemented 00115 void operator=(const Self&); //purposely not implemented 00116 00117 FunctorType m_Functor; 00118 }; 00119 00120 } // end namespace itk 00121 00122 #ifndef ITK_MANUAL_INSTANTIATION 00123 #include "itkUnaryFunctorImageFilter.txx" 00124 #endif 00125 00126 #endif