21 #ifndef otbHuPathFunction_hxx
22 #define otbHuPathFunction_hxx
26 #include "itkNumericTraits.h"
36 template <
class TInputPath,
class TOutput,
class TPrecision>
45 template <
class TInputPath,
class TOutput,
class TPrecision>
48 this->Superclass::PrintSelf(os, indent);
49 os << indent <<
" m_MomentNumber : " << m_MomentNumber << std::endl;
53 template <
class TInputPath,
class TOutput,
class TPrecision>
58 typedef typename FunctionType::ComplexType ComplexType;
61 ComplexType HuValueComplex;
63 typename FunctionType::Pointer
function = FunctionType::New();
65 function->SetInputPath(this->GetInputPath());
67 switch (m_MomentNumber)
74 C11 =
function->Evaluate();
83 C20 =
function->Evaluate();
86 C02 =
function->Evaluate();
88 HuValue = std::abs(C20 * C02);
96 C30 =
function->Evaluate();
99 C03 =
function->Evaluate();
101 HuValue = std::abs(C30 * C03);
106 ComplexType C21, C12;
109 C21 =
function->Evaluate();
112 C12 =
function->Evaluate();
114 HuValue = std::abs(C21 * C12);
120 ComplexType C30, C12;
123 C30 =
function->Evaluate();
126 C12 =
function->Evaluate();
128 HuValueComplex = C30 * std::pow(C12, 3);
129 HuValue = HuValueComplex.real();
135 ComplexType C20, C12;
138 C20 =
function->Evaluate();
141 C12 =
function->Evaluate();
143 HuValueComplex = C20 * std::pow(C12, 2);
144 HuValue = HuValueComplex.real();
150 ComplexType C30, C12;
153 C30 =
function->Evaluate();
156 C12 =
function->Evaluate();
158 HuValueComplex = C30 * std::pow(C12, 3);
159 HuValue = HuValueComplex.imag();
164 itkWarningMacro(
"Hu's invariant parameters are between 1 and 7");
167 return (
static_cast<RealType>(HuValue));
170 template <
class TInputPath,
class TOutput,
class TPrecision>
173 if (!this->GetInputPath())
176 return static_cast<RealType>(itk::NumericTraits<PrecisionType>::max());
179 RealType Result = Evaluate(*(this->GetInputPath()));