ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkRieszFrequencyFunction.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 itkRieszFrequencyFunction_h
19#define itkRieszFrequencyFunction_h
20
22#include <set>
23#include <complex>
24#include <numeric>
25#include <functional>
26#include "itkRieszUtilities.h"
27
28namespace itk
29{
36template <typename TFunctionValue = std::complex<double>,
37 unsigned int VImageDimension = 3,
38 typename TInput = Vector<SpacePrecisionType, VImageDimension>>
39class RieszFrequencyFunction : public FrequencyFunction<TFunctionValue, VImageDimension, TInput>
40{
41public:
42 ITK_DISALLOW_COPY_AND_MOVE(RieszFrequencyFunction);
43
49
51 itkNewMacro(Self);
52
54 itkOverrideGetNameOfClassMacro(RieszFrequencyFunction);
55
58
62
67 using IndicesArrayType = std::vector<unsigned int>;
68 using OutputComponentsType = std::vector<OutputComplexType>;
69 using SetType = std::set<IndicesArrayType, std::greater<IndicesArrayType>>;
71
80 static unsigned int
81 ComputeNumberOfComponents(const unsigned int & order)
82 {
83 return itk::utils::ComputeNumberOfComponents(order, VImageDimension);
84 }
85
94 static void
95 ComputeUniqueIndices(IndicesArrayType subIndex, SetType & uniqueIndices, unsigned int init = 0)
96 {
98 }
99
103 static SetType
104 ComputeAllPermutations(const SetType & uniqueIndices)
105 {
107 }
108
112 static SetType
117
120 Evaluate(const TInput &) const override
121 {
122 itkExceptionMacro("Evaluate(TInput&) is not valid for RieszFrequencyFunction."
123 "Use EvaluateWithIndices(point, indices) or EvaluateAllComponents(point)");
124 };
125
137 virtual OutputComplexType
138 EvaluateWithIndices(const TInput & frequency_point, const IndicesArrayType & indices);
139
150 EvaluateAllComponents(const TInput & frequency_point) const;
151
161
163 double
164 Magnitude(const TInput & point) const
165 {
166 return sqrt(std::inner_product(point.Begin(), point.End(), point.Begin(), 0.0));
167 }
168
170 static long
171 Factorial(long n)
172 {
173 return itk::utils::Factorial(n);
174 }
175
177 virtual void
178 SetOrder(const unsigned int inputOrder)
179 {
180 // Precondition
181 if (inputOrder < 1)
182 {
183 itkExceptionMacro(<< "Error: inputOrder = " << inputOrder << ". It has to be greater than 0.");
184 }
185
186 if (this->m_Order != inputOrder)
187 {
188 this->m_Order = inputOrder;
189 // Calculate all the possible indices.
191 this->Modified();
192 }
193 }
194 itkGetConstReferenceMacro(Order, unsigned int);
195
198 itkGetConstReferenceMacro(Indices, SetType);
199
201
202protected:
205 void
206 PrintSelf(std::ostream & os, Indent indent) const override;
207
208private:
209 unsigned int m_Order{ 0 };
211};
212} // end namespace itk
213
214#ifndef ITK_MANUAL_INSTANTIATION
215# include "itkRieszFrequencyFunction.hxx"
216#endif
217
218#endif
Simulate a standard C array with copy semantics.
typename Superclass::InputType InputType
typename Superclass::OutputType OutputType
Control indentation during Print() invocation.
Definition itkIndent.h:53
virtual void Modified() const
static void ComputeUniqueIndices(IndicesArrayType subIndex, SetType &uniqueIndices, unsigned int init=0)
std::set< IndicesArrayType, std::greater< IndicesArrayType > > SetType
FrequencyFunction< typename InputImageType::PixelType, VImageDimension, Vector< SpacePrecisionType, VImageDimension > > Superclass
static unsigned int ComputeNumberOfComponents(const unsigned int &order)
FunctionValueType Evaluate(const TInput &) const override
virtual void SetOrder(const unsigned int inputOrder)
virtual OutputComplexType EvaluateWithIndices(const TInput &frequency_point, const IndicesArrayType &indices)
virtual OutputComponentsType EvaluateAllComponents(const TInput &frequency_point) const
OutputComplexType ComputeNormalizingFactor(const IndicesArrayType &indices) const
static SetType ComputeAllPermutations(const SetType &uniqueIndices)
static long Factorial(long n)
Factorial.
static SetType ComputeAllPossibleIndices(const unsigned int &order)
void PrintSelf(std::ostream &os, Indent indent) const override
double Magnitude(const TInput &point) const
Implements transparent reference counting.
#define itkConceptMacro(name, conceptType)
Compile-time check that a template argument satisfies an itk::Concept.
IsotropicWavelets_EXPORT long Factorial(long n)
Factorial.
IsotropicWavelets_EXPORT unsigned int ComputeNumberOfComponents(const unsigned int &order, const unsigned int &dimension)
ITK_TEMPLATE_EXPORT std::set< TIndicesArrayType, std::greater< TIndicesArrayType > > ComputeAllPossibleIndices(const unsigned int &order)
ITK_TEMPLATE_EXPORT void ComputeUniqueIndices(TIndicesArrayType subIndex, std::set< TIndicesArrayType, std::greater< TIndicesArrayType > > &uniqueIndices, unsigned int init=0)
ITK_TEMPLATE_EXPORT std::set< TIndicesArrayType, std::greater< TIndicesArrayType > > ComputeAllPermutations(const std::set< TIndicesArrayType, std::greater< TIndicesArrayType > > &uniqueIndices)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....