00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNaryFunctorImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:52 $ 00007 Version: $Revision: 1.11 $ 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 __itkNaryFunctorImageFilter_h 00018 #define __itkNaryFunctorImageFilter_h 00019 00020 #include "itkImageToImageFilter.h" 00021 #include "itkImageIterator.h" 00022 00023 namespace itk 00024 { 00025 00039 template <class TInputImage, class TOutputImage, class TFunction > 00040 class ITK_EXPORT NaryFunctorImageFilter : 00041 public ImageToImageFilter<TInputImage,TOutputImage> 00042 00043 { 00044 public: 00046 typedef NaryFunctorImageFilter Self; 00047 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass; 00048 typedef SmartPointer<Self> Pointer; 00049 typedef SmartPointer<const Self> ConstPointer; 00050 00052 itkNewMacro(Self); 00053 00055 itkTypeMacro(NaryFunctorImageFilter, ImageToImageFilter); 00056 00058 typedef TFunction FunctorType; 00059 typedef TInputImage InputImageType; 00060 typedef typename InputImageType::Pointer InputImagePointer; 00061 typedef typename InputImageType::RegionType InputImageRegionType; 00062 typedef typename InputImageType::PixelType InputImagePixelType; 00063 typedef TOutputImage OutputImageType; 00064 typedef typename OutputImageType::Pointer OutputImagePointer; 00065 typedef typename OutputImageType::RegionType OutputImageRegionType; 00066 typedef typename OutputImageType::PixelType OutputImagePixelType; 00067 00068 00073 FunctorType& GetFunctor() { return m_Functor; }; 00074 00081 void SetFunctor(FunctorType& functor) 00082 { 00083 if ( m_Functor != functor ) 00084 { 00085 m_Functor = functor; 00086 this->Modified(); 00087 } 00088 } 00089 00090 protected: 00091 NaryFunctorImageFilter(); 00092 virtual ~NaryFunctorImageFilter() {}; 00093 00104 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, 00105 int threadId ); 00106 00107 private: 00108 NaryFunctorImageFilter(const Self&); //purposely not implemented 00109 void operator=(const Self&); //purposely not implemented 00110 00111 FunctorType m_Functor; 00112 }; 00113 00114 } // end namespace itk 00115 00116 #ifndef ITK_MANUAL_INSTANTIATION 00117 #include "itkNaryFunctorImageFilter.txx" 00118 #endif 00119 00120 #endif