00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkTernaryFunctorImageFilter_h
00018 #define __itkTernaryFunctorImageFilter_h
00019
00020 #include "itkInPlaceImageFilter.h"
00021 #include "itkImageRegionIteratorWithIndex.h"
00022
00023 namespace itk
00024 {
00025
00037 template <class TInputImage1, class TInputImage2,
00038 class TInputImage3, class TOutputImage, class TFunction >
00039 class ITK_EXPORT TernaryFunctorImageFilter :
00040 public InPlaceImageFilter<TInputImage1,TOutputImage>
00041 {
00042 public:
00044 typedef TernaryFunctorImageFilter Self;
00045 typedef InPlaceImageFilter<TInputImage1,TOutputImage> Superclass;
00046 typedef SmartPointer<Self> Pointer;
00047 typedef SmartPointer<const Self> ConstPointer;
00048
00050 itkNewMacro(Self);
00051
00053 itkTypeMacro(TernaryFunctorImageFilter, InPlaceImageFilter);
00054
00056 typedef TFunction FunctorType;
00057 typedef TInputImage1 Input1ImageType;
00058 typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
00059 typedef typename Input1ImageType::RegionType Input1ImageRegionType;
00060 typedef typename Input1ImageType::PixelType Input1ImagePixelType;
00061 typedef TInputImage2 Input2ImageType;
00062 typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
00063 typedef typename Input2ImageType::RegionType Input2ImageRegionType;
00064 typedef typename Input2ImageType::PixelType Input2ImagePixelType;
00065 typedef TInputImage3 Input3ImageType;
00066 typedef typename Input3ImageType::ConstPointer Input3ImagePointer;
00067 typedef typename Input3ImageType::RegionType Input3ImageRegionType;
00068 typedef typename Input3ImageType::PixelType Input3ImagePixelType;
00069 typedef TOutputImage OutputImageType;
00070 typedef typename OutputImageType::Pointer OutputImagePointer;
00071 typedef typename OutputImageType::RegionType OutputImageRegionType;
00072 typedef typename OutputImageType::PixelType OutputImagePixelType;
00073
00075 void SetInput1( const TInputImage1 *image1);
00076
00078 void SetInput2( const TInputImage2 *image2);
00079
00081 void SetInput3( const TInputImage3 *image3);
00082
00087 FunctorType& GetFunctor(void) { return m_Functor; };
00088
00093 const FunctorType& GetFunctor() const
00094 {
00095 return m_Functor;
00096 }
00097
00104 void SetFunctor(const FunctorType& functor)
00105 {
00106 if (! (functor == m_Functor) )
00107 {
00108 m_Functor = functor;
00109 this->Modified();
00110 }
00111 }
00113
00115 itkStaticConstMacro(Input1ImageDimension, unsigned int,
00116 TInputImage1::ImageDimension);
00117 itkStaticConstMacro(Input2ImageDimension, unsigned int,
00118 TInputImage2::ImageDimension);
00119 itkStaticConstMacro(Input3ImageDimension, unsigned int,
00120 TInputImage3::ImageDimension);
00121 itkStaticConstMacro(OutputImageDimension, unsigned int,
00122 TOutputImage::ImageDimension);
00124
00125 #ifdef ITK_USE_CONCEPT_CHECKING
00126
00127 itkConceptMacro(SameDimensionCheck1,
00128 (Concept::SameDimension<Input1ImageDimension, Input2ImageDimension>));
00129 itkConceptMacro(SameDimensionCheck2,
00130 (Concept::SameDimension<Input1ImageDimension, Input3ImageDimension>));
00131 itkConceptMacro(SameDimensionCheck3,
00132 (Concept::SameDimension<Input1ImageDimension, OutputImageDimension>));
00133
00135 #endif
00136
00137 protected:
00138 TernaryFunctorImageFilter();
00139 virtual ~TernaryFunctorImageFilter() {};
00140
00143 void BeforeThreadedGenerateData();
00144
00155 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00156 int threadId );
00157
00158 private:
00159 TernaryFunctorImageFilter(const Self&);
00160 void operator=(const Self&);
00161
00162 FunctorType m_Functor;
00163 };
00164
00165 }
00166
00167 #ifndef ITK_MANUAL_INSTANTIATION
00168 #include "itkTernaryFunctorImageFilter.txx"
00169 #endif
00170
00171 #endif
00172