ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
itk::Point< TCoordRep, NPointDimension > Class Template Reference

#include <itkPoint.h>

+ Inheritance diagram for itk::Point< TCoordRep, NPointDimension >:
+ Collaboration diagram for itk::Point< TCoordRep, NPointDimension >:

Public Types

using BaseArray = FixedArray< TCoordRep, NPointDimension >
 
using ConstIterator = typename BaseArray::ConstIterator
 
using CoordRepType = TCoordRep
 
using Iterator = typename BaseArray::Iterator
 
using RealType = typename NumericTraits< ValueType >::RealType
 
using Self = Point
 
using Superclass = FixedArray< TCoordRep, NPointDimension >
 
using ValueType = TCoordRep
 
using VectorType = Vector< ValueType, NPointDimension >
 
- Public Types inherited from itk::FixedArray< TCoordRep, NPointDimension >
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 = TCoordRep
 

Public Member Functions

Pointoperator= (const Point &)=default
 
Pointoperator= (Point &&)=default
 
 Point ()=default
 
 Point (const Point &)=default
 
template<typename TPointValueType >
 Point (const Point< TPointValueType, NPointDimension > &r)
 
template<typename TPointValueType >
 Point (const TPointValueType r[NPointDimension])
 
 Point (const ValueType r[NPointDimension])
 
 Point (Point &&)=default
 
 ~Point ()=default
 
template<typename TPointValueType >
 Point (const TPointValueType &v)
 
 Point (const ValueType &v)
 
 Point (const std::array< ValueType, NPointDimension > &stdArray)
 
Pointoperator= (const ValueType r[NPointDimension])
 
bool operator== (const Self &pt) const
 
bool operator!= (const Self &pt) const
 
const Selfoperator+= (const VectorType &vec)
 
const Selfoperator-= (const VectorType &vec)
 
VectorType operator- (const Self &pnt) const
 
Self operator+ (const VectorType &vec) const
 
Self operator- (const VectorType &vec) const
 
VectorType GetVectorFromOrigin () const
 
vnl_vector_ref< TCoordRep > GetVnlVector ()
 
vnl_vector< TCoordRep > GetVnlVector () const
 
void SetToMidPoint (const Self &, const Self &)
 
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 TCoordRepB >
void CastFrom (const Point< TCoordRepB, NPointDimension > &pa)
 
template<typename TCoordRepB >
RealType SquaredEuclideanDistanceTo (const Point< TCoordRepB, NPointDimension > &pa) const
 
template<typename TCoordRepB >
RealType EuclideanDistanceTo (const Point< TCoordRepB, NPointDimension > &pa) const
 
- Public Member Functions inherited from itk::FixedArray< TCoordRep, NPointDimension >
 FixedArray ()=default
 
 FixedArray (const FixedArray &)=default
 
 FixedArray (FixedArray &&)=default
 
 FixedArray (const ValueType r[VLength])
 
 FixedArray (const ValueType &)
 
 FixedArray (const std::array< ValueType, VLength > &stdArray)
 
 FixedArray (const FixedArray< TFixedArrayValueType, VLength > &r)
 
 FixedArray (const TScalarValue *r)
 
FixedArrayoperator= (const FixedArray &)=default
 
FixedArrayoperator= (FixedArray &&)=default
 
FixedArrayoperator= (const FixedArray< TFixedArrayValueType, VLength > &r)
 
FixedArrayoperator= (const ValueType r[VLength])
 
 ~FixedArray ()=default
 
bool operator== (const FixedArray &r) const
 
bool operator!= (const FixedArray &r) const
 
reference operator[] (short index)
 
const_reference operator[] (short index) const
 
reference operator[] (unsigned short index)
 
const_reference operator[] (unsigned short index) const
 
reference operator[] (int index)
 
const_reference operator[] (int index) const
 
reference operator[] (unsigned int index)
 
const_reference operator[] (unsigned int index) const
 
reference operator[] (long index)
 
const_reference operator[] (long index) const
 
reference operator[] (unsigned long index)
 
const_reference operator[] (unsigned long index) const
 
reference operator[] (long long index)
 
const_reference operator[] (long long index) const
 
reference operator[] (unsigned long long index)
 
const_reference operator[] (unsigned long long index) const
 
void SetElement (unsigned int index, const_reference value)
 
const_reference GetElement (unsigned int index) const
 
ValueTypeGetDataPointer ()
 
const ValueTypeGetDataPointer () const
 
ValueTypedata ()
 
const ValueTypedata () const
 
Iterator Begin ()
 
ConstIterator Begin () const
 
Iterator End ()
 
ConstIterator End () const
 
 itkLegacyMacro (ReverseIterator rBegin())
 
 itkLegacyMacro (ConstReverseIterator rBegin() const)
 
 itkLegacyMacro (ReverseIterator rEnd())
 
 itkLegacyMacro (ConstReverseIterator rEnd() const)
 
const_iterator cbegin () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cend () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator crbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
const_reverse_iterator crend () const
 
SizeType Size () const
 
constexpr SizeType size () const
 
void Fill (const ValueType &)
 
void swap (FixedArray &other)
 

Static Public Member Functions

static unsigned int GetPointDimension ()
 
- Static Public Member Functions inherited from itk::FixedArray< TCoordRep, NPointDimension >
static FixedArray Filled (const ValueType &)
 

Static Public Attributes

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

Detailed Description

template<typename TCoordRep, unsigned int NPointDimension = 3>
class itk::Point< TCoordRep, NPointDimension >

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 NPointDimension 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.

Member Typedef Documentation

◆ BaseArray

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::BaseArray = FixedArray<TCoordRep, NPointDimension>

The Array type from which this Vector is derived.

Definition at line 72 of file itkPoint.h.

◆ ConstIterator

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::ConstIterator = typename BaseArray::ConstIterator

Definition at line 74 of file itkPoint.h.

◆ CoordRepType

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::CoordRepType = TCoordRep

Definition at line 64 of file itkPoint.h.

◆ Iterator

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::Iterator = typename BaseArray::Iterator

Definition at line 73 of file itkPoint.h.

◆ RealType

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

Definition at line 66 of file itkPoint.h.

◆ Self

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::Self = Point

Standard class type aliases.

Definition at line 58 of file itkPoint.h.

◆ Superclass

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::Superclass = FixedArray<TCoordRep, NPointDimension>

Definition at line 59 of file itkPoint.h.

◆ ValueType

template<typename TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::ValueType = TCoordRep

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 TCoordRep, unsigned int NPointDimension = 3>
using itk::Point< TCoordRep, NPointDimension >::VectorType = Vector<ValueType, NPointDimension>

VectorType define the difference between two Points

Definition at line 84 of file itkPoint.h.

Constructor & Destructor Documentation

◆ Point() [1/9]

template<typename TCoordRep, unsigned int NPointDimension = 3>
itk::Point< TCoordRep, NPointDimension >::Point ( )
default

Default constructor, assignments

◆ Point() [2/9]

template<typename TCoordRep, unsigned int NPointDimension = 3>
itk::Point< TCoordRep, NPointDimension >::Point ( const Point< TCoordRep, NPointDimension > &  )
default

◆ Point() [3/9]

template<typename TCoordRep, unsigned int NPointDimension = 3>
itk::Point< TCoordRep, NPointDimension >::Point ( Point< TCoordRep, NPointDimension > &&  )
default

◆ ~Point()

template<typename TCoordRep, unsigned int NPointDimension = 3>
itk::Point< TCoordRep, NPointDimension >::~Point ( )
default

◆ Point() [4/9]

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

Pass-through constructors for different type points.

Definition at line 98 of file itkPoint.h.

◆ Point() [5/9]

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

Pass-through constructors for plain arrays.

Definition at line 104 of file itkPoint.h.

◆ Point() [6/9]

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

Definition at line 107 of file itkPoint.h.

◆ Point() [7/9]

template<typename TCoordRep, unsigned int NPointDimension = 3>
template<typename TPointValueType >
itk::Point< TCoordRep, NPointDimension >::Point ( const TPointValueType &  v)
inline

Pass-through constructors for single values

Definition at line 113 of file itkPoint.h.

◆ Point() [8/9]

template<typename TCoordRep, unsigned int NPointDimension = 3>
itk::Point< TCoordRep, NPointDimension >::Point ( const ValueType v)
inline

Pass-through constructors for single values

Definition at line 116 of file itkPoint.h.

◆ Point() [9/9]

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

Explicit constructor for std::array.

Definition at line 122 of file itkPoint.h.

Member Function Documentation

◆ CastFrom()

template<typename TCoordRep, unsigned int NPointDimension = 3>
template<typename TCoordRepB >
void itk::Point< TCoordRep, NPointDimension >::CastFrom ( const Point< TCoordRepB, NPointDimension > &  pa)
inline

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

Definition at line 271 of file itkPoint.h.

◆ EuclideanDistanceTo()

template<typename TCoordRep, unsigned int NPointDimension = 3>
template<typename TCoordRepB >
RealType itk::Point< TCoordRep, NPointDimension >::EuclideanDistanceTo ( const Point< TCoordRepB, NPointDimension > &  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 304 of file itkPoint.h.

◆ GetPointDimension()

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

Get the dimension (size) of the point.

Definition at line 78 of file itkPoint.h.

◆ GetVectorFromOrigin()

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

Access an element of a point.

◆ GetVnlVector() [1/2]

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

Get a vnl_vector_ref referencing the same memory block

◆ GetVnlVector() [2/2]

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

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

◆ operator!=()

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

Compare two points for inequality.

Definition at line 145 of file itkPoint.h.

◆ operator+()

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

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

◆ operator+=()

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

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

◆ operator-() [1/2]

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

Computes the Vector difference between two points

◆ operator-() [2/2]

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

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

◆ operator-=()

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

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

◆ operator=() [1/3]

template<typename TCoordRep, unsigned int NPointDimension = 3>
Point& itk::Point< TCoordRep, NPointDimension >::operator= ( const Point< TCoordRep, NPointDimension > &  )
default

◆ operator=() [2/3]

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

Pass-through assignment operator for a plain array.

◆ operator=() [3/3]

template<typename TCoordRep, unsigned int NPointDimension = 3>
Point& itk::Point< TCoordRep, NPointDimension >::operator= ( Point< TCoordRep, NPointDimension > &&  )
default

◆ operator==()

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

Compare two points for equality.

Definition at line 132 of file itkPoint.h.

◆ SetToBarycentricCombination() [1/3]

template<typename TCoordRep, unsigned int NPointDimension = 3>
void itk::Point< TCoordRep, NPointDimension >::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 alway be placed inside the triangle formed by the three points given as arguments.

◆ SetToBarycentricCombination() [2/3]

template<typename TCoordRep, unsigned int NPointDimension = 3>
void itk::Point< TCoordRep, NPointDimension >::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 TCoordRep, unsigned int NPointDimension = 3>
void itk::Point< TCoordRep, NPointDimension >::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 TCoordRep, unsigned int NPointDimension = 3>
void itk::Point< TCoordRep, NPointDimension >::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 TCoordRep, unsigned int NPointDimension = 3>
template<typename TCoordRepB >
RealType itk::Point< TCoordRep, NPointDimension >::SquaredEuclideanDistanceTo ( const Point< TCoordRepB, NPointDimension > &  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 286 of file itkPoint.h.

Member Data Documentation

◆ PointDimension

template<typename TCoordRep, unsigned int NPointDimension = 3>
constexpr unsigned int itk::Point< TCoordRep, NPointDimension >::PointDimension = NPointDimension
staticconstexpr

Dimension of the Space

Definition at line 69 of file itkPoint.h.


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