21 #ifndef otbFlusserPathFunction_hxx
22 #define otbFlusserPathFunction_hxx
26 #include "itkNumericTraits.h"
35 template <
class TInputPath,
class TOutput,
class TPrecision>
44 template <
class TInputPath,
class TOutput,
class TPrecision>
47 this->Superclass::PrintSelf(os, indent);
48 os << indent <<
" m_MomentNumber : " << m_MomentNumber << std::endl;
52 template <
class TInputPath,
class TOutput,
class TPrecision>
57 typedef typename FunctionType::ComplexType ComplexType;
59 RealType FlusserValue(itk::NumericTraits<RealType>::Zero);
60 ComplexType FlusserValueComplex(itk::NumericTraits<ComplexType>::Zero);
62 typename FunctionType::Pointer
function = FunctionType::New();
64 function->SetInputPath(this->GetInputPath());
66 switch (m_MomentNumber)
73 C11 =
function->Evaluate();
74 FlusserValue = C11.real();
82 C21 =
function->Evaluate();
85 C12 =
function->Evaluate();
87 FlusserValue = std::abs(C21 * C12);
95 C20 =
function->Evaluate();
98 C12 =
function->Evaluate();
99 FlusserValueComplex = C20 * std::pow(C12, 2);
100 FlusserValue = FlusserValueComplex.real();
105 ComplexType C20, C12;
108 C20 =
function->Evaluate();
111 C12 =
function->Evaluate();
112 FlusserValueComplex = C20 * std::pow(C12, 2);
113 FlusserValue = FlusserValueComplex.imag();
118 ComplexType C30, C12;
121 C30 =
function->Evaluate();
124 C12 =
function->Evaluate();
126 FlusserValueComplex = C30 * std::pow(C12, 3);
127 FlusserValue = FlusserValueComplex.real();
132 ComplexType C30, C12;
135 C30 =
function->Evaluate();
138 C12 =
function->Evaluate();
140 FlusserValueComplex = C30 * std::pow(C12, 3);
141 FlusserValue = FlusserValueComplex.imag();
149 C22 =
function->Evaluate();
150 FlusserValue = C22.real();
155 ComplexType C31, C12;
158 C31 =
function->Evaluate();
161 C12 =
function->Evaluate();
162 FlusserValueComplex = C31 * std::pow(C12, 2);
163 FlusserValue = FlusserValueComplex.real();
168 ComplexType C31, C12;
171 C31 =
function->Evaluate();
174 C12 =
function->Evaluate();
175 FlusserValueComplex = C31 * std::pow(C12, 2);
176 FlusserValue = FlusserValueComplex.imag();
181 ComplexType C40, C12;
184 C40 =
function->Evaluate();
187 C12 =
function->Evaluate();
188 FlusserValueComplex = C40 * std::pow(C12, 4);
189 FlusserValue = FlusserValueComplex.real();
194 ComplexType C40, C12;
197 C40 =
function->Evaluate();
200 C12 =
function->Evaluate();
201 FlusserValueComplex = C40 * std::pow(C12, 4);
202 FlusserValue = FlusserValueComplex.imag();
207 itkWarningMacro(
"Flusser's invariant parameters are between 1 and 11");
210 return (
static_cast<RealType>(FlusserValue));
213 template <
class TInputPath,
class TOutput,
class TPrecision>
216 if (!this->GetInputPath())
219 return static_cast<RealType>(itk::NumericTraits<PrecisionType>::max());
222 RealType Result = Evaluate(*(this->GetInputPath()));