29#if defined(ArrayImageAdapter_RECURSES)
30#error Recursive header files inclusion detected in ArrayImageAdapter.h
33#define ArrayImageAdapter_RECURSES
35#if !defined ArrayImageAdapter_h
37#define ArrayImageAdapter_h
41#include <boost/concept/assert.hpp>
42#include <boost/iterator/iterator_concepts.hpp>
46#include <DGtal/base/Common.h>
47#include <DGtal/images/CConstImage.h>
48#include <DGtal/images/ArrayImageIterator.h>
49#include <DGtal/base/IteratorCompletion.h>
50#include <DGtal/kernel/domains/Linearizer.h>
68 typename TArrayIterator,
71 class ArrayImageAdapter;
113 typename TArrayIterator,
117 :
public IteratorCompletion< ArrayImageAdapter< TArrayIterator, HyperRectDomain<TSpace> > >
127 using Value =
typename std::iterator_traits<ArrayIterator>::value_type;
128 using Reference =
typename std::iterator_traits<ArrayIterator>::reference;
172 "The viewable domain must be included into the full domain."
229 "The point is outside the full domain."
245 "The point is outside the full domain."
329 "linearized index out of bounds !"
344 "linearized index out of bounds !"
384 typename TArrayIterator,
390 using Self = ArrayImageAdapter<TArrayIterator, TDomain>;
420 "The point is outside the domain !"
440 typename TArrayIterator,
444 operator<< ( std::ostream & out,
const ArrayImageAdapter<TArrayIterator, TDomain> &
object )
446 object.selfDisplay( out );
461 typename TArrayIterator,
464 ArrayImageAdapter< TArrayIterator, TDomain >
467 return { anArrayIterator, aFullDomain, aViewDomain };
479 typename TArrayIterator,
482 ArrayImageAdapter< TArrayIterator, TDomain >
485 return { anArrayIterator, aFullDomain, aFullDomain };
495 typename TDomain =
typename TImage::Domain
499 ArrayImageAdapter<
decltype( ((TImage*)
nullptr)->begin() ), TDomain >
505 return { anImage.begin(), anImage.domain(), aViewDomain };
516 typename TDomain =
typename TImage::Domain
520 ArrayImageAdapter<
decltype( ((TImage*)
nullptr)->begin() ), TDomain >
526 return { anImage.begin(), anImage.domain(), anImage.domain() };
537#undef ArrayImageAdapter_RECURSES
ConstIterator cend() const
ArrayImageAdapter(ArrayIterator anArrayIterator, Domain const &aFullDomain, Domain const &aViewDomain)
Value getValue(Point const &aPoint) const
typename IteratorCompletionTraits< Self >::Iterator Iterator
Mutable iterator based on ArrayImageIterator.
typename IteratorCompletionTraits< Self >::ConstIterator ConstIterator
Constant iterator base on ArrayImageIterator.
Domain fullDomain() const
typename std::iterator_traits< ArrayIterator >::value_type Value
The value type stored in the image.
Domain myFullDomain
Definition (full) domain.
TArrayIterator ArrayIterator
The given random-access iterator's type.
typename std::iterator_traits< ArrayIterator >::reference Reference
Mutable reference type.
ConstReference dereference(Point const &, typename Point::Coordinate aFullIndex) const
Reference dereference(Point const &, typename Point::Coordinate aFullIndex)
typename Domain::Integer Integer
Integer type.
typename Domain::Dimension Dimension
Dimension type.
ArrayImageAdapter(Self const &other, Domain const &aViewDomain)
typename Domain::Size Size
Size type.
Domain myViewDomain
Viewable domain.
BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversalConcept< TArrayIterator >))
typename Domain::Point Point
Point type.
ConstIterator cbegin() const
DGtal::Linearizer< Domain, ColMajorStorage > Linearizer
Linearization of the points.
void setValue(Point const &aPoint, Value aValue)
typename Domain::Vector Vector
Vector type.
ConstIterator end() const
void selfDisplay(std::ostream &out) const
BOOST_STATIC_CONSTANT(Dimension, dimension=Domain::dimension)
Rank of the space.
ArrayIterator myArrayIterator
Pointer to the allocated memory.
ConstIterator begin() const
ArrayImageAdapter(ArrayIterator anArrayIterator, Domain const &aFullDomain)
ArrayImageAdapter< TArrayIterator, HyperRectDomain< TSpace > > Self
Self type.
HyperRectDomain< TSpace > Domain
Domain type.
const Reference ConstReference
Constant reference type.
friend class ArrayImageIterator
Aim: Random access iterator over an image given his definition domain and viewable domain.
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
const Point & lowerBound() const
const Point & upperBound() const
Space::Dimension Dimension
Domain myDomain
Stored domain to avoid iterator corruption if domain changed.
typename Self::Difference Difference
Type of the difference between two iterators.
typename Self::Domain Domain
Domain type.
DistanceFunctor(Self const *anImage)
typename Self::Point Point
Point type.
ArrayImageAdapter< TArrayIterator, TDomain > Self
Self type.
ArrayImageIterator< const Self > ConstIterator
Constant iterator.
ArrayImageIterator< Self > Iterator
Mutable iterator.
Aim: Traits that must be specialized for each IteratorCompletion derived class.
Aim: Class that uses CRTP to add reverse iterators and ranges to a derived class.
bool isLower(const PointVector< dim, OtherComponent, OtherStorage > &p) const
Return true if this point is below a given point.
bool isUpper(const PointVector< dim, OtherComponent, OtherStorage > &p) const
Return true if this point is upper a given point.
DGtal is the top-level namespace which contains all DGtal functions and types.
ArrayImageAdapter< TArrayIterator, TDomain > makeArrayImageAdapterFromIterator(TArrayIterator anArrayIterator, TDomain const &aFullDomain, TDomain const &aViewDomain)
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
ArrayImageAdapter< decltype(((TImage *) nullptr) ->begin()), TDomain > makeArrayImageAdapterFromImage(TImage &anImage, TDomain const &aViewDomain)
Aim: Linearization and de-linearization interface for domains.
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/RandomAccessTraversal....