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 };
00098
00105 void SetFunctor(const FunctorType& functor)
00106 {
00107 if (! (functor == m_Functor) )
00108 {
00109 m_Functor = functor;
00110 this->Modified();
00111 }
00112 }
00114
00116 itkStaticConstMacro(Input1ImageDimension, unsigned int,
00117 TInputImage1::ImageDimension);
00118 itkStaticConstMacro(Input2ImageDimension, unsigned int,
00119 TInputImage2::ImageDimension);
00120 itkStaticConstMacro(Input3ImageDimension, unsigned int,
00121 TInputImage3::ImageDimension);
00122 itkStaticConstMacro(OutputImageDimension, unsigned int,
00123 TOutputImage::ImageDimension);
00125
00126 #ifdef ITK_USE_CONCEPT_CHECKING
00127
00128 itkConceptMacro(SameDimensionCheck1,
00129 (Concept::SameDimension<Input1ImageDimension, Input2ImageDimension>));
00130 itkConceptMacro(SameDimensionCheck2,
00131 (Concept::SameDimension<Input1ImageDimension, Input3ImageDimension>));
00132 itkConceptMacro(SameDimensionCheck3,
00133 (Concept::SameDimension<Input1ImageDimension, OutputImageDimension>));
00134
00136 #endif
00137
00138 protected:
00139 TernaryFunctorImageFilter();
00140 virtual ~TernaryFunctorImageFilter() {};
00141
00144 void BeforeThreadedGenerateData();
00145
00156 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00157 int threadId );
00158
00159 private:
00160 TernaryFunctorImageFilter(const Self&);
00161 void operator=(const Self&);
00162
00163 FunctorType m_Functor;
00164 };
00165
00166 }
00167
00168 #ifndef ITK_MANUAL_INSTANTIATION
00169 #include "itkTernaryFunctorImageFilter.txx"
00170 #endif
00171
00172 #endif
00173