ITK  6.0.0
Insight Toolkit
itkNaryFunctorImageFilter.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 itkNaryFunctorImageFilter_h
19#define itkNaryFunctorImageFilter_h
20
22#include "itkImageIterator.h"
23#include "itkArray.h"
24
25namespace itk
26{
41template <typename TInputImage, typename TOutputImage, typename TFunction>
42class ITK_TEMPLATE_EXPORT NaryFunctorImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
43
44{
45public:
46 ITK_DISALLOW_COPY_AND_MOVE(NaryFunctorImageFilter);
47
53
55 itkNewMacro(Self);
56
58 itkOverrideGetNameOfClassMacro(NaryFunctorImageFilter);
59
61 using FunctorType = TFunction;
62 using InputImageType = TInputImage;
65 using InputImagePixelType = typename InputImageType::PixelType;
66 using OutputImageType = TOutputImage;
69 using OutputImagePixelType = typename OutputImageType::PixelType;
70 using NaryArrayType = std::vector<InputImagePixelType>;
71
78 {
79 return m_Functor;
80 }
81
88 void
90 {
91 if (m_Functor != functor)
92 {
93 m_Functor = functor;
94 this->Modified();
95 }
96 }
100 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
101 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
102
103#ifdef ITK_USE_CONCEPT_CHECKING
104 // Begin concept checking
107 // End concept checking
108#endif
109
110protected:
112 ~NaryFunctorImageFilter() override = default;
113
124 void
125 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
126
127
128private:
129 FunctorType m_Functor{};
130};
131} // end namespace itk
132
133#ifndef ITK_MANUAL_INSTANTIATION
134# include "itkNaryFunctorImageFilter.hxx"
135#endif
136
137#endif
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
typename InputImageType::Pointer InputImagePointer
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and overwrite that image as the output.
Perform a generic pixel-wise operation on N images.
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void SetFunctor(FunctorType &functor)
std::vector< InputImagePixelType > NaryArrayType
~NaryFunctorImageFilter() override=default
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....