18 #ifndef __otbHuPathFunction_txx
19 #define __otbHuPathFunction_txx
23 #include "itkNumericTraits.h"
33 template <
class TInputPath,
class TOutput,
class TPrecision>
43 template <
class TInputPath,
class TOutput,
class TPrecision>
48 this->Superclass::PrintSelf(os, indent);
49 os << indent <<
" m_MomentNumber : " << m_MomentNumber << std::endl;
52 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 = vcl_abs(C20 * C02);
97 C30 =
function->Evaluate();
100 C03 =
function->Evaluate();
102 HuValue = vcl_abs(C30 * C03);
107 ComplexType C21, C12;
110 C21 =
function->Evaluate();
113 C12 =
function->Evaluate();
115 HuValue = vcl_abs(C21 * C12);
121 ComplexType C30, C12;
124 C30 =
function->Evaluate();
127 C12 =
function->Evaluate();
129 HuValueComplex = C30 * vcl_pow(C12, 3);
130 HuValue = HuValueComplex.real();
136 ComplexType C20, C12;
139 C20 =
function->Evaluate();
142 C12 =
function->Evaluate();
144 HuValueComplex = C20 * vcl_pow(C12, 2);
145 HuValue = HuValueComplex.real();
151 ComplexType C30, C12;
154 C30 =
function->Evaluate();
157 C12 =
function->Evaluate();
159 HuValueComplex = C30 * vcl_pow(C12, 3);
160 HuValue = HuValueComplex.imag();
165 itkWarningMacro(
"Hu's invariant parameters are between 1 and 7");
168 return (static_cast<RealType>(HuValue));
172 template <
class TInputPath,
class TOutput,
class TPrecision>
177 if (!this->GetInputPath())
180 return static_cast<RealType>(itk::NumericTraits<PrecisionType>::max());
183 RealType Result = Evaluate(*(this->GetInputPath()));