DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes
DGtal::functors::Projector< S > Struct Template Reference

Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an array containing the coordinates - (0, 1, ..., j-1) by default - that are copied from P to Q. More...

#include <DGtal/kernel/BasicPointFunctors.h>

Public Types

typedef S Space
 
typedef Space::Dimension Dimension
 
typedef Space::Integer Integer
 
typedef Space::Point Point
 

Public Member Functions

 BOOST_STATIC_CONSTANT (Dimension, dimension=Space::dimension)
 
 Projector (const Integer &aDefaultInteger=NumberTraits< Integer >::zero())
 
template<typename TIterator >
void init (const TIterator &itb, const TIterator &ite)
 
void initRemoveOneDim (const Dimension &dimRemoved)
 
void initAddOneDim (const Dimension &newDim)
 
template<typename TInputPoint >
Point operator() (const TInputPoint &aPoint) const
 

Private Attributes

std::array< Dimension, dimension > myDims
 
Integer myDefaultInteger
 

Detailed Description

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
struct DGtal::functors::Projector< S >

Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an array containing the coordinates - (0, 1, ..., j-1) by default - that are copied from P to Q.

Description of template class 'Projector'

Ex: for i = 3 and j = 2, the first two coordinates (numbered 0 and 1) are copied so that point (x,y,z) is is mapped to point (x,y).

All kth coordinates (0 < k < j) that are greater than i, are set to a value given at construction (0 by defaut).

Ex: for i = 2 and j = 3, the first two coordinates (numbered 0 and 1) are copied so that point (x,y) is is mapped to point (x,y,0).

Instead of using the default order, you can define your own orthonormal basis as shown below:

Projector<SpaceND<2,int> > proj;
proj( p ) //== (3,1)
...
//v (2, 0): selection of the 2nd and 0th basis vectors
proj.init(v.begin(), v.end());
proj( p ) //== (5,3)
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
Template Parameters
Stype for the space where must lie the projected point
Examples
images/extract2DImagesFrom3DandVisu.cpp, images/extract2DSlicesImagesFrom3D.cpp, io/viewers/viewer3D-8-2DSliceImages.cpp, and tutorial-examples/2DSliceImageFromVol.cpp.

Definition at line 106 of file BasicPointFunctors.h.

Member Typedef Documentation

◆ Dimension

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
typedef Space::Dimension DGtal::functors::Projector< S >::Dimension

Definition at line 109 of file BasicPointFunctors.h.

◆ Integer

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
typedef Space::Integer DGtal::functors::Projector< S >::Integer

Definition at line 111 of file BasicPointFunctors.h.

◆ Point

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
typedef Space::Point DGtal::functors::Projector< S >::Point

Definition at line 112 of file BasicPointFunctors.h.

◆ Space

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
typedef S DGtal::functors::Projector< S >::Space

Definition at line 108 of file BasicPointFunctors.h.

Constructor & Destructor Documentation

◆ Projector()

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
DGtal::functors::Projector< S >::Projector ( const Integer aDefaultInteger = NumberTraitsInteger >::zero())

Default constructor

Member Function Documentation

◆ BOOST_STATIC_CONSTANT()

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
DGtal::functors::Projector< S >::BOOST_STATIC_CONSTANT ( Dimension  ,
dimension  = Space::dimension 
)

◆ init()

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
template<typename TIterator >
void DGtal::functors::Projector< S >::init ( const TIterator &  itb,
const TIterator &  ite 
)

Initialization of the array of relevant dimensions

Parameters
itbbegin iterator on dimensions.
iteend iterator on dimensions.

Referenced by testProjector().

◆ initAddOneDim()

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
void DGtal::functors::Projector< S >::initAddOneDim ( const Dimension newDim)

Initialisation by adding a given dimension.

Parameters
newDimthe new dimension.
Examples
images/extract2DImagesFrom3DandVisu.cpp, images/extract2DSlicesImagesFrom3D.cpp, and tutorial-examples/2DSliceImageFromVol.cpp.

Referenced by main(), and testSliceImageFromFunctor().

◆ initRemoveOneDim()

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
void DGtal::functors::Projector< S >::initRemoveOneDim ( const Dimension dimRemoved)

Initialisation by removing a given dimension.

Parameters
dimRemovedthe removed dimension.
Examples
io/viewers/viewer3D-8-2DSliceImages.cpp.

Referenced by main(), and testSliceImageFromFunctor().

◆ operator()()

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
template<typename TInputPoint >
Point DGtal::functors::Projector< S >::operator() ( const TInputPoint &  aPoint) const

Main operator

Parameters
aPointany point.
Returns
the projected point.

Field Documentation

◆ myDefaultInteger

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
Integer DGtal::functors::Projector< S >::myDefaultInteger
private

Default integer set to coordinates of the projected point not in the input point

Definition at line 161 of file BasicPointFunctors.h.

◆ myDims

template<typename S = SpaceND< 2, DGtal::Z2i::Integer >>
std::array<Dimension, dimension> DGtal::functors::Projector< S >::myDims
private

Array storing the coordinates that are copied from the input point to its projection (order matters)

Definition at line 155 of file BasicPointFunctors.h.


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