DGtal 1.4.0
|
Aim: Random access iterator over an image given his definition domain and viewable domain. More...
#include <DGtal/images/ArrayImageIterator.h>
Public Types | |
using | Self = ArrayImageIterator<TIterableClass> |
Self type. | |
using | IterableClass = TIterableClass |
Iterable class type. | |
using | Domain = typename IterableClass::Domain |
Domain type. | |
using | Point = typename Domain::Point |
Point type. | |
using | Linearizer = DGtal::Linearizer<Domain, ColMajorStorage> |
Linearizer type. | |
using | Reference = decltype( ((new IterableClass)->dereference( Point::diagonal(0), typename Point::Coordinate(0) ) )) |
Return type when dereferencing this iterator. | |
Public Member Functions | |
ArrayImageIterator () | |
Default constructor. | |
ArrayImageIterator (IterableClass *anIterableClassPtr, Domain const &aFullDomain, Domain const &aViewDomain, Point const &aPoint) | |
ArrayImageIterator (IterableClass *anIterableClassPtr, Domain const &aFullDomain, Domain const &aViewDomain) | |
ArrayImageIterator (IterableClass *anIterableClassPtr, Domain const &aFullDomain) | |
ArrayImageIterator (IterableClass *anIterableClassPtr, Domain const &aFullDomain, Domain const &aViewDomain, bool) | |
ArrayImageIterator (IterableClass *anIterableClassPtr, Domain const &aFullDomain, bool) | |
template<typename TOtherIterableClass > | |
ArrayImageIterator (ArrayImageIterator< TOtherIterableClass > const &other, typename std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value >::type *=0) | |
template<typename TOtherIterableClass > | |
ArrayImageIterator (ArrayImageIterator< TOtherIterableClass > &&other, typename std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value >::type *=0) noexcept | |
~ArrayImageIterator () | |
Destructor. | |
template<typename TOtherIterableClass > | |
std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value, Self & >::type | operator= (ArrayImageIterator< TOtherIterableClass > const &other) |
template<typename TOtherIterableClass > | |
std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value, Self & >::type | operator= (ArrayImageIterator< TOtherIterableClass > &&other) |
Point const & | getPoint () const noexcept |
std::ptrdiff_t | distance_to (Point const &aPoint) const noexcept |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Member Functions | |
void | increment () |
Increment of one step. | |
void | decrement () |
Decrement of one step. | |
bool | equal (Self const &other) const |
Reference | dereference () const |
Dereference. | |
std::ptrdiff_t | distance_to (Self const &other) const |
void | advance (std::ptrdiff_t n) |
Private Attributes | |
IterableClass * | myIterableClassPtr |
Pointer to the iterable class. | |
Domain | myFullDomain |
Full domain of the image. | |
Domain | myViewDomain |
Iterable (viewable) domain of the image. | |
Point | myFullExtent |
Extent of the full domain. | |
Point | myViewExtent |
Extent of the viewable domain. | |
Point | myPoint |
Current point where the iterator point to. | |
Point::Coordinate | myFullIndex |
Linearized index of the current point. | |
Friends | |
template<class > | |
class | ArrayImageIterator |
Friendship of interoperability. | |
class | boost::iterator_core_access |
Friendship of interoperability. | |
Aim: Random access iterator over an image given his definition domain and viewable domain.
Description of template class 'ArrayImageIterator'
This iterator spans a viewable domain given an iterable image-like class (see below) defined on a specified full domain. This iterator provides access to the iterable class through classical iterator syntax and, in addition, exposes current point to which the iterator point to. Thus, when it is needed to iterate over an image while knowing the current point ( for example, when filling an image with a formulae that depends on the point), it is faster to use this iterator instead of a classical domain iterator and the use of operator() and setValue.
In order to work, the iterable class must expose a dereference method that, given a point and his linearized index (column-major ordered), returns:
In addition, the iterable class must have Domain typedef.
For an usage example, see ArrayImageAdapter.h .
TIterableClass | Type of the iterable class. |
Definition at line 75 of file ArrayImageIterator.h.
using DGtal::ArrayImageIterator< TIterableClass >::Domain = typename IterableClass::Domain |
Domain type.
Definition at line 89 of file ArrayImageIterator.h.
using DGtal::ArrayImageIterator< TIterableClass >::IterableClass = TIterableClass |
Iterable class type.
Definition at line 88 of file ArrayImageIterator.h.
using DGtal::ArrayImageIterator< TIterableClass >::Linearizer = DGtal::Linearizer<Domain, ColMajorStorage> |
Linearizer type.
Definition at line 91 of file ArrayImageIterator.h.
using DGtal::ArrayImageIterator< TIterableClass >::Point = typename Domain::Point |
Point type.
Definition at line 90 of file ArrayImageIterator.h.
using DGtal::ArrayImageIterator< TIterableClass >::Reference = decltype( ((new IterableClass)->dereference( Point::diagonal(0), typename Point::Coordinate(0) ) )) |
Return type when dereferencing this iterator.
Definition at line 92 of file ArrayImageIterator.h.
using DGtal::ArrayImageIterator< TIterableClass >::Self = ArrayImageIterator<TIterableClass> |
Self type.
Definition at line 87 of file ArrayImageIterator.h.
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | ) |
Default constructor.
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | IterableClass * | anIterableClassPtr, |
Domain const & | aFullDomain, | ||
Domain const & | aViewDomain, | ||
Point const & | aPoint ) |
Iterator from a point.
anIterableClassPtr | Pointer to the iterable class instance. |
aFullDomain | Full domain of the image. |
aViewDomain | Viewable domain that the iterator will span. |
aPoint | Point to which the iterator will point. |
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | IterableClass * | anIterableClassPtr, |
Domain const & | aFullDomain, | ||
Domain const & | aViewDomain ) |
Iterator pointing to the first value.
anIterableClassPtr | Pointer to the iterable class instance. |
aFullDomain | Full domain of the image. |
aViewDomain | Viewable domain that the iterator will span. |
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | IterableClass * | anIterableClassPtr, |
Domain const & | aFullDomain ) |
Iterator pointing to the first value and spanning the whole domain.
anIterableClassPtr | Pointer to the iterable class instance. |
aFullDomain | Full domain of the image. |
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | IterableClass * | anIterableClassPtr, |
Domain const & | aFullDomain, | ||
Domain const & | aViewDomain, | ||
bool | ) |
Iterator pointing after the last value of the viewable domain.
anIterableClassPtr | Pointer to the iterable class instance. |
aFullDomain | Full domain of the image. |
aViewDomain | Viewable domain that the iterator will span. |
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | IterableClass * | anIterableClassPtr, |
Domain const & | aFullDomain, | ||
bool | ) |
Iterator pointing after the last value of the whole domain.
anIterableClassPtr | Pointer to the iterable class instance. |
aFullDomain | Full domain of the image. |
DGtal::ArrayImageIterator< TIterableClass >::ArrayImageIterator | ( | ArrayImageIterator< TOtherIterableClass > const & | other, |
typename std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value >::type * | = 0 ) |
Copy constructor with type interoperability.
other | An another iterator whose iterable class pointer is convertible to the current iterable class pointer type. |
|
noexcept |
Move constructor with type interoperability.
other | An another iterator whose iterable class pointer is convertible to the current iterable class pointer type. |
DGtal::ArrayImageIterator< TIterableClass >::~ArrayImageIterator | ( | ) |
Destructor.
|
private |
|
private |
Decrement of one step.
|
inlineprivate |
Dereference.
|
inlinenoexcept |
aPoint | The point. |
|
inlineprivate |
Calculate the distance to other iterator.
other | The other iterator. |
|
inlineprivate |
Test equality with other iterator.
other | The other iterator. |
|
inlinenoexcept |
|
private |
Increment of one step.
bool DGtal::ArrayImageIterator< TIterableClass >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value, Self & >::type DGtal::ArrayImageIterator< TIterableClass >::operator= | ( | ArrayImageIterator< TOtherIterableClass > && | other | ) |
Move assignment constructor with type interoperability.
TOtherIterableClass | The type of the other iteratable class (auto-deduced). |
other | An another iterator whose iterable class pointer is convertible to the current iterable class pointer type. |
std::enable_if< std::is_convertible< TOtherIterableClass *, IterableClass * >::value, Self & >::type DGtal::ArrayImageIterator< TIterableClass >::operator= | ( | ArrayImageIterator< TOtherIterableClass > const & | other | ) |
Copy assignment with type interoperability.
TOtherIterableClass | The type of the other iterable class (auto-deduced). |
other | An another iterator whose iterable class pointer is convertible to the current iterable class pointer type. |
void DGtal::ArrayImageIterator< TIterableClass >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Friendship of interoperability.
Definition at line 229 of file ArrayImageIterator.h.
|
friend |
Friendship of interoperability.
Definition at line 230 of file ArrayImageIterator.h.
|
private |
Full domain of the image.
Definition at line 218 of file ArrayImageIterator.h.
|
private |
Extent of the full domain.
Definition at line 220 of file ArrayImageIterator.h.
|
private |
Linearized index of the current point.
Definition at line 223 of file ArrayImageIterator.h.
|
private |
Pointer to the iterable class.
Definition at line 217 of file ArrayImageIterator.h.
|
private |
Current point where the iterator point to.
Definition at line 222 of file ArrayImageIterator.h.
|
private |
Iterable (viewable) domain of the image.
Definition at line 219 of file ArrayImageIterator.h.
|
private |
Extent of the viewable domain.
Definition at line 221 of file ArrayImageIterator.h.