21 #ifndef otbCompacityPathFunction_hxx
22 #define otbCompacityPathFunction_hxx
25 #include "itkNumericTraits.h"
32 template <
class TInputPath,
class TOutput>
35 this->Superclass::PrintSelf(os, indent);
38 template <
class TInputPath,
class TOutput>
49 vertexList = path.GetVertexList();
50 nbPath = vertexList->Size();
54 for (
int i = 0; i < nbPath; ++i)
56 cindex = vertexList->GetElement(i);
60 if (i == (nbPath - 1))
62 cindex = vertexList->GetElement(0);
66 cindex = vertexList->GetElement(i + 1);
73 Norm = std::sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
85 itkExceptionMacro(<<
"CompacityPathFunction::Evaluate() FAILED -- path must contains at least 3 points");
89 Compacity = Surface / (Perimeter * Perimeter);
90 Compacity *= (4. * acos(-1.0));
95 template <
class TInputPath,
class TOutput>
98 if (!this->GetInputPath())
101 return static_cast<OutputType>(itk::NumericTraits<OutputType>::max());
104 OutputType Result = Evaluate(*(this->GetInputPath()));
VertexListType::ConstPointer VertexListPointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Superclass::InputPathType PathType
PathType::ContinuousIndexType VertexType
virtual OutputType Evaluate() const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
#define otbMsgDevMacro(x)