Skip to content
Snippets Groups Projects
Commit 12ae4333 authored by Charles Peyrega's avatar Charles Peyrega
Browse files

ENH: Rename EuclideanDistance as EuclideanDistanceMetric

parent b643f1ca
No related branches found
No related tags found
No related merge requests found
Showing
with 63 additions and 63 deletions
......@@ -32,7 +32,7 @@ namespace otb {
* This is appropriated to perform simple outlier detection over vector data.
* The input image has to contain vector pixel through a VectorImage type.
* When an outlier is detected, it is treated to as an missing value through the function
* \code otb::EuclideanDistanceWithMissingValue::SetToMissingValue() \endcode.
* \code otb::EuclideanDistanceMetricWithMissingValue::SetToMissingValue() \endcode.
*
* A component is considered to as a missing value when
* \f$ \| x_i - \beta \left( x_{3/4} - x_{1/4} \right) \| > \| x_{1/2} \| \f$
......@@ -40,7 +40,7 @@ namespace otb {
* third quantile values.
*
* \ingroup Streamed
* \sa EuclideanDistanceWithMissingValue
* \sa EuclideanDistanceMetricWithMissingValue
*/
template <class TInputImage>
class ITK_EXPORT BoxAndWhiskerImageFilter
......
......@@ -30,7 +30,7 @@
#include "itkProgressReporter.h"
#include "otbBoxAndWhiskerImageFilter.h"
#include "otbEuclideanDistanceWithMissingValue.h"
#include "otbEuclideanDistanceMetricWithMissingValue.h"
namespace otb {
......@@ -105,7 +105,7 @@ BoxAndWhiskerImageFilter <TInputImage>
::PerformBoxAndWhiskerDetection(const PixelType& pixel)
{
typedef std::vector<ValueType> VectorType;
typedef otb::Statistics::EuclideanDistanceWithMissingValue<PixelType> OutlierType;
typedef otb::Statistics::EuclideanDistanceMetricWithMissingValue<PixelType> OutlierType;
unsigned int i;
const unsigned int vectorSize = pixel.Size();
......
......@@ -79,7 +79,7 @@ public:
itkSetMacro(DistanceThreshold, PrecisionType);
/** Method to compute the distance of a point to a segment */
double ComputeEuclideanDistanceToSegment(VertexType q1, VertexType q2, VertexType p) const;
double ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const;
protected:
DBOverlapDataNodeFeatureFunction();
......
......@@ -53,7 +53,7 @@ DBOverlapDataNodeFeatureFunction<TCoordRep, TPrecision>
template <class TCoordRep, class TPrecision>
double
DBOverlapDataNodeFeatureFunction<TCoordRep, TPrecision>
::ComputeEuclideanDistanceToSegment(VertexType q1, VertexType q2, VertexType p) const
::ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const
{
// Length of the segment
double l2 = q1.SquaredEuclideanDistanceTo(q2);
......@@ -102,7 +102,7 @@ DBOverlapDataNodeFeatureFunction<TCoordRep, TPrecision>
while (j<node.GetLine()->GetVertexList()->Size()-1)
{
double dist;
dist = this->ComputeEuclideanDistanceToSegment(node.GetLine()->GetVertexList()->GetElement(j),
dist = this->ComputeEuclideanDistanceMetricToSegment(node.GetLine()->GetVertexList()->GetElement(j),
node.GetLine()->GetVertexList()->GetElement(j+1),
currentGeometry->GetPolygonExteriorRing()->GetVertexList()->GetElement(i));
//std::cout << "dist: " << dist << std::endl;
......
......@@ -18,19 +18,19 @@
=========================================================================*/
#ifndef __otbEuclideanDistanceWithMissingValue_h
#define __otbEuclideanDistanceWithMissingValue_h
#ifndef __otbEuclideanDistanceMetricWithMissingValue_h
#define __otbEuclideanDistanceMetricWithMissingValue_h
#include "otbEuclideanDistanceWithMissingValuePow2.h"
#include "otbEuclideanDistanceMetricWithMissingValuePow2.h"
namespace otb {
namespace Statistics {
/** \class EuclideanDistanceWithMissingValue
/** \class EuclideanDistanceMetricWithMissingValue
* \brief Euclidean distance function facing missing value.
*
* This class is derived from EuclideanDistanceWithMissingValuePow2 class that handle the missing value
* This class is derived from EuclideanDistanceMetricWithMissingValuePow2 class that handle the missing value
* functonnalities. Here, the square root is included in the evaluation...
*
* The class can be templated over any container that holds data elements, as
......@@ -39,16 +39,16 @@ namespace Statistics {
* The only restriction is that elements have to support NaN values.
*
* \sa EuclideanDistanceMetric
* \sa EuclideanDistanceWithMissingValuePow2
* \sa EuclideanDistanceMetricWithMissingValuePow2
*/
template<class TVector>
class ITK_EXPORT EuclideanDistanceWithMissingValue :
public otb::Statistics::EuclideanDistanceWithMissingValuePow2<TVector>
class ITK_EXPORT EuclideanDistanceMetricWithMissingValue :
public otb::Statistics::EuclideanDistanceMetricWithMissingValuePow2<TVector>
{
public:
/** Standard "Self" typedef. */
typedef EuclideanDistanceWithMissingValue Self;
typedef otb::Statistics::EuclideanDistanceWithMissingValuePow2<TVector>
typedef EuclideanDistanceMetricWithMissingValue Self;
typedef otb::Statistics::EuclideanDistanceMetricWithMissingValuePow2<TVector>
Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -57,7 +57,7 @@ public:
MeasurementVectorSizeType;
/** Run-time type information (and related methods). */
itkTypeMacro(EuclideanDistanceWithMissingValue, EuclideanDistanceWithMissingValuePow2);
itkTypeMacro(EuclideanDistanceMetricWithMissingValue, EuclideanDistanceMetricWithMissingValuePow2);
/** Method for creation through the object factory. */
itkNewMacro(Self);
......@@ -92,8 +92,8 @@ public:
}
protected:
EuclideanDistanceWithMissingValue() {}
virtual ~EuclideanDistanceWithMissingValue() {}
EuclideanDistanceMetricWithMissingValue() {}
virtual ~EuclideanDistanceMetricWithMissingValue() {}
}; // end of class
} // end namespace statistics
......
......@@ -18,8 +18,8 @@
=========================================================================*/
#ifndef __otbEuclideanDistanceWithMissingValuePow2_h
#define __otbEuclideanDistanceWithMissingValuePow2_h
#ifndef __otbEuclideanDistanceMetricWithMissingValuePow2_h
#define __otbEuclideanDistanceMetricWithMissingValuePow2_h
#include "itkEuclideanDistanceMetric.h"
......@@ -27,7 +27,7 @@ namespace otb {
namespace Statistics {
/** \class EuclideanDistanceWithMissingValuePow2
/** \class EuclideanDistanceMetricWithMissingValuePow2
* \brief Euclidean comparison distance function facing missing value. The square root is not performed in this class.
*
* This class is derived from EuclideanDistanceMetric class. In addition
......@@ -41,22 +41,22 @@ namespace Statistics {
* The only restriction is that elements have to support NaN values.
*
* \sa EuclideanDistanceMetric
* \sa EuclideanDistanceWithMissingValue
* \sa EuclideanDistanceMetricWithMissingValue
*/
template<class TVector>
class ITK_EXPORT EuclideanDistanceWithMissingValuePow2 :
class ITK_EXPORT EuclideanDistanceMetricWithMissingValuePow2 :
public itk::Statistics::EuclideanDistanceMetric<TVector>
{
public:
/** Standard "Self" typedef. */
typedef EuclideanDistanceWithMissingValuePow2 Self;
typedef EuclideanDistanceMetricWithMissingValuePow2 Self;
typedef itk::Statistics::EuclideanDistanceMetric<TVector> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType;
/** Run-time type information (and related methods). */
itkTypeMacro(EuclideanDistanceWithMissingValuePow2, EuclideanDistanceMetric);
itkTypeMacro(EuclideanDistanceMetricWithMissingValuePow2, EuclideanDistanceMetric);
/** Method for creation through the object factory. */
itkNewMacro(Self);
......@@ -88,8 +88,8 @@ public:
static void SetToMissingValue(ValueType& v);
protected:
EuclideanDistanceWithMissingValuePow2() {}
virtual ~EuclideanDistanceWithMissingValuePow2() {}
EuclideanDistanceMetricWithMissingValuePow2() {}
virtual ~EuclideanDistanceMetricWithMissingValuePow2() {}
}; // end of class
} // end namespace statistics
......@@ -97,7 +97,7 @@ protected:
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbEuclideanDistanceWithMissingValuePow2.txx"
#include "otbEuclideanDistanceMetricWithMissingValuePow2.txx"
#endif
#endif
......@@ -18,8 +18,8 @@
=========================================================================*/
#ifndef __otbEuclideanDistanceWithMissingValuePow2_txx
#define __otbEuclideanDistanceWithMissingValuePow2_txx
#ifndef __otbEuclideanDistanceMetricWithMissingValuePow2_txx
#define __otbEuclideanDistanceMetricWithMissingValuePow2_txx
#include "itkNumericTraits.h"
#include "itkMeasurementVectorTraits.h"
......@@ -30,7 +30,7 @@ namespace Statistics {
template<class TVector>
inline double
EuclideanDistanceWithMissingValuePow2<TVector>
EuclideanDistanceMetricWithMissingValuePow2<TVector>
::Evaluate(const TVector& x1, const TVector& x2) const
{
if (itk::NumericTraits<TVector>::GetLength(x1) !=
......@@ -55,7 +55,7 @@ EuclideanDistanceWithMissingValuePow2<TVector>
template<class TVector>
inline double
EuclideanDistanceWithMissingValuePow2<TVector>
EuclideanDistanceMetricWithMissingValuePow2<TVector>
::Evaluate(const TVector& x) const
{
MeasurementVectorSizeType
......@@ -65,7 +65,7 @@ EuclideanDistanceWithMissingValuePow2<TVector>
itkExceptionMacro(<< "Please set the MeasurementVectorSize first");
}
itk::Statistics::MeasurementVectorTraits::Assert(this->GetOrigin(), measurementVectorSize,
"EuclideanDistance::Evaluate Origin and input vector have different lengths");
"EuclideanDistanceMetric::Evaluate Origin and input vector have different lengths");
double temp, distance = itk::NumericTraits<double>::Zero;
......@@ -83,7 +83,7 @@ EuclideanDistanceWithMissingValuePow2<TVector>
template<class TVector>
inline double
EuclideanDistanceWithMissingValuePow2<TVector>
EuclideanDistanceMetricWithMissingValuePow2<TVector>
::Evaluate(const ValueType& a, const ValueType& b) const
{
// FIXME throw NaN exception ??
......@@ -96,7 +96,7 @@ EuclideanDistanceWithMissingValuePow2<TVector>
template<class TVector>
/*static */
bool
EuclideanDistanceWithMissingValuePow2<TVector>
EuclideanDistanceMetricWithMissingValuePow2<TVector>
::IsMissingValue(const ValueType& v)
{
return static_cast<bool>(vnl_math_isnan(static_cast<double>(v)));
......@@ -105,7 +105,7 @@ EuclideanDistanceWithMissingValuePow2<TVector>
template<class TVector>
/* static */
void
EuclideanDistanceWithMissingValuePow2<TVector>
EuclideanDistanceMetricWithMissingValuePow2<TVector>
::SetToMissingValue(ValueType& v)
{
v = std::numeric_limits<ValueType>::signaling_NaN();
......
......@@ -21,7 +21,7 @@
#ifndef __otbFlexibleDistanceWithMissingValue_h
#define __otbFlexibleDistanceWithMissingValue_h
#include "otbEuclideanDistanceWithMissingValuePow2.h"
#include "otbEuclideanDistanceMetricWithMissingValuePow2.h"
namespace otb {
......@@ -30,7 +30,7 @@ namespace Statistics {
/** \class FlexibleDistanceWithMissingValue
* \brief Non-Euclidean distance function facing missing value.
*
* This class is derived from EuclideanDistanceWithMissingValuePow2 class to
* This class is derived from EuclideanDistanceMetricWithMissingValuePow2 class to
* deal with missing data. In addition, the initial Evaluate method performs
* a flexible calculation of distance when a component does contain data.
*
......@@ -44,23 +44,23 @@ namespace Statistics {
*
* The only restriction is that elements have to support \code NaN \endcode.
*
* \sa EuclideanDistanceWithMissingValuePow2
* \sa EuclideanDistanceMetricWithMissingValuePow2
*/
template<class TVector>
class ITK_EXPORT FlexibleDistanceWithMissingValue :
public otb::Statistics::EuclideanDistanceWithMissingValuePow2<TVector>
public otb::Statistics::EuclideanDistanceMetricWithMissingValuePow2<TVector>
{
public:
/** Standard "Self" typedef. */
typedef FlexibleDistanceWithMissingValue Self;
typedef otb::Statistics::EuclideanDistanceWithMissingValuePow2<TVector> Superclass;
typedef otb::Statistics::EuclideanDistanceMetricWithMissingValuePow2<TVector> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType;
/** Run-time type information (and related methods). */
itkTypeMacro(FlexibleDistanceWithMissingValue, EuclideanDistanceWithMissingValuePow2);
itkTypeMacro(FlexibleDistanceWithMissingValue, EuclideanDistanceMetricWithMissingValuePow2);
/** Method for creation through the object factory. */
itkNewMacro(Self);
......
......@@ -70,7 +70,7 @@ FlexibleDistanceWithMissingValue<TVector>
}
itk::Statistics::MeasurementVectorTraits::Assert(this->GetOrigin(), measurementVectorSize,
"EuclideanDistance::Evaluate Origin and input vector have different lengths");
"EuclideanDistanceMetric::Evaluate Origin and input vector have different lengths");
double temp, distance = itk::NumericTraits<double>::Zero;
......
......@@ -263,9 +263,9 @@ public:
std::vector<std::string> GetFieldList() const;
/** \return the distance to a point */
double EuclideanDistance(const DataNode* node);
double EuclideanDistanceMetric(const DataNode* node);
double EuclideanDistance(const PointType point);
double EuclideanDistanceMetric(const PointType point);
/**
* \return true if the two datanodes intersects
......
......@@ -609,7 +609,7 @@ DataNode<TPrecision, VDimension, TValuePrecision>
template <class TPrecision, unsigned int VDimension, class TValuePrecision>
double
DataNode<TPrecision, VDimension, TValuePrecision>
::EuclideanDistance(const DataNode* node)
::EuclideanDistanceMetric(const DataNode* node)
{
// Convert the nodes to OGRGeometries
OGRGeometry * dstGeomtery = this->ConvertDataNodeToOGRGeometry(node);
......@@ -622,7 +622,7 @@ DataNode<TPrecision, VDimension, TValuePrecision>
template <class TPrecision, unsigned int VDimension, class TValuePrecision>
double
DataNode<TPrecision, VDimension, TValuePrecision>
::EuclideanDistance(const PointType point)
::EuclideanDistanceMetric(const PointType point)
{
// Convert Point to point to ogrPoint
OGRPoint ogrPointSrc;
......
......@@ -103,7 +103,7 @@ protected:
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
/** */
virtual double ComputeEuclideanDistanceToSegment(VertexType q1, VertexType q2, VertexType p) const;
virtual double ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const;
/** */
......
......@@ -58,8 +58,8 @@ Rectangle<TValue>
corner[1] = middleP[1] - (m_Width / 2) * vcl_cos(m_Orientation);
/** Compute the distance to the orthogonal median of the rectangle*/
if (this->ComputeEuclideanDistanceToSegment(p1, p2, point) - (m_Width / 2.) < 1e-10
&& this->ComputeEuclideanDistanceToSegment(middleP, corner, point) - (lengthSeg / 2.) < 1e-10) return true;
if (this->ComputeEuclideanDistanceMetricToSegment(p1, p2, point) - (m_Width / 2.) < 1e-10
&& this->ComputeEuclideanDistanceMetricToSegment(middleP, corner, point) - (lengthSeg / 2.) < 1e-10) return true;
else return false;
}
......@@ -69,7 +69,7 @@ Rectangle<TValue>
template<class TValue>
double
Rectangle<TValue>
::ComputeEuclideanDistanceToSegment(VertexType q1, VertexType q2, VertexType p) const
::ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const
{
double Xq1 = q1[0];
double Yq1 = q1[1];
......
......@@ -56,7 +56,7 @@ NNearestPointsLinearInterpolateDisplacementFieldGenerator<TPointSet, TDisplaceme
PointType point;
point[0] = static_cast<double>(this->GetPointSet()->GetPoints()->GetElement(*indexIt)[0]);
point[1] = static_cast<double>(this->GetPointSet()->GetPoints()->GetElement(*indexIt)[1]);
double distance = this->EuclideanDistance(index, point);
double distance = this->EuclideanDistanceMetric(index, point);
if (distance < EPSILON)
{
distance = EPSILON;
......
......@@ -56,7 +56,7 @@ NNearestTransformsLinearInterpolateDisplacementFieldGenerator<TPointSet, TDispla
PointType point;
point[0] = static_cast<double>(this->GetPointSet()->GetPoints()->GetElement(*indexIt)[0]);
point[1] = static_cast<double>(this->GetPointSet()->GetPoints()->GetElement(*indexIt)[1]);
double distance = this->EuclideanDistance(index, point);
double distance = this->EuclideanDistanceMetric(index, point);
if (distance < EPSILON)
{
distance = EPSILON;
......
......@@ -132,7 +132,7 @@ protected:
IndexVectorType GenerateNearestValidPointsPointSet(IndexType index, unsigned int n = 1);
/** Euclidean distance of point to index */
double EuclideanDistance(IndexType index, PointType p);
double EuclideanDistanceMetric(IndexType index, PointType p);
private:
PointSetToDisplacementFieldGenerator(const Self &); //purposely not implemented
......
......@@ -108,7 +108,7 @@ PointSetToDisplacementFieldGenerator<TPointSet, TDisplacementField>
if (vcl_abs(this->GetPointSet()->GetPointData()->GetElement(j)[0]) >= m_MetricThreshold)
{
distanceVector.push_back(EuclideanDistance(index, p));
distanceVector.push_back(EuclideanDistanceMetric(index, p));
sortVector.push_back(i);
indexVector.push_back(j);
++i;
......@@ -133,7 +133,7 @@ PointSetToDisplacementFieldGenerator<TPointSet, TDisplacementField>
template <class TPointSet, class TDisplacementField>
double
PointSetToDisplacementFieldGenerator<TPointSet, TDisplacementField>
::EuclideanDistance(IndexType index, PointType p)
::EuclideanDistanceMetric(IndexType index, PointType p)
{
PointType pprime;
// our point are expressed in index and not in physical coordinates
......
......@@ -29,16 +29,16 @@ namespace otb
* \brief This class implements SOM training with missing value
*
* The distance between vectors that may have missing components is holded
* by the EuclideanDistanceWithMissingValue class in the SOMMap distance
* by the EuclideanDistanceMetricWithMissingValue class in the SOMMap distance
* template. Nevertheless, this class re-implements the UpdateMap method to
* adapt the evaluation of each component of the 'newNeuron' when dealing
* with missing values.
*
* TMap has to be templeted with EuclideanDistanceWithMissingValuePow2
* TMap has to be templeted with EuclideanDistanceMetricWithMissingValuePow2
*
* \sa SOMMap
* \sa PeriodicSOM
* \sa EuclideanDistanceWithMissingValue
* \sa EuclideanDistanceMetricWithMissingValue
*/
template <class TListSample, class TMap,
class TSOMLearningBehaviorFunctor = Functor::CzihoSOMLearningBehaviorFunctor,
......
......@@ -92,7 +92,7 @@ private:
* TMap is a template for the SOM that can be a simple VectorImage.
*
* \ingroup Streamed
* \sa EuclideanDistanceWithMissingValue
* \sa EuclideanDistanceMetricWithMissingValue
*/
template <class TInputImage, class TOutputImage,
class TDistanceMetric, class TMap>
......
......@@ -72,7 +72,7 @@ public:
typedef itk::PreOrderTreeIterator<typename VectorDataType::DataTreeType> TreeIteratorType;
typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
typedef itk::Statistics::EuclideanDistanceMetric<PointType> EuclideanDistanceType;
typedef itk::Statistics::EuclideanDistanceMetric<PointType> EuclideanDistanceMetricType;
/** Connects the VectorDatas from which the localizations are going to be extracted. */
void PushBackInput(const VectorDataType *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment