ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkUnaryGeneratorImageFilter.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 itkUnaryGeneratorImageFilter_h
19#define itkUnaryGeneratorImageFilter_h
20
21#include "itkMath.h"
23
24#include <functional>
25
26namespace itk
27{
28
53template <typename TInputImage, typename TOutputImage>
54class ITK_TEMPLATE_EXPORT UnaryGeneratorImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
55{
56public:
57 ITK_DISALLOW_COPY_AND_MOVE(UnaryGeneratorImageFilter);
58
64
66 itkNewMacro(Self);
67
69 itkOverrideGetNameOfClassMacro(UnaryGeneratorImageFilter);
70
71 using InputImageType = TInputImage;
72 using InputImagePointer = typename InputImageType::ConstPointer;
73 using InputImageRegionType = typename InputImageType::RegionType;
74 using InputImagePixelType = typename InputImageType::PixelType;
75
76 using OutputImageType = TOutputImage;
77 using OutputImagePointer = typename OutputImageType::Pointer;
78 using OutputImageRegionType = typename OutputImageType::RegionType;
79 using OutputImagePixelType = typename OutputImageType::PixelType;
80
83
84
85#if !defined(ITK_WRAPPING_PARSER)
91 void
92 SetFunctor(const std::function<ConstRefFunctionType> & f)
93 {
94 m_DynamicThreadedGenerateDataFunction = [this, f](const OutputImageRegionType & outputRegionForThread) {
95 return this->DynamicThreadedGenerateDataWithFunctor(f, outputRegionForThread);
96 };
97
98 this->Modified();
99 }
100 void
101 SetFunctor(const std::function<ValueFunctionType> & f)
102 {
103 m_DynamicThreadedGenerateDataFunction = [this, f](const OutputImageRegionType & outputRegionForThread) {
104 return this->DynamicThreadedGenerateDataWithFunctor(f, outputRegionForThread);
105 };
106
107 this->Modified();
108 }
109
110
111
117 void
119 {
120 m_DynamicThreadedGenerateDataFunction = [this, funcPointer](const OutputImageRegionType & outputRegionForThread) {
121 return this->DynamicThreadedGenerateDataWithFunctor(funcPointer, outputRegionForThread);
122 };
123
124 this->Modified();
125 }
126 void
128 {
129 m_DynamicThreadedGenerateDataFunction = [this, funcPointer](const OutputImageRegionType & outputRegionForThread) {
130 return this->DynamicThreadedGenerateDataWithFunctor(funcPointer, outputRegionForThread);
131 };
132
133 this->Modified();
134 }
135
136
137
145 template <typename TFunctor>
146 void
147 SetFunctor(const TFunctor & functor)
148 {
149 m_DynamicThreadedGenerateDataFunction = [this, functor](const OutputImageRegionType & outputRegionForThread) {
150 return this->DynamicThreadedGenerateDataWithFunctor(functor, outputRegionForThread);
151 };
152
153 this->Modified();
154 }
155#endif // !defined( ITK_WRAPPING_PARSER )
156
157protected:
159 ~UnaryGeneratorImageFilter() override = default;
160
170 void
172
173
184 template <typename TFunctor>
185 void
186 DynamicThreadedGenerateDataWithFunctor(const TFunctor &, const OutputImageRegionType & outputRegionForThread);
187 void
188 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
190private:
192};
193} // end namespace itk
194
195#ifndef ITK_MANUAL_INSTANTIATION
196# include "itkUnaryGeneratorImageFilter.hxx"
197#endif
198
199#endif
virtual void Modified() const
Implements transparent reference counting.
OutputImagePixelType(InputImagePixelType) ValueFunctionType
void SetFunctor(const TFunctor &functor)
~UnaryGeneratorImageFilter() override=default
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::ConstPointer InputImagePointer
void SetFunctor(ConstRefFunctionType *funcPointer)
typename OutputImageType::Pointer OutputImagePointer
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
OutputImagePixelType(const InputImagePixelType &) ConstRefFunctionType
void GenerateOutputInformation() override
void SetFunctor(ValueFunctionType *funcPointer)
void SetFunctor(const std::function< ConstRefFunctionType > &f)
typename InputImageType::RegionType InputImageRegionType
InPlaceImageFilter< TInputImage, TOutputImage > Superclass
std::function< void(const OutputImageRegionType &)> m_DynamicThreadedGenerateDataFunction
void SetFunctor(const std::function< ValueFunctionType > &f)
void DynamicThreadedGenerateDataWithFunctor(const TFunctor &, const OutputImageRegionType &outputRegionForThread)
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....