ITK  6.0.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
itk::Point< TCoordinate, VPointDimension > Class Template Reference

#include <itkPoint.h>

Detailed Description

template<typename TCoordinate, unsigned int VPointDimension = 3>
class itk::Point< TCoordinate, VPointDimension >

A templated class holding a geometric point in n-Dimensional space.

Point is a templated class that holds a set of coordinates (components). Point can be used as the data type held at each pixel in an Image or at each vertex of an Mesh. The template parameter T can be any data type that behaves like a primitive (or atomic) data type (int, short, float, complex). The VPointDimension defines the number of components in the point array.

See also
Image
Mesh
Vector
CovariantVector
Matrix
ITK Sphinx Examples:
Examples
Examples/DataRepresentation/Image/Image4.cxx, Examples/RegistrationITKv4/ThinPlateSplineWarp.cxx, SphinxExamples/src/Core/Common/DistanceBetweenPoints/Code.cxx, SphinxExamples/src/Core/Common/IterateOnAVectorContainer/Code.cxx, SphinxExamples/src/Core/Transform/ScaleAnImage/Code.cxx, and SphinxExamples/src/Filtering/ImageGrid/ResampleAnImage/Code.cxx.

Definition at line 53 of file itkPoint.h.

+ Inheritance diagram for itk::Point< TCoordinate, VPointDimension >:
+ Collaboration diagram for itk::Point< TCoordinate, VPointDimension >:

Public Types

using BaseArray = FixedArray< TCoordinate, VPointDimension >
 
using ConstIterator = typename BaseArray::ConstIterator
 
using CoordinateType = TCoordinate
 
using Iterator = typename BaseArray::Iterator
 
using RealType = typename NumericTraits< ValueType >::RealType
 
using Self = Point
 
using Superclass = FixedArray< TCoordinate, VPointDimension >
 
using ValueType = TCoordinate
 
using VectorType = Vector< ValueType, VPointDimension >
 
- Public Types inherited from itk::FixedArray< TCoordinate, VPointDimension >
using CArray = ValueType[VLength]
 
using const_iterator = const ValueType *
 
using const_pointer = const ValueType *
 
using const_reference = const ValueType &
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using ConstIterator = const ValueType *
 
using Iterator = ValueType *
 
using iterator = ValueType *
 
using pointer = ValueType *
 
using reference = ValueType &
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using SizeType = unsigned int
 
using ValueType = TCoordinate
 

Public Member Functions

template<typename TCoordinateB >
RealType EuclideanDistanceTo (const Point< TCoordinateB, VPointDimension > &pa) const
 
VectorType GetVectorFromOrigin () const
 
vnl_vector_ref< TCoordinate > GetVnlVector ()
 
vnl_vector< TCoordinate > GetVnlVector () const
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (Self)
 
Self operator+ (const VectorType &vec) const
 
const Selfoperator+= (const VectorType &vec)
 
VectorType operator- (const Self &pnt) const
 
Self operator- (const VectorType &vec) const
 
const Selfoperator-= (const VectorType &vec)
 
Pointoperator= (const ValueType r[VPointDimension])
 
bool operator== (const Self &pt) const
 
 Point ()=default
 
template<typename TPointValueType >
 Point (const Point< TPointValueType, VPointDimension > &r)
 
 Point (const std::array< ValueType, VPointDimension > &stdArray)
 
template<typename TPointValueType >
 Point (const TPointValueType &v)
 
 Point (const ValueType &v)
 
 Point (std::nullptr_t)=delete
 
void SetToMidPoint (const Self &, const Self &)
 
template<typename TCoordinateB >
RealType SquaredEuclideanDistanceTo (const Point< TCoordinateB, VPointDimension > &pa) const
 
template<typename TPointValueType >
 Point (const TPointValueType r[VPointDimension])
 
 Point (const ValueType r[VPointDimension])
 
void SetToBarycentricCombination (const Self &A, const Self &B, double alpha)
 
void SetToBarycentricCombination (const Self &A, const Self &B, const Self &C, double weightForA, double weightForB)
 
void SetToBarycentricCombination (const Self *P, const double *weights, unsigned int N)
 
template<typename TCoordinateB >
void CastFrom (const Point< TCoordinateB, VPointDimension > &pa)
 
- Public Member Functions inherited from itk::FixedArray< TCoordinate, VPointDimension >
Iterator Begin ()
 
ConstIterator Begin () const
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
ValueTypedata ()
 
const ValueTypedata () const
 
Iterator End ()
 
ConstIterator End () const
 
constexpr const_iterator end () const noexcept
 
constexpr iterator end () noexcept
 
void Fill (const ValueType &)
 
 FixedArray ()=default
 
 FixedArray (const FixedArray< TFixedArrayValueType, VLength > &r)
 
 FixedArray (const std::array< ValueType, VLength > &stdArray)
 
 FixedArray (const TScalarValue *r)
 
ValueTypeGetDataPointer ()
 
const ValueTypeGetDataPointer () const
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (FixedArray)
 
 itkLegacyMacro (ReverseIterator rBegin();) itkLegacyMacro(ConstReverseIterator rBegin() const
 
 itkLegacyMacro (ReverseIterator rEnd();) itkLegacyMacro(ConstReverseIterator rEnd() const
 
FixedArrayoperator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArrayoperator= (const ValueType r[VLength])
 
bool operator== (const FixedArray &r) const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
SizeType Size () const
 
constexpr SizeType size () const
 
void swap (FixedArray &other) noexcept
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
ITK_GCC_PRAGMA_PUSH constexpr ITK_GCC_SUPPRESS_Warray_bounds reference operator[] (unsigned int index)
 
constexpr const_reference operator[] (unsigned int index) const
 
ITK_GCC_PRAGMA_POP void SetElement (unsigned int index, const_reference value)
 
const_reference GetElement (unsigned int index) const
 

Static Public Member Functions

static unsigned int GetPointDimension ()
 
- Static Public Member Functions inherited from itk::FixedArray< TCoordinate, VPointDimension >
static constexpr FixedArray Filled (const ValueType &value)
 

Static Public Attributes

static constexpr unsigned int PointDimension = VPointDimension
 
- Static Public Attributes inherited from itk::FixedArray< TCoordinate, VPointDimension >
static constexpr unsigned int Dimension
 
static constexpr unsigned int Length
 

Member Typedef Documentation

◆ BaseArray

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::BaseArray = FixedArray<TCoordinate, VPointDimension>

The Array type from which this Vector is derived.

Definition at line 76 of file itkPoint.h.

◆ ConstIterator

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::ConstIterator = typename BaseArray::ConstIterator

Definition at line 78 of file itkPoint.h.

◆ CoordinateType

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::CoordinateType = TCoordinate

Definition at line 64 of file itkPoint.h.

◆ Iterator

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::Iterator = typename BaseArray::Iterator

Definition at line 77 of file itkPoint.h.

◆ RealType

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::RealType = typename NumericTraits<ValueType>::RealType

Definition at line 70 of file itkPoint.h.

◆ Self

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::Self = Point

Standard class type aliases.

Definition at line 58 of file itkPoint.h.

◆ Superclass

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::Superclass = FixedArray<TCoordinate, VPointDimension>

Definition at line 59 of file itkPoint.h.

◆ ValueType

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::ValueType = TCoordinate

ValueType can be used to declare a variable that is the same type as a data element held in an Point.

Definition at line 63 of file itkPoint.h.

◆ VectorType

template<typename TCoordinate, unsigned int VPointDimension = 3>
using itk::Point< TCoordinate, VPointDimension >::VectorType = Vector<ValueType, VPointDimension>

VectorType define the difference between two Points

Definition at line 88 of file itkPoint.h.

Constructor & Destructor Documentation

◆ Point() [1/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
itk::Point< TCoordinate, VPointDimension >::Point ( )
default

Default-constructor.

Note
The other five "special member functions" are defaulted implicitly, following the C++ "Rule of Zero".

◆ Point() [2/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
template<typename TPointValueType >
itk::Point< TCoordinate, VPointDimension >::Point ( const Point< TPointValueType, VPointDimension > &  r)
inline

Pass-through constructors for different type points.

Definition at line 96 of file itkPoint.h.

◆ Point() [3/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
template<typename TPointValueType >
itk::Point< TCoordinate, VPointDimension >::Point ( const TPointValueType  r[VPointDimension])
inline

Pass-through constructors for plain arrays.

Definition at line 102 of file itkPoint.h.

◆ Point() [4/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
itk::Point< TCoordinate, VPointDimension >::Point ( const ValueType  r[VPointDimension])
inline

Pass-through constructors for plain arrays.

Definition at line 105 of file itkPoint.h.

◆ Point() [5/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
itk::Point< TCoordinate, VPointDimension >::Point ( std::nullptr_t  )
delete

Prevents copy-initialization from nullptr, as well as from 0 (NULL).

◆ Point() [6/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
template<typename TPointValueType >
itk::Point< TCoordinate, VPointDimension >::Point ( const TPointValueType &  v)
inlineexplicit

Explicit constructors for single values

Definition at line 116 of file itkPoint.h.

◆ Point() [7/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
itk::Point< TCoordinate, VPointDimension >::Point ( const ValueType v)
inlineexplicit

Definition at line 119 of file itkPoint.h.

◆ Point() [8/8]

template<typename TCoordinate, unsigned int VPointDimension = 3>
itk::Point< TCoordinate, VPointDimension >::Point ( const std::array< ValueType, VPointDimension > &  stdArray)
inlineexplicit

Explicit constructor for std::array.

Definition at line 137 of file itkPoint.h.

Member Function Documentation

◆ CastFrom()

template<typename TCoordinate, unsigned int VPointDimension = 3>
template<typename TCoordinateB >
void itk::Point< TCoordinate, VPointDimension >::CastFrom ( const Point< TCoordinateB, VPointDimension > &  pa)
inline

Copy from another Point with a different representation type. Casting is done with C-Like rules

Definition at line 269 of file itkPoint.h.

Referenced by itk::ImageToImageMetricv4< TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits >::LocalTransformPoint().

◆ EuclideanDistanceTo()

template<typename TCoordinate, unsigned int VPointDimension = 3>
template<typename TCoordinateB >
RealType itk::Point< TCoordinate, VPointDimension >::EuclideanDistanceTo ( const Point< TCoordinateB, VPointDimension > &  pa) const
inline

Compute the Euclidean Distance from this point to another point with a different representation type. Casting is done with C-Like rules

Definition at line 302 of file itkPoint.h.

◆ GetPointDimension()

template<typename TCoordinate, unsigned int VPointDimension = 3>
static unsigned int itk::Point< TCoordinate, VPointDimension >::GetPointDimension ( )
inlinestatic

Get the dimension (size) of the point.

Definition at line 82 of file itkPoint.h.

◆ GetVectorFromOrigin()

template<typename TCoordinate, unsigned int VPointDimension = 3>
VectorType itk::Point< TCoordinate, VPointDimension >::GetVectorFromOrigin ( ) const

Access an element of a point.

◆ GetVnlVector() [1/2]

template<typename TCoordinate, unsigned int VPointDimension = 3>
vnl_vector_ref<TCoordinate> itk::Point< TCoordinate, VPointDimension >::GetVnlVector ( )

Get a vnl_vector_ref referencing the same memory block

◆ GetVnlVector() [2/2]

template<typename TCoordinate, unsigned int VPointDimension = 3>
vnl_vector<TCoordinate> itk::Point< TCoordinate, VPointDimension >::GetVnlVector ( ) const

Get a vnl_vector with a copy of the internal memory block.

◆ ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION()

template<typename TCoordinate, unsigned int VPointDimension = 3>
itk::Point< TCoordinate, VPointDimension >::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION ( Self  )

◆ operator+()

template<typename TCoordinate, unsigned int VPointDimension = 3>
Self itk::Point< TCoordinate, VPointDimension >::operator+ ( const VectorType vec) const

Add a vector to a point. Return a new point.

◆ operator+=()

template<typename TCoordinate, unsigned int VPointDimension = 3>
const Self& itk::Point< TCoordinate, VPointDimension >::operator+= ( const VectorType vec)

Point operator+=. Adds a vector to the current point.

◆ operator-() [1/2]

template<typename TCoordinate, unsigned int VPointDimension = 3>
VectorType itk::Point< TCoordinate, VPointDimension >::operator- ( const Self pnt) const

Computes the Vector difference between two points

◆ operator-() [2/2]

template<typename TCoordinate, unsigned int VPointDimension = 3>
Self itk::Point< TCoordinate, VPointDimension >::operator- ( const VectorType vec) const

Subtract a vector from a point. Return a new point.

◆ operator-=()

template<typename TCoordinate, unsigned int VPointDimension = 3>
const Self& itk::Point< TCoordinate, VPointDimension >::operator-= ( const VectorType vec)

Point operator-=. Subtracts a vector from a current point.

◆ operator=()

template<typename TCoordinate, unsigned int VPointDimension = 3>
Point& itk::Point< TCoordinate, VPointDimension >::operator= ( const ValueType  r[VPointDimension])

Pass-through assignment operator for a plain array.

◆ operator==()

template<typename TCoordinate, unsigned int VPointDimension = 3>
bool itk::Point< TCoordinate, VPointDimension >::operator== ( const Self pt) const
inline

Compare two points for equality.

Definition at line 147 of file itkPoint.h.

◆ SetToBarycentricCombination() [1/3]

template<typename TCoordinate, unsigned int VPointDimension = 3>
void itk::Point< TCoordinate, VPointDimension >::SetToBarycentricCombination ( const Self A,
const Self B,
const Self C,
double  weightForA,
double  weightForB 
)

Set the current point to a barycentric combination of three points Two values are expected to weight the contribution of the first two points, the weight of for the third point is computed to ensure that the three weights sum 1.

This method computes:

\[ \overrightarrow{P}= w_1 * \overrightarrow{P}_1 + w_2 * \overrightarrow{P}_2 + (1-w_1-w_2 ) * \overrightarrow{P}_3 \]

If the two weight are \( \in [0,1] \) , The resulting point will always be placed inside the triangle formed by the three points given as arguments.

◆ SetToBarycentricCombination() [2/3]

template<typename TCoordinate, unsigned int VPointDimension = 3>
void itk::Point< TCoordinate, VPointDimension >::SetToBarycentricCombination ( const Self A,
const Self B,
double  alpha 
)

Set the current point to a barycentric combination of the two points given as arguments.

Parameters
AFirst point
BSecond point
alphaWeight for the first point

The first point is multiplied by \( \alpha \), the second is multiplied by * \( (1-\alpha) \), and the sum is stored in the Point on which the method is invoked.

\[ \overrightarrow{P}=\alpha * \overrightarrow{A}+ (1-\alpha)*\overrightarrow{B} \]

If the value of \( \alpha \in [0,1] \), the resulting point will be placed in the line segment \( \overline{AB} \) joining \( \overrightarrow{A} \) and \( \overrightarrow{A} \)

If the value of \( \alpha < 0 \) the resulting point will be placed outside the line segment \( \overline{AB} \) on the side of \( \overrightarrow{A} \).

If the value of \( \alpha > 1 \) the resulting point will be placed outside the line segment \( \overline{AB} \) on the side of \( \overrightarrow{B} \).

See also
SetToMedian

◆ SetToBarycentricCombination() [3/3]

template<typename TCoordinate, unsigned int VPointDimension = 3>
void itk::Point< TCoordinate, VPointDimension >::SetToBarycentricCombination ( const Self P,
const double *  weights,
unsigned int  N 
)

Set the current point to a barycentric combination of an array of N points An array of (N-1) values is expected to weight the contribution of the first (N-1) points, the weight of the Nth point is computed to ensure that the N weights sum 1.

This method computes:

\[ \overrightarrow{P}= \sum_{i=1}^{N-1} w_i * \overrightarrow{P}_i + \left(1- \sum_{i=1}^{N-1} w_i\right) * \overrightarrow{P}_N \]

◆ SetToMidPoint()

template<typename TCoordinate, unsigned int VPointDimension = 3>
void itk::Point< TCoordinate, VPointDimension >::SetToMidPoint ( const Self ,
const Self  
)

Set to median point between the two points given as arguments

This method computes:

\[ \overrightarrow{P}=\frac{(\overrightarrow{A}+\overrightarrow{B})}{2} \]

using the two Points given as arguments, and store the result in the Point on which the method is invoked.

◆ SquaredEuclideanDistanceTo()

template<typename TCoordinate, unsigned int VPointDimension = 3>
template<typename TCoordinateB >
RealType itk::Point< TCoordinate, VPointDimension >::SquaredEuclideanDistanceTo ( const Point< TCoordinateB, VPointDimension > &  pa) const
inline

Compute the Squared Euclidean Distance from this point to another point with a different representation type. Casting is done with C-Like rules

Definition at line 284 of file itkPoint.h.

Member Data Documentation

◆ PointDimension

template<typename TCoordinate, unsigned int VPointDimension = 3>
constexpr unsigned int itk::Point< TCoordinate, VPointDimension >::PointDimension = VPointDimension
staticconstexpr

Dimension of the Space

Definition at line 73 of file itkPoint.h.


The documentation for this class was generated from the following file: