00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBinaryFunctorImageFilter_h
00018 #define __itkBinaryFunctorImageFilter_h
00019
00020 #include "itkInPlaceImageFilter.h"
00021 #include "itkImageRegionIteratorWithIndex.h"
00022
00023 namespace itk
00024 {
00025
00035 template <class TInputImage1, class TInputImage2,
00036 class TOutputImage, class TFunction >
00037 class ITK_EXPORT BinaryFunctorImageFilter :
00038 public InPlaceImageFilter<TInputImage1,TOutputImage>
00039 {
00040 public:
00042 typedef BinaryFunctorImageFilter 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(BinaryFunctorImageFilter, 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 TOutputImage OutputImageType;
00064 typedef typename OutputImageType::Pointer OutputImagePointer;
00065 typedef typename OutputImageType::RegionType OutputImageRegionType;
00066 typedef typename OutputImageType::PixelType OutputImagePixelType;
00067
00069 void SetInput1( const TInputImage1 * image1);
00070
00072 void SetInput2( const TInputImage2 * image2);
00073
00078 FunctorType& GetFunctor() { return m_Functor; };
00079
00084 const FunctorType& GetFunctor() const
00085 {
00086 return m_Functor;
00087 };
00089
00096 void SetFunctor(const FunctorType& functor)
00097 {
00098 if (m_Functor != functor)
00099 {
00100 m_Functor = functor;
00101 this->Modified();
00102 }
00103 }
00105
00107 itkStaticConstMacro(
00108 InputImage1Dimension, unsigned int, TInputImage1::ImageDimension);
00109 itkStaticConstMacro(
00110 InputImage2Dimension, unsigned int, TInputImage2::ImageDimension);
00111 itkStaticConstMacro(
00112 OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
00114
00115 #ifdef ITK_USE_CONCEPT_CHECKING
00116
00117 itkConceptMacro(SameDimensionCheck1,
00118 (Concept::SameDimension<itkGetStaticConstMacro(InputImage1Dimension),
00119 itkGetStaticConstMacro(InputImage2Dimension)>));
00120 itkConceptMacro(SameDimensionCheck2,
00121 (Concept::SameDimension<itkGetStaticConstMacro(InputImage1Dimension),
00122 itkGetStaticConstMacro(OutputImageDimension)>));
00123
00125 #endif
00126
00127 protected:
00128 BinaryFunctorImageFilter();
00129 virtual ~BinaryFunctorImageFilter() {};
00130
00141 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00142 int threadId );
00143
00144 private:
00145 BinaryFunctorImageFilter(const Self&);
00146 void operator=(const Self&);
00147
00148 FunctorType m_Functor;
00149 };
00150
00151 }
00152
00153 #ifndef ITK_MANUAL_INSTANTIATION
00154 #include "itkBinaryFunctorImageFilter.txx"
00155 #endif
00156
00157 #endif
00158