ITK  5.0.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:
44  ITK_DISALLOW_COPY_AND_ASSIGN(TernaryFunctorImageFilter);
45 
51 
53  itkNewMacro(Self);
54 
57 
59  using FunctorType = TFunction;
60  using Input1ImageType = TInputImage1;
61  using Input1ImagePointer = typename Input1ImageType::ConstPointer;
63  using Input1ImagePixelType = typename Input1ImageType::PixelType;
64  using Input2ImageType = TInputImage2;
65  using Input2ImagePointer = typename Input2ImageType::ConstPointer;
67  using Input2ImagePixelType = typename Input2ImageType::PixelType;
68  using Input3ImageType = TInputImage3;
69  using Input3ImagePointer = typename Input3ImageType::ConstPointer;
71  using Input3ImagePixelType = typename Input3ImageType::PixelType;
72  using OutputImageType = TOutputImage;
73  using OutputImagePointer = typename OutputImageType::Pointer;
75  using OutputImagePixelType = typename OutputImageType::PixelType;
76 
78  void SetInput1(const TInputImage1 *image1);
79 
81  void SetInput2(const TInputImage2 *image2);
82 
84  void SetInput3(const TInputImage3 *image3);
85 
90  FunctorType & GetFunctor() { return m_Functor; }
91 
96  const FunctorType & GetFunctor() const
97  {
98  return m_Functor;
99  }
100 
107  void SetFunctor(const FunctorType & functor)
108  {
109  if ( !( functor == m_Functor ) )
110  {
111  m_Functor = functor;
112  this->Modified();
113  }
114  }
116 
118  static constexpr unsigned int Input1ImageDimension = TInputImage1::ImageDimension;
119  static constexpr unsigned int Input2ImageDimension = TInputImage2::ImageDimension;
120  static constexpr unsigned int Input3ImageDimension = TInputImage3::ImageDimension;
121  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
122 
123 #ifdef ITK_USE_CONCEPT_CHECKING
124  // Begin concept checking
125  itkConceptMacro( SameDimensionCheck1,
127  itkConceptMacro( SameDimensionCheck2,
129  itkConceptMacro( SameDimensionCheck3,
131  // End concept checking
132 #endif
133 
134 protected:
136  ~TernaryFunctorImageFilter() override = default;
137 
140  void BeforeThreadedGenerateData() override;
141 
152  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
153 
154 
155 private:
157 };
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkTernaryFunctorImageFilter.hxx"
162 #endif
163 
164 #endif
typename OutputImageType::Pointer OutputImagePointer
Light weight base class for most itk classes.
Implements pixel-wise generic operation of three images.
const FunctorType & GetFunctor() const
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
void SetFunctor(const FunctorType &functor)
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)