ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBinaryFunctorImageFilter.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 itkBinaryFunctorImageFilter_h
19#define itkBinaryFunctorImageFilter_h
20
23
24namespace itk
25{
52template <typename TInputImage1, typename TInputImage2, typename TOutputImage, typename TFunction>
53class ITK_TEMPLATE_EXPORT BinaryFunctorImageFilter : public InPlaceImageFilter<TInputImage1, TOutputImage>
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(BinaryFunctorImageFilter);
57
63
65 itkNewMacro(Self);
66
68 itkOverrideGetNameOfClassMacro(BinaryFunctorImageFilter);
69
71 using FunctorType = TFunction;
72 using Input1ImageType = TInputImage1;
73 using Input1ImagePointer = typename Input1ImageType::ConstPointer;
74 using Input1ImageRegionType = typename Input1ImageType::RegionType;
75 using Input1ImagePixelType = typename Input1ImageType::PixelType;
77
78 using Input2ImageType = TInputImage2;
79 using Input2ImagePointer = typename Input2ImageType::ConstPointer;
80 using Input2ImageRegionType = typename Input2ImageType::RegionType;
81 using Input2ImagePixelType = typename Input2ImageType::PixelType;
83
84 using OutputImageType = TOutputImage;
85 using OutputImagePointer = typename OutputImageType::Pointer;
86 using OutputImageRegionType = typename OutputImageType::RegionType;
87 using OutputImagePixelType = typename OutputImageType::PixelType;
88
90 virtual void
91 SetInput1(const TInputImage1 * image1);
92 virtual void
94 virtual void
97
99 virtual void
101
104 virtual const Input1ImagePixelType &
106
108 virtual void
109 SetInput2(const TInputImage2 * image2);
110 virtual void
112 virtual void
115
117 virtual void
119 void
121 {
122 this->SetConstant2(ct);
123 }
124 const Input2ImagePixelType &
126 {
127 return this->GetConstant2();
128 }
129
130
133 virtual const Input2ImagePixelType &
135
142 {
143 return m_Functor;
144 }
145
150 const FunctorType &
152 {
153 return m_Functor;
154 }
155
162 void
163 SetFunctor(const FunctorType & functor)
164 {
165 if (m_Functor != functor)
166 {
167 m_Functor = functor;
168 this->Modified();
169 }
170 }
171
172
174 static constexpr unsigned int InputImage1Dimension = TInputImage1::ImageDimension;
175 static constexpr unsigned int InputImage2Dimension = TInputImage2::ImageDimension;
176 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
177
178 itkConceptMacro(SameDimensionCheck1,
180 itkConceptMacro(SameDimensionCheck2,
182
183protected:
185 ~BinaryFunctorImageFilter() override = default;
186
197 void
198 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
199
200
201 // Needed to take the image information from the 2nd input, if the first one is
202 // a simple decorated object.
203 void
205
206private:
208};
209} // end namespace itk
210
211#ifndef ITK_MANUAL_INSTANTIATION
212# include "itkBinaryFunctorImageFilter.hxx"
213#endif
214
215#endif
SimpleDataObjectDecorator< Input1ImagePixelType > DecoratedInput1ImagePixelType
virtual void SetInput1(const Input1ImagePixelType &input1)
InPlaceImageFilter< TInputImage1, TOutputImage > Superclass
typename OutputImageType::Pointer OutputImagePointer
typename OutputImageType::PixelType OutputImagePixelType
virtual void SetConstant1(const Input1ImagePixelType &input1)
const Input2ImagePixelType & GetConstant() const
virtual void SetInput1(const TInputImage1 *image1)
~BinaryFunctorImageFilter() override=default
typename Input1ImageType::RegionType Input1ImageRegionType
virtual void SetInput2(const TInputImage2 *image2)
virtual void SetInput1(const DecoratedInput1ImagePixelType *input1)
typename OutputImageType::RegionType OutputImageRegionType
typename Input1ImageType::ConstPointer Input1ImagePointer
virtual void SetConstant2(const Input2ImagePixelType &input2)
virtual const Input1ImagePixelType & GetConstant1() const
typename Input1ImageType::PixelType Input1ImagePixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
typename Input2ImageType::ConstPointer Input2ImagePointer
static constexpr unsigned int InputImage2Dimension
virtual void SetInput2(const DecoratedInput2ImagePixelType *input2)
typename Input2ImageType::RegionType Input2ImageRegionType
virtual void SetInput2(const Input2ImagePixelType &input2)
void GenerateOutputInformation() override
virtual const Input2ImagePixelType & GetConstant2() const
void SetConstant(Input2ImagePixelType ct)
SimpleDataObjectDecorator< Input2ImagePixelType > DecoratedInput2ImagePixelType
typename Input2ImageType::PixelType Input2ImagePixelType
SmartPointer< const Self > ConstPointer
static constexpr unsigned int InputImage1Dimension
static constexpr unsigned int OutputImageDimension
void SetFunctor(const FunctorType &functor)
virtual void Modified() const
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Implements transparent reference counting.
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....