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
00035 template <class TInputImage1, class TInputImage2,
00036 class TInputImage3, class TOutputImage, class TFunction >
00037 class ITK_EXPORT TernaryFunctorImageFilter :
00038 public InPlaceImageFilter<TInputImage1,TOutputImage>
00039 {
00040 public:
00042 typedef TernaryFunctorImageFilter Self;
00043 typedef InPlaceImageFilter<TInputImage1,TOutputImage> Superclass;
00044 typedef SmartPointer<Self> Pointer;
00045 typedef SmartPointer<const Self> ConstPointer;
00046
00048 itkNewMacro(Self);
00049
00051 itkTypeMacro(TernaryFunctorImageFilter, InPlaceImageFilter);
00052
00054 typedef TFunction FunctorType;
00055 typedef TInputImage1 Input1ImageType;
00056 typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
00057 typedef typename Input1ImageType::RegionType Input1ImageRegionType;
00058 typedef typename Input1ImageType::PixelType Input1ImagePixelType;
00059 typedef TInputImage2 Input2ImageType;
00060 typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
00061 typedef typename Input2ImageType::RegionType Input2ImageRegionType;
00062 typedef typename Input2ImageType::PixelType Input2ImagePixelType;
00063 typedef TInputImage3 Input3ImageType;
00064 typedef typename Input3ImageType::ConstPointer Input3ImagePointer;
00065 typedef typename Input3ImageType::RegionType Input3ImageRegionType;
00066 typedef typename Input3ImageType::PixelType Input3ImagePixelType;
00067 typedef TOutputImage OutputImageType;
00068 typedef typename OutputImageType::Pointer OutputImagePointer;
00069 typedef typename OutputImageType::RegionType OutputImageRegionType;
00070 typedef typename OutputImageType::PixelType OutputImagePixelType;
00071
00073 void SetInput1( const TInputImage1 *image1);
00074
00076 void SetInput2( const TInputImage2 *image2);
00077
00079 void SetInput3( const TInputImage3 *image3);
00080
00085 FunctorType& GetFunctor(void) { return m_Functor; };
00086
00091 const FunctorType& GetFunctor() const
00092 {
00093 return m_Functor;
00094 };
00096
00103 void SetFunctor(const FunctorType& functor)
00104 {
00105 if (! (functor == m_Functor) )
00106 {
00107 m_Functor = functor;
00108 this->Modified();
00109 }
00110 }
00112
00114 itkStaticConstMacro(Input1ImageDimension, unsigned int,
00115 TInputImage1::ImageDimension);
00116 itkStaticConstMacro(Input2ImageDimension, unsigned int,
00117 TInputImage2::ImageDimension);
00118 itkStaticConstMacro(Input3ImageDimension, unsigned int,
00119 TInputImage3::ImageDimension);
00120 itkStaticConstMacro(OutputImageDimension, unsigned int,
00121 TOutputImage::ImageDimension);
00123
00124 #ifdef ITK_USE_CONCEPT_CHECKING
00125
00126 itkConceptMacro(SameDimensionCheck1,
00127 (Concept::SameDimension<Input1ImageDimension, Input2ImageDimension>));
00128 itkConceptMacro(SameDimensionCheck2,
00129 (Concept::SameDimension<Input1ImageDimension, Input3ImageDimension>));
00130 itkConceptMacro(SameDimensionCheck3,
00131 (Concept::SameDimension<Input1ImageDimension, OutputImageDimension>));
00132
00134 #endif
00135
00136 protected:
00137 TernaryFunctorImageFilter();
00138 virtual ~TernaryFunctorImageFilter() {};
00139
00142 void BeforeThreadedGenerateData();
00143
00154 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00155 int threadId );
00156
00157 private:
00158 TernaryFunctorImageFilter(const Self&);
00159 void operator=(const Self&);
00160
00161 FunctorType m_Functor;
00162 };
00163
00164 }
00165
00166 #ifndef ITK_MANUAL_INSTANTIATION
00167 #include "itkTernaryFunctorImageFilter.txx"
00168 #endif
00169
00170 #endif
00171