ITK  6.0.0
Insight Toolkit
itkUnaryFrequencyDomainFilter.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 itkUnaryFrequencyDomainFilter_h
19#define itkUnaryFrequencyDomainFilter_h
20
23
24namespace itk
25{
60template <typename TImageType, typename TFrequencyIterator = FrequencyFFTLayoutImageRegionIteratorWithIndex<TImageType>>
61class ITK_TEMPLATE_EXPORT UnaryFrequencyDomainFilter : public InPlaceImageFilter<TImageType, TImageType>
62{
63public:
64 ITK_DISALLOW_COPY_AND_MOVE(UnaryFrequencyDomainFilter);
65
71
73 itkNewMacro(Self);
74
76 itkOverrideGetNameOfClassMacro(UnaryFrequencyDomainFilter);
77
79 using ImageType = TImageType;
83 using PixelType = typename TImageType::PixelType;
84
87
88 static constexpr unsigned int ImageDimension = TImageType::ImageDimension;
89
90#ifdef ITK_USE_CONCEPT_CHECKING
92#endif
93
95 using FrequencyIteratorType = TFrequencyIterator;
96 using FrequencyValueType = typename FrequencyIteratorType::FrequencyValueType;
97
103 itkSetMacro(ActualXDimensionIsOdd, bool);
104 itkGetConstReferenceMacro(ActualXDimensionIsOdd, bool);
105 itkBooleanMacro(ActualXDimensionIsOdd);
110
113
114#if !defined(ITK_WRAPPING_PARSER)
116 void
117 SetFunctor(const std::function<ConstRefFunctionType> & f)
118 {
119 auto inPlaceFunctor = [f](FrequencyIteratorType & freq) { freq.Value() *= f(freq); };
120
121 m_DynamicThreadedGenerateDataFunction = [this, inPlaceFunctor](const ImageRegionType & outputRegionForThread) {
122 return this->DynamicThreadedGenerateDataWithFunctor(inPlaceFunctor, outputRegionForThread);
123 };
124
125 this->Modified();
126 }
127
129 void
130 SetFunctor(const std::function<ValueFunctionType> & f)
131 {
132 m_DynamicThreadedGenerateDataFunction = [this, f](const ImageRegionType & outputRegionForThread) {
133 return this->DynamicThreadedGenerateDataWithFunctor(f, outputRegionForThread);
134 };
137 this->Modified();
138 }
139
140
142 void
144 {
145 auto inPlaceFunctor = [f](FrequencyIteratorType & freq) { freq.Value() *= f(freq); };
146
147 m_DynamicThreadedGenerateDataFunction = [this, inPlaceFunctor](const ImageRegionType & outputRegionForThread) {
148 return this->DynamicThreadedGenerateDataWithFunctor(inPlaceFunctor, outputRegionForThread);
149 };
150
151 this->Modified();
152 }
153
155 void
157 {
158 m_DynamicThreadedGenerateDataFunction = [this, funcPointer](const ImageRegionType & outputRegionForThread) {
159 return this->DynamicThreadedGenerateDataWithFunctor(funcPointer, outputRegionForThread);
160 };
163 this->Modified();
164 }
165
166
174 template <typename TFunctor>
175 void
176 SetFunctor(const TFunctor & functor)
177 {
178 m_DynamicThreadedGenerateDataFunction = [this, functor](const ImageRegionType & outputRegionForThread) {
179 return this->DynamicThreadedGenerateDataWithFunctor(functor, outputRegionForThread);
180 };
183 this->Modified();
184 }
185#endif // !defined( ITK_WRAPPING_PARSER )
186
187protected:
189 void
190 PrintSelf(std::ostream & os, Indent indent) const override;
191
201 template <typename TFunctor>
202 void
203 DynamicThreadedGenerateDataWithFunctor(const TFunctor &, const ImageRegionType & outputRegionForThread);
204 void
205 DynamicThreadedGenerateData(const ImageRegionType & outputRegionForThread) override;
208private:
209 std::function<void(const ImageRegionType &)> m_DynamicThreadedGenerateDataFunction{};
210
211 bool m_ActualXDimensionIsOdd{ false };
212};
213} // end namespace itk
214
215#ifndef ITK_MANUAL_INSTANTIATION
216# include "itkUnaryFrequencyDomainFilter.hxx"
217#endif
218
219#endif // itkUnaryFrequencyDomainFilter_h
Base class for filters that take an image as input and overwrite that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Performs a unary operation on a frequency domain image.
typename TImageType::RegionType ImageRegionType
void DynamicThreadedGenerateDataWithFunctor(const TFunctor &, const ImageRegionType &outputRegionForThread)
double(const FrequencyIteratorType &) ConstRefFunctionType
void SetFunctor(ValueFunctionType *funcPointer)
void DynamicThreadedGenerateData(const ImageRegionType &outputRegionForThread) override
void SetFunctor(ConstRefFunctionType *f)
typename TImageType::IndexType IndexType
typename ImageType::ConstPointer ImageConstPointer
void PrintSelf(std::ostream &os, Indent indent) const override
void SetFunctor(const TFunctor &functor)
void SetFunctor(const std::function< ValueFunctionType > &f)
void(FrequencyIteratorType &) ValueFunctionType
void SetFunctor(const std::function< ConstRefFunctionType > &f)
typename TImageType::PixelType PixelType
typename FrequencyIteratorType::FrequencyValueType FrequencyValueType
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....