DGtal  1.0.beta
Data Structures | Public Types | Public Member Functions | Data Fields | Private Member Functions | Private Attributes
DGtal::HyperRectDomain< TSpace > Class Template Reference

#include <DGtal/kernel/domains/HyperRectDomain.h>

Inheritance diagram for DGtal::HyperRectDomain< TSpace >:
[legend]
Collaboration diagram for DGtal::HyperRectDomain< TSpace >:
[legend]

Data Structures

struct  ConstSubRange
 

Public Types

typedef HyperRectDomain< TSpace > Self
 
typedef TSpace Space
 
typedef HyperRectDomain< SpaceDomain
 
typedef Space::Point Point
 
typedef Space::Integer Integer
 
typedef Space::Vector Vector
 
typedef Space::Dimension Dimension
 
typedef Space::Size Size
 
typedef Point::Coordinate Coordinate
 
typedef HyperRectDomain_Iterator< PointIterator
 
typedef myreverse_iterator< IteratorReverseIterator
 
typedef Iterator ConstIterator
 
typedef ReverseIterator ConstReverseIterator
 
typedef functors::IsWithinPointPredicate< PointPredicate
 

Public Member Functions

 BOOST_STATIC_CONSTANT (Dimension, dimension=Space::dimension)
 
 HyperRectDomain ()
 
 HyperRectDomain (const Point &aPointA, const Point &aPointB)
 
 ~HyperRectDomain ()
 
 HyperRectDomain (const HyperRectDomain &other)
 
HyperRectDomainoperator= (const HyperRectDomain &other)
 
const ConstIteratorbegin () const
 
ConstIterator begin (const Point &aPoint) const
 
const ConstIteratorend () const
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rbegin (const Point &aPoint) const
 
ConstReverseIterator rend () const
 
ConstSubRange subRange (const std::vector< Dimension > &permutation) const
 
ConstSubRange subRange (const std::vector< Dimension > &permutation, const Point &startingPoint) const
 
ConstSubRange subRange (Dimension adim, const Point &startingPoint) const
 
ConstSubRange subRange (Dimension adim1, Dimension adim2, const Point &startingPoint) const
 
ConstSubRange subRange (Dimension adim1, Dimension adim2, Dimension adim3, const Point &startingPoint) const
 
ConstSubRange subRange (std::initializer_list< Dimension > permutation)
 
ConstSubRange subRange (std::initializer_list< Dimension > permutation, const Point &startingPoint)
 
Size size () const
 
const PointlowerBound () const
 
const PointupperBound () const
 
bool isInside (const Point &p) const
 
bool isEmpty () const
 
const Predicatepredicate () const
 
std::string className () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Data Fields

Point myLowerBound
 
Point myUpperBound
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >))
 

Private Attributes

Predicate myPredicate
 
ConstIterator myIteratorBegin
 
ConstIterator myIteratorEnd
 

Detailed Description

template<typename TSpace>
class DGtal::HyperRectDomain< TSpace >

Aim: Parallelepidec region of a digital space, model of a 'CDomain'.

Description of class 'HyperRectDomain'

The following code snippet demonstrates how to use HyperRectDomain

#include <DGtal/kernel/Space.h>
#include <DGtal/kernel/domains/HyperRectDomain.h>
...
//We create a digital Space based on 'int' integers and in dimension 4
typedef DGtal::Space<4> Space4D;
typedef Space4D::TPoint Point4D;
const int rawA[ ] = { 1, 2, 3 ,4};
const int rawB[ ] = { 5, 5, 3 ,4};
Point4D A ( rawA );
Point4D B ( rawB );
//Domain construction from two points
//We iterate on the Domain points and print out the point coordinates.
std::copy ( myDomain.begin(),
myDomain.end(),
std::ostream_iterator<Point4D> ( std::cout, " " ) );
See also
testHyperRectDomain.cpp
testHyperRectDomain-snippet.cpp
Examples:
doc-examples/demo-kernel-1.cpp, doc-examples/kernelDomain.cpp, doc-examples/range.cpp, geometry/tools/determinant/exampleInHalfPlane.cpp, io/viewers/demo-kernel-2.cpp, and topology/3dBorderExtraction.cpp.

Definition at line 92 of file HyperRectDomain.h.

Member Typedef Documentation

template<typename TSpace>
typedef Iterator DGtal::HyperRectDomain< TSpace >::ConstIterator

Definition at line 118 of file HyperRectDomain.h.

template<typename TSpace>
typedef ReverseIterator DGtal::HyperRectDomain< TSpace >::ConstReverseIterator

Definition at line 119 of file HyperRectDomain.h.

template<typename TSpace>
typedef Point::Coordinate DGtal::HyperRectDomain< TSpace >::Coordinate

Definition at line 111 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Dimension DGtal::HyperRectDomain< TSpace >::Dimension

Definition at line 109 of file HyperRectDomain.h.

template<typename TSpace>
typedef HyperRectDomain<Space> DGtal::HyperRectDomain< TSpace >::Domain

Definition at line 105 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Integer DGtal::HyperRectDomain< TSpace >::Integer

Definition at line 107 of file HyperRectDomain.h.

template<typename TSpace>
typedef HyperRectDomain_Iterator<Point> DGtal::HyperRectDomain< TSpace >::Iterator

Typedef of domain iterators.

Definition at line 116 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Point DGtal::HyperRectDomain< TSpace >::Point

Definition at line 106 of file HyperRectDomain.h.

template<typename TSpace>
typedef functors::IsWithinPointPredicate<Point> DGtal::HyperRectDomain< TSpace >::Predicate

Definition at line 121 of file HyperRectDomain.h.

template<typename TSpace>
typedef myreverse_iterator<Iterator> DGtal::HyperRectDomain< TSpace >::ReverseIterator

Definition at line 117 of file HyperRectDomain.h.

template<typename TSpace>
typedef HyperRectDomain<TSpace> DGtal::HyperRectDomain< TSpace >::Self

Definition at line 99 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Size DGtal::HyperRectDomain< TSpace >::Size

Definition at line 110 of file HyperRectDomain.h.

template<typename TSpace>
typedef TSpace DGtal::HyperRectDomain< TSpace >::Space

Definition at line 103 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Vector DGtal::HyperRectDomain< TSpace >::Vector

Definition at line 108 of file HyperRectDomain.h.

Constructor & Destructor Documentation

template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::HyperRectDomain ( )

Default Constructor.

template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::HyperRectDomain ( const Point aPointA,
const Point aPointB 
)

Constructor from two points

Parameters
aPointAand
aPointBdefining the space diagonal.
template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::~HyperRectDomain ( )

Destructor.

template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::HyperRectDomain ( const HyperRectDomain< TSpace > &  other)

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

template<typename TSpace>
const ConstIterator& DGtal::HyperRectDomain< TSpace >::begin ( ) const
inline
template<typename TSpace>
ConstIterator DGtal::HyperRectDomain< TSpace >::begin ( const Point aPoint) const
inline

begin method from a given point.

Parameters
aPointthe initial point.
Returns
a ConstIterator initialized to aPoint.
Precondition
aPoint must belong to the range.

Definition at line 172 of file HyperRectDomain.h.

173  {
174  ASSERT_MSG(
175  isInside(aPoint) || aPoint == myLowerBound || aPoint == myUpperBound,
176  "The point must be inside the domain or be equal to one of his bound."
177  );
178 
179  return ConstIterator(aPoint, myLowerBound, myUpperBound);
180  }
bool isInside(const Point &p) const
Point myUpperBound
The highest point of the space diagonal.
Point myLowerBound
The lowest point of the space diagonal.
template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CSpace< TSpace >)  )
private
template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::BOOST_STATIC_CONSTANT ( Dimension  ,
dimension  = Space::dimension 
)
template<typename TSpace>
std::string DGtal::HyperRectDomain< TSpace >::className ( ) const

Default drawing style object.

Returns
the dyn. alloc. default style for this object.
the style name used for drawing this object.
template<typename TSpace>
const ConstIterator& DGtal::HyperRectDomain< TSpace >::end ( ) const
inline
template<typename TSpace>
bool DGtal::HyperRectDomain< TSpace >::isEmpty ( ) const
Returns
true if the domain is empty.
template<typename TSpace>
bool DGtal::HyperRectDomain< TSpace >::isInside ( const Point p) const
Parameters
pany point.
Returns
'true' if point [p] is inside this domain.

Referenced by DGtal::HyperRectDomain< Space >::begin(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange(), and DGtal::HyperRectDomain< Space >::rbegin().

template<typename TSpace>
bool DGtal::HyperRectDomain< TSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TSpace>
const Point& DGtal::HyperRectDomain< TSpace >::lowerBound ( ) const

Returns the lowest point of the space diagonal.

Referenced by DGtal::Shortcuts< TKSpace >::getKSpace().

template<typename TSpace>
HyperRectDomain& DGtal::HyperRectDomain< TSpace >::operator= ( const HyperRectDomain< TSpace > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.
template<typename TSpace>
const Predicate& DGtal::HyperRectDomain< TSpace >::predicate ( ) const
Returns
a const reference to the "IsInside" predicate.

NB: Could have used template class DomainPredicate but, for performance reason, directly used the IsWithinPointPredicate which fits perfectly.

template<typename TSpace>
ConstReverseIterator DGtal::HyperRectDomain< TSpace >::rbegin ( ) const
inline

reverse begin method.

Returns
ConstIterator on the beginning of the reverse range.

Definition at line 195 of file HyperRectDomain.h.

196  {
197  return ConstReverseIterator(end());
198  }
const ConstIterator & end() const
ReverseIterator ConstReverseIterator
template<typename TSpace>
ConstReverseIterator DGtal::HyperRectDomain< TSpace >::rbegin ( const Point aPoint) const
inline

reverse begin method from a given point.

Parameters
aPointthe initial point.
Returns
a ConstIterator initialized to aPoint.
Precondition
aPoint must belong to the range.

Definition at line 206 of file HyperRectDomain.h.

207  {
208  ASSERT_MSG(
209  isInside(aPoint) || aPoint == myLowerBound || aPoint == myUpperBound,
210  "The point must be inside the domain or be equal to one of his bound."
211  );
212 
213  ConstIterator it(begin(aPoint)); ++it;
214  return ConstReverseIterator(it);
215  }
const ConstIterator & begin() const
bool isInside(const Point &p) const
ReverseIterator ConstReverseIterator
Point myUpperBound
The highest point of the space diagonal.
Point myLowerBound
The lowest point of the space diagonal.
template<typename TSpace>
ConstReverseIterator DGtal::HyperRectDomain< TSpace >::rend ( ) const
inline

reverse end method.

Returns
ConstIterator on the end of the reverse range.

Definition at line 221 of file HyperRectDomain.h.

222  {
223  return ConstReverseIterator(begin());
224  }
const ConstIterator & begin() const
ReverseIterator ConstReverseIterator
template<typename TSpace>
void DGtal::HyperRectDomain< TSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TSpace>
Size DGtal::HyperRectDomain< TSpace >::size ( ) const
inline
Returns
the size (number of points) of the HyperRectDomain

Definition at line 550 of file HyperRectDomain.h.

551  {
552  Size res = 1;
553  Point p = Point::diagonal(1);
554  Vector e = (myUpperBound - myLowerBound) + p;
555  typename Vector::ConstIterator it, itEnd;
556  for ( it = e.begin(), itEnd = e.end(); it != itEnd; ++it)
557  {
558  res *= *it;
559  }
560  return res;
561  }
static Self diagonal(Component val=1)
Container::const_iterator ConstIterator
Definition: PointVector.h:182
Point myUpperBound
The highest point of the space diagonal.
Point myLowerBound
The lowest point of the space diagonal.
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( const std::vector< Dimension > &  permutation) const
inline

get a subRange.

Parameters
permutationa vector containing the dimensions used for the subrange. Dimensions are iterated in the given order.
Returns
a sub-range of the domain for the given permutation.

Definition at line 457 of file HyperRectDomain.h.

Referenced by DGtal::ImageFactoryFromHDF5< TImageContainer >::flushImage().

458  {
459  return ConstSubRange(*this, permutation, myLowerBound);
460  }
Point myLowerBound
The lowest point of the space diagonal.
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( const std::vector< Dimension > &  permutation,
const Point startingPoint 
) const
inline

get a subRange from an initial point.

Parameters
permutationa vector containing the dimensions used for the subrange. Dimensions are iterated in the given order.
startingPointthe initial point.
Returns
a sub-range of the domain for the given permutation.
Precondition
startingPoint must belong to the range.

Definition at line 470 of file HyperRectDomain.h.

472  {
473  return ConstSubRange(*this, permutation, startingPoint);
474  }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( Dimension  adim,
const Point startingPoint 
) const
inline

get a subRange of one dimension.

Parameters
adimthe dimension of the subrange.
startingPointthe initial point.
Returns
a sub-range of the domain for the given dimension.
Precondition
startingPoint must belong to the range.

Definition at line 483 of file HyperRectDomain.h.

485  {
486  return ConstSubRange(*this, adim, startingPoint);
487  }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( Dimension  adim1,
Dimension  adim2,
const Point startingPoint 
) const
inline

get a subRange of two dimensions.

Parameters
adim1the first dimension of the subrange.
adim2the second dimension of the subrange.
startingPointthe initial point.
Returns
a sub-range of the domain for the given two dimensions.
Precondition
startingPoint must belong to the range.

Definition at line 497 of file HyperRectDomain.h.

499  {
500  return ConstSubRange(*this, adim1, adim2, startingPoint);
501  }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( Dimension  adim1,
Dimension  adim2,
Dimension  adim3,
const Point startingPoint 
) const
inline

get a subRange of three dimensions.

Parameters
adim1the first dimension of the subrange.
adim2the second dimension of the subrange.
adim3the third dimension of the subrange.
startingPointthe initial point.
Returns
a sub-range of the domain for the given three dimensions.
Precondition
startingPoint must belong to the range.

Definition at line 512 of file HyperRectDomain.h.

514  {
515  return ConstSubRange(*this, adim1, adim2, adim3, startingPoint);
516  }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( std::initializer_list< Dimension permutation)
inline

get a subRange.

Parameters
permutationan initializer_list containing the dimensions used for the subrange. Dimensions are iterated in the given order.
Returns
a sub-range of the domain for the given permutation.

Definition at line 524 of file HyperRectDomain.h.

525  {
526  return ConstSubRange(*this, permutation, myLowerBound);
527  }
Point myLowerBound
The lowest point of the space diagonal.
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( std::initializer_list< Dimension permutation,
const Point startingPoint 
)
inline

get a subRange from an initial point.

Parameters
permutationan initializer_list containing the dimensions used for the subrange. Dimensions are iterated in the given order.
startingPointthe initial point.
Returns
a sub-range of the domain for the given permutation.
Precondition
startingPoint must belong to the range.

Definition at line 537 of file HyperRectDomain.h.

539  {
540  return ConstSubRange(*this, permutation, startingPoint);
541  }
template<typename TSpace>
const Point& DGtal::HyperRectDomain< TSpace >::upperBound ( ) const

Returns the highest point of the space diagonal.

Referenced by DGtal::Shortcuts< TKSpace >::getKSpace().

Field Documentation

template<typename TSpace>
ConstIterator DGtal::HyperRectDomain< TSpace >::myIteratorBegin
private

Begin iterator.

Definition at line 642 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< Space >::begin().

template<typename TSpace>
ConstIterator DGtal::HyperRectDomain< TSpace >::myIteratorEnd
private

End iterator.

Definition at line 644 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< Space >::end().

template<typename TSpace>
Point DGtal::HyperRectDomain< TSpace >::myLowerBound
template<typename TSpace>
Predicate DGtal::HyperRectDomain< TSpace >::myPredicate
private

"IsInside" predicate.

Definition at line 639 of file HyperRectDomain.h.

template<typename TSpace>
Point DGtal::HyperRectDomain< TSpace >::myUpperBound

The highest point of the space diagonal.

Definition at line 634 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< Space >::begin(), DGtal::HyperRectDomain< Space >::rbegin(), and DGtal::HyperRectDomain< Space >::size().


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