21 #ifndef otbComplexMomentPathFunction_hxx
22 #define otbComplexMomentPathFunction_hxx
25 #include "itkImageRegionIterator.h"
26 #include "itkConstNeighborhoodIterator.h"
36 template <
class TInputPath,
class TOutput,
class TPrecision>
46 template <
class TInputPath,
class TOutput,
class TPrecision>
49 this->Superclass::PrintSelf(os, indent);
50 os << indent <<
" p indice value : " << m_P << std::endl;
51 os << indent <<
" q indice value : " << m_Q << std::endl;
55 template <
class TInputPath,
class TOutput,
class TPrecision>
83 template <
class TInputPath,
class TOutput,
class TPrecision>
90 unsigned int pathSize = vertexList->Size();
103 typename VertexListType::ConstIterator it = vertexList->Begin();
108 while (it != vertexList->End())
110 centroid[0] += it.Value()[0];
111 centroid[1] += it.Value()[1];
120 it = vertexList->Begin();
123 source[0] -= centroid[0];
124 source[1] -= centroid[1];
133 while (it != vertexList->End())
138 dest[0] -= centroid[0];
139 dest[1] -= centroid[1];
142 ds = std::sqrt(std::pow(dest[0] - source[0], 2.) + std::pow(dest[1] - source[1], 2.));
144 value += ds * EvaluateComplexMomentAtIndex(source);
149 dest = vertexList->Begin().Value();
150 dest[0] -= centroid[0];
151 dest[1] -= centroid[1];
152 ds = std::sqrt(std::pow(dest[0] - source[0], 2.) + std::pow(dest[1] - source[1], 2.));
154 value += EvaluateComplexMomentAtIndex(source) * ds;
163 template <
class TInputPath,
class TOutput,
class TPrecision>
166 if (!this->GetInputPath())
172 OutputType Result = Evaluate(*(this->GetInputPath()));