ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTernaryFunctorImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkTernaryFunctorImageFilter_h
19 #define itkTernaryFunctorImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
23 
24 namespace itk
25 {
38 template< typename TInputImage1, typename TInputImage2,
39  typename TInputImage3, typename TOutputImage, typename TFunction >
40 class ITK_TEMPLATE_EXPORT TernaryFunctorImageFilter:
41  public InPlaceImageFilter< TInputImage1, TOutputImage >
42 {
43 public:
49 
51  itkNewMacro(Self);
52 
55 
57  typedef TFunction FunctorType;
58  typedef TInputImage1 Input1ImageType;
59  typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
60  typedef typename Input1ImageType::RegionType Input1ImageRegionType;
61  typedef typename Input1ImageType::PixelType Input1ImagePixelType;
62  typedef TInputImage2 Input2ImageType;
63  typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
64  typedef typename Input2ImageType::RegionType Input2ImageRegionType;
65  typedef typename Input2ImageType::PixelType Input2ImagePixelType;
66  typedef TInputImage3 Input3ImageType;
67  typedef typename Input3ImageType::ConstPointer Input3ImagePointer;
68  typedef typename Input3ImageType::RegionType Input3ImageRegionType;
69  typedef typename Input3ImageType::PixelType Input3ImagePixelType;
70  typedef TOutputImage OutputImageType;
71  typedef typename OutputImageType::Pointer OutputImagePointer;
72  typedef typename OutputImageType::RegionType OutputImageRegionType;
73  typedef typename OutputImageType::PixelType OutputImagePixelType;
74 
76  void SetInput1(const TInputImage1 *image1);
77 
79  void SetInput2(const TInputImage2 *image2);
80 
82  void SetInput3(const TInputImage3 *image3);
83 
88  FunctorType & GetFunctor(void) { return m_Functor; }
89 
94  const FunctorType & GetFunctor() const
95  {
96  return m_Functor;
97  }
98 
105  void SetFunctor(const FunctorType & functor)
106  {
107  if ( !( functor == m_Functor ) )
108  {
109  m_Functor = functor;
110  this->Modified();
111  }
112  }
114 
116  itkStaticConstMacro(Input1ImageDimension, unsigned int,
117  TInputImage1::ImageDimension);
118  itkStaticConstMacro(Input2ImageDimension, unsigned int,
119  TInputImage2::ImageDimension);
120  itkStaticConstMacro(Input3ImageDimension, unsigned int,
121  TInputImage3::ImageDimension);
122  itkStaticConstMacro(OutputImageDimension, unsigned int,
123  TOutputImage::ImageDimension);
125 
126 #ifdef ITK_USE_CONCEPT_CHECKING
127  // Begin concept checking
128  itkConceptMacro( SameDimensionCheck1,
130  itkConceptMacro( SameDimensionCheck2,
132  itkConceptMacro( SameDimensionCheck3,
134  // End concept checking
135 #endif
136 
137 protected:
139  virtual ~TernaryFunctorImageFilter() ITK_OVERRIDE {}
140 
143  void BeforeThreadedGenerateData() ITK_OVERRIDE;
144 
155  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
156  ThreadIdType threadId) ITK_OVERRIDE;
157 
158 private:
159  ITK_DISALLOW_COPY_AND_ASSIGN(TernaryFunctorImageFilter);
160 
161  FunctorType m_Functor;
162 };
163 } // end namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 #include "itkTernaryFunctorImageFilter.hxx"
167 #endif
168 
169 #endif
Light weight base class for most itk classes.
Input2ImageType::RegionType Input2ImageRegionType
Input2ImageType::PixelType Input2ImagePixelType
Input3ImageType::RegionType Input3ImageRegionType
Input3ImageType::ConstPointer Input3ImagePointer
Implements pixel-wise generic operation of three images.
const FunctorType & GetFunctor() const
InPlaceImageFilter< TInputImage1, TOutputImage > Superclass
Input1ImageType::ConstPointer Input1ImagePointer
Input1ImageType::PixelType Input1ImagePixelType
void SetFunctor(const FunctorType &functor)
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Input1ImageType::RegionType Input1ImageRegionType
OutputImageType::RegionType OutputImageRegionType
OutputImageType::PixelType OutputImagePixelType
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)
Input2ImageType::ConstPointer Input2ImagePointer
Input3ImageType::PixelType Input3ImagePixelType