DGtal  0.9.4beta
Data Structures | Public Types | Public Member Functions | Private Attributes
DGtal::ImageContainerBySTLVector< TDomain, TValue > Class Template Reference

#include <DGtal/images/ImageContainerBySTLVector.h>

Inheritance diagram for DGtal::ImageContainerBySTLVector< TDomain, TValue >:
[legend]
Collaboration diagram for DGtal::ImageContainerBySTLVector< TDomain, TValue >:
[legend]

Data Structures

class  SpanIterator
 

Public Types

typedef ImageContainerBySTLVector< TDomain, TValue > Self
 
typedef TDomain Domain
 
typedef Domain::Point Point
 
typedef Domain::Vector Vector
 
typedef Domain::Integer Integer
 
typedef Domain::Size Size
 
typedef Domain::Dimension Dimension
 
typedef Point Vertex
 
typedef TValue Value
 
typedef std::vector< Value >::iterator Iterator
 
typedef std::vector< Value >::const_iterator ConstIterator
 
typedef std::vector< Value >::reverse_iterator ReverseIterator
 
typedef std::vector< Value >::const_reverse_iterator ConstReverseIterator
 
typedef std::vector< Value >::difference_type Difference
 
typedef std::vector< Value >::iterator OutputIterator
 
typedef std::vector< Value >::reverse_iterator ReverseOutputIterator
 
typedef SimpleRandomAccessConstRangeFromPoint< ConstIterator, DistanceFunctorFromPoint< Self > > ConstRange
 
typedef SimpleRandomAccessRangeFromPoint< ConstIterator, Iterator, DistanceFunctorFromPoint< Self > > Range
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDomain< TDomain >))
 
 BOOST_STATIC_CONSTANT (Dimension, dimension=Domain::Space::dimension)
 
 BOOST_STATIC_ASSERT ((boost::is_same< Domain, HyperRectDomain< typename Domain::Space > >::value))
 
 BOOST_CONCEPT_ASSERT ((concepts::CLabel< TValue >))
 
 ImageContainerBySTLVector (const Domain &aDomain)
 
 ImageContainerBySTLVector (const ImageContainerBySTLVector &other)
 
ImageContainerBySTLVectoroperator= (const ImageContainerBySTLVector &other)
 
 ~ImageContainerBySTLVector ()
 
Value operator() (const Point &aPoint) const
 
void setValue (const Point &aPoint, const Value &aValue)
 
const Domaindomain () const
 
Vector extent () const
 
void translateDomain (const Vector &aShift)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 
ConstRange constRange () const
 
Range range ()
 
void setValue (SpanIterator &it, const Value &aValue)
 
SpanIterator spanBegin (const Point &aPoint, const Dimension aDimension)
 
SpanIterator spanEnd (const Point &aPoint, const Dimension aDimension)
 
Value getValue (SpanIterator &it)
 
Size linearized (const Point &aPoint) const
 

Private Attributes

Domain myDomain
 
Vector myExtent
 

Detailed Description

template<typename TDomain, typename TValue>
class DGtal::ImageContainerBySTLVector< TDomain, TValue >

Description of class 'ImageContainerBySTLVector'

Aim: Model of CImage implementing the association Point<->Value using a STL vector as container. A linearization of domain points is used to build the STL vector index.

As a model of CImage, this class provides two ways of accessing values:

This class also provides a setValue() method and an output iterator, which is returned by the outputIterator() method for writing purposes.

Lastly, built-in iterators and a fast span iterator to perform 1D scans are also provided.

Template Parameters
TDomaina HyperRectDomain.
TValueat least a model of CLabel.
See also
testImage.cpp
testImageContainerBenchmark.cpp
Examples:
dec/exampleDECSurface.cpp, examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/exampleGridCurve3d-2.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, geometry/volumes/distance/distancetransform2D.cpp, geometry/volumes/distance/distancetransform3D.cpp, geometry/volumes/distance/exampleFMM3D.cpp, geometry/volumes/distance/toricdomainvolumetric.cpp, graph/volDistanceTraversal.cpp, images/exampleConstImageAdapter.cpp, images/exampleImageFactoryFromHDF5.cpp, images/exampleTiledImage.cpp, images/extract2DImagesFrom3D.cpp, images/extract2DImagesFrom3DandVisu.cpp, images/extract2DSlicesImagesFrom3D.cpp, images/imageBasicSubsampling.cpp, images/raw2HDF5.cpp, io/digitalSetFromVol.cpp, io/display3DToOFF.cpp, io/viewers/viewer3D-8bis-2Dimages.cpp, io/viewers/viewer3D-9-3Dimages.cpp, topology/3dBorderExtractionImg.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/2DSliceImageFromVol.cpp, tutorial-examples/FMMErosion.cpp, tutorial-examples/freemanChainFromImage.cpp, tutorial-examples/polyhedralizer.cpp, and tutorial-examples/volDTGranulo.cpp.

Definition at line 126 of file ImageContainerBySTLVector.h.

Member Typedef Documentation

template<typename TDomain, typename TValue>
typedef std::vector<Value>::const_iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::ConstIterator

Definition at line 263 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef SimpleRandomAccessConstRangeFromPoint<ConstIterator,DistanceFunctorFromPoint<Self> > DGtal::ImageContainerBySTLVector< TDomain, TValue >::ConstRange

Definition at line 272 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::vector<Value>::const_reverse_iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::ConstReverseIterator

Definition at line 265 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::vector<Value>::difference_type DGtal::ImageContainerBySTLVector< TDomain, TValue >::Difference

Definition at line 266 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Domain::Dimension DGtal::ImageContainerBySTLVector< TDomain, TValue >::Dimension

Definition at line 140 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef TDomain DGtal::ImageContainerBySTLVector< TDomain, TValue >::Domain

Definition at line 135 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Domain::Integer DGtal::ImageContainerBySTLVector< TDomain, TValue >::Integer

Definition at line 138 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::vector<Value>::iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::Iterator

Definition at line 262 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::vector<Value>::iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::OutputIterator

Definition at line 268 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Domain::Point DGtal::ImageContainerBySTLVector< TDomain, TValue >::Point

Definition at line 136 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef SimpleRandomAccessRangeFromPoint<ConstIterator,Iterator,DistanceFunctorFromPoint<Self> > DGtal::ImageContainerBySTLVector< TDomain, TValue >::Range

Definition at line 273 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::vector<Value>::reverse_iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::ReverseIterator

Definition at line 264 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::vector<Value>::reverse_iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::ReverseOutputIterator

Definition at line 269 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef ImageContainerBySTLVector<TDomain, TValue> DGtal::ImageContainerBySTLVector< TDomain, TValue >::Self

Definition at line 131 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Domain::Size DGtal::ImageContainerBySTLVector< TDomain, TValue >::Size

Definition at line 139 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef TValue DGtal::ImageContainerBySTLVector< TDomain, TValue >::Value

Definition at line 151 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Domain::Vector DGtal::ImageContainerBySTLVector< TDomain, TValue >::Vector

Definition at line 137 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Point DGtal::ImageContainerBySTLVector< TDomain, TValue >::Vertex

Definition at line 141 of file ImageContainerBySTLVector.h.

Constructor & Destructor Documentation

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::ImageContainerBySTLVector ( const Domain aDomain)

Constructor from a Domain

Parameters
aDomainthe image domain.
template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::ImageContainerBySTLVector ( const ImageContainerBySTLVector< TDomain, TValue > &  other)

Copy constructor

Parameters
otherthe object to copy.
template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::~ImageContainerBySTLVector ( )

Destructor.

Member Function Documentation

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< TDomain >)  )

domain

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::BOOST_CONCEPT_ASSERT ( (concepts::CLabel< TValue >)  )

range of values

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::BOOST_STATIC_ASSERT ( (boost::is_same< Domain, HyperRectDomain< typename Domain::Space > >::value)  )

domain should be rectangular

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::BOOST_STATIC_CONSTANT ( Dimension  ,
dimension  = Domain::Space::dimension 
)
template<typename TDomain, typename TValue>
std::string DGtal::ImageContainerBySTLVector< TDomain, TValue >::className ( ) const
Returns
the style name used for drawing this object.
template<typename TDomain, typename TValue>
ConstRange DGtal::ImageContainerBySTLVector< TDomain, TValue >::constRange ( ) const
Returns
the range providing begin and end iterators to scan the values of image.
template<typename TDomain, typename TValue>
const Domain& DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain ( ) const
Returns
the domain associated to the image.
template<typename TDomain, typename TValue>
Vector DGtal::ImageContainerBySTLVector< TDomain, TValue >::extent ( ) const
Returns
the domain extension of the image.
template<typename TDomain, typename TValue>
Value DGtal::ImageContainerBySTLVector< TDomain, TValue >::getValue ( SpanIterator it)
inline

Returns the value of the image at a given SpanIterator position.

Parameters
itposition given by a SpanIterator.
Returns
an object of type Value.

Definition at line 504 of file ImageContainerBySTLVector.h.

505  {
506  return ( *it );
507  };
template<typename TDomain, typename TValue>
bool DGtal::ImageContainerBySTLVector< TDomain, TValue >::isValid ( ) const
Returns
the validity of the Image
template<typename TDomain, typename TValue>
Size DGtal::ImageContainerBySTLVector< TDomain, TValue >::linearized ( const Point aPoint) const

Linearized a point and return the vector position.

Parameters
aPointthe point to convert to an index
Returns
the index of aPoint in the container

Referenced by DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::SpanIterator().

template<typename TDomain, typename TValue>
Value DGtal::ImageContainerBySTLVector< TDomain, TValue >::operator() ( const Point aPoint) const

Get the value of an image at a given position given by a Point.

Precondition
the point must be in the domain
Parameters
aPointthe point.
Returns
the value at aPoint.
template<typename TDomain, typename TValue>
ImageContainerBySTLVector& DGtal::ImageContainerBySTLVector< TDomain, TValue >::operator= ( const ImageContainerBySTLVector< TDomain, TValue > &  other)

Assignment operator

Parameters
otherthe object to copy.
Returns
a reference on *this
template<typename TDomain, typename TValue>
Range DGtal::ImageContainerBySTLVector< TDomain, TValue >::range ( )
Returns
the range providing begin and end iterators to scan the values of image.
template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue ( const Point aPoint,
const Value aValue 
)

Set a value on an Image at a position specified by a Point.

Precondition
it must be a point in the image domain.
Parameters
aPointthe point.
aValuethe value.
template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue ( SpanIterator it,
const Value aValue 
)
inline

Set a value on an Image at a position specified by an SpanIterator.

Parameters
ititerator on the location.
aValuethe value.

Definition at line 461 of file ImageContainerBySTLVector.h.

462  {
463  it.setValue ( aValue );
464  }
template<typename TDomain, typename TValue>
SpanIterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::spanBegin ( const Point aPoint,
const Dimension  aDimension 
)
inline

Create a begin() SpanIterator at a given position in a given direction.

Parameters
aPointthe starting point of the SpanIterator.
aDimensionthe dimension on which the iterator iterates.
Returns
a SpanIterator

Definition at line 476 of file ImageContainerBySTLVector.h.

477  {
478  return SpanIterator ( aPoint, aDimension, this );
479  }
template<typename TDomain, typename TValue>
SpanIterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::spanEnd ( const Point aPoint,
const Dimension  aDimension 
)
inline

Create an end() SpanIterator at a given position in a given direction.

Parameters
aPointa point belonging to the current image dimension (not necessarily the point used in the span_begin() method.
aDimensionthe dimension on which the iterator iterates.
Returns
a SpanIterator

Definition at line 491 of file ImageContainerBySTLVector.h.

492  {
493  Point tmp = aPoint;
494  tmp[ aDimension ] = myDomain.upperBound() [ aDimension ] + 1;
495  return SpanIterator ( tmp, aDimension, this );
496  }
template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::translateDomain ( const Vector aShift)

Translate the underlying domain by aShift

Parameters
aShiftany vector

Field Documentation

template<typename TDomain, typename TValue>
Domain DGtal::ImageContainerBySTLVector< TDomain, TValue >::myDomain
private

Image domain.

Definition at line 158 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
Vector DGtal::ImageContainerBySTLVector< TDomain, TValue >::myExtent
private

Domain extent (stored for linearization efficiency)

Definition at line 161 of file ImageContainerBySTLVector.h.

Referenced by DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::SpanIterator().


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