00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNaryFunctorImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/03/24 22:23:05 $ 00007 Version: $Revision: 1.13 $ 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 "itkInPlaceImageFilter.h" 00021 #include "itkImageIterator.h" 00022 #include "itkArray.h" 00023 00024 namespace itk 00025 { 00026 00040 template <class TInputImage, class TOutputImage, class TFunction > 00041 class ITK_EXPORT NaryFunctorImageFilter : 00042 public InPlaceImageFilter<TInputImage,TOutputImage> 00043 00044 { 00045 public: 00047 typedef NaryFunctorImageFilter Self; 00048 typedef InPlaceImageFilter<TInputImage,TOutputImage> Superclass; 00049 typedef SmartPointer<Self> Pointer; 00050 typedef SmartPointer<const Self> ConstPointer; 00052 itkNewMacro(Self); 00053 00055 itkTypeMacro(NaryFunctorImageFilter, InPlaceImageFilter); 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 typedef Array< InputImagePixelType > NaryArrayType; 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