ITK  6.0.0
Insight Toolkit
itkTernaryFunctorImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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,
39  typename TInputImage2,
40  typename TInputImage3,
41  typename TOutputImage,
42  typename TFunction>
43 class ITK_TEMPLATE_EXPORT TernaryFunctorImageFilter : public InPlaceImageFilter<TInputImage1, TOutputImage>
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(TernaryFunctorImageFilter);
47 
53 
55  itkNewMacro(Self);
56 
58  itkOverrideGetNameOfClassMacro(TernaryFunctorImageFilter);
59 
61  using FunctorType = TFunction;
62  using Input1ImageType = TInputImage1;
65  using Input1ImagePixelType = typename Input1ImageType::PixelType;
66  using Input2ImageType = TInputImage2;
69  using Input2ImagePixelType = typename Input2ImageType::PixelType;
70  using Input3ImageType = TInputImage3;
73  using Input3ImagePixelType = typename Input3ImageType::PixelType;
74  using OutputImageType = TOutputImage;
77  using OutputImagePixelType = typename OutputImageType::PixelType;
78 
80  void
81  SetInput1(const TInputImage1 * image1);
82 
84  void
85  SetInput2(const TInputImage2 * image2);
86 
88  void
89  SetInput3(const TInputImage3 * image3);
90 
95  FunctorType &
97  {
98  return m_Functor;
99  }
100 
105  const FunctorType &
106  GetFunctor() const
107  {
108  return m_Functor;
109  }
110 
117  void
118  SetFunctor(const FunctorType & functor)
119  {
120  if (!(functor == m_Functor))
121  {
122  m_Functor = functor;
123  this->Modified();
124  }
125  }
129  static constexpr unsigned int Input1ImageDimension = TInputImage1::ImageDimension;
130  static constexpr unsigned int Input2ImageDimension = TInputImage2::ImageDimension;
131  static constexpr unsigned int Input3ImageDimension = TInputImage3::ImageDimension;
132  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
133 
134 #ifdef ITK_USE_CONCEPT_CHECKING
135  // Begin concept checking
139  // End concept checking
140 #endif
141 
142 protected:
144  ~TernaryFunctorImageFilter() override = default;
145 
148  void
149  BeforeThreadedGenerateData() override;
150 
161  void
162  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
163 
164 
165 private:
166  FunctorType m_Functor{};
167 };
168 } // end namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 # include "itkTernaryFunctorImageFilter.hxx"
172 #endif
173 
174 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::TernaryFunctorImageFilter::Input1ImagePixelType
typename Input1ImageType::PixelType Input1ImagePixelType
Definition: itkTernaryFunctorImageFilter.h:65
itk::TernaryFunctorImageFilter::Input2ImagePixelType
typename Input2ImageType::PixelType Input2ImagePixelType
Definition: itkTernaryFunctorImageFilter.h:69
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::TernaryFunctorImageFilter::Input2ImageType
TInputImage2 Input2ImageType
Definition: itkTernaryFunctorImageFilter.h:66
itk::TernaryFunctorImageFilter::Input2ImageRegionType
typename Input2ImageType::RegionType Input2ImageRegionType
Definition: itkTernaryFunctorImageFilter.h:68
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::TernaryFunctorImageFilter::Input2ImagePointer
typename Input2ImageType::ConstPointer Input2ImagePointer
Definition: itkTernaryFunctorImageFilter.h:67
itk::TernaryFunctorImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: itkTernaryFunctorImageFilter.h:106
itk::TernaryFunctorImageFilter::Input3ImagePixelType
typename Input3ImageType::PixelType Input3ImagePixelType
Definition: itkTernaryFunctorImageFilter.h:73
itk::SmartPointer< Self >
itkImageRegionIteratorWithIndex.h
itk::Concept::SameDimension
Definition: itkConceptChecking.h:697
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::TernaryFunctorImageFilter::Input3ImageRegionType
typename Input3ImageType::RegionType Input3ImageRegionType
Definition: itkTernaryFunctorImageFilter.h:72
itk::TernaryFunctorImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkTernaryFunctorImageFilter.h:96
itk::TernaryFunctorImageFilter::Input1ImageType
TInputImage1 Input1ImageType
Definition: itkTernaryFunctorImageFilter.h:62
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::TernaryFunctorImageFilter::Input3ImageType
TInputImage3 Input3ImageType
Definition: itkTernaryFunctorImageFilter.h:70
itk::TernaryFunctorImageFilter
Implements pixel-wise generic operation of three images.
Definition: itkTernaryFunctorImageFilter.h:43
FunctorType
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAddImageFilter.h:97
itk::TernaryFunctorImageFilter::Input3ImagePointer
typename Input3ImageType::ConstPointer Input3ImagePointer
Definition: itkTernaryFunctorImageFilter.h:71
itk::TernaryFunctorImageFilter::Input1ImagePointer
typename Input1ImageType::ConstPointer Input1ImagePointer
Definition: itkTernaryFunctorImageFilter.h:63
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::TernaryFunctorImageFilter::SetFunctor
void SetFunctor(const FunctorType &functor)
Definition: itkTernaryFunctorImageFilter.h:118
itkInPlaceImageFilter.h
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::TernaryFunctorImageFilter::Input1ImageRegionType
typename Input1ImageType::RegionType Input1ImageRegionType
Definition: itkTernaryFunctorImageFilter.h:64
itk::TernaryFunctorImageFilter::FunctorType
TFunction FunctorType
Definition: itkTernaryFunctorImageFilter.h:61
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90