DGtal  1.2.beta
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]

Data Structures

class  SpanIterator
 

Public Types

typedef ImageContainerBySTLVector< TDomain, TValue > Self
 
typedef std::vector< TValue > Parent
 
typedef Parent Container
 
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 >))
 domain More...
 
 BOOST_STATIC_CONSTANT (Dimension, dimension=Domain::Space::dimension)
 
 BOOST_STATIC_ASSERT ((boost::is_same< Domain, HyperRectDomain< typename Domain::Space > >::value))
 domain should be rectangular More...
 
 BOOST_CONCEPT_ASSERT ((concepts::CLabel< TValue >))
 range of values More...
 
 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
 
const Vectorextent () const
 
void translateDomain (const Vector &aShift)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 
ConstRange constRange () const
 
Range range ()
 
const Containercontainer () const
 
Containercontainer ()
 
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
 Image domain. More...
 
Vector myExtent
 Domain extent (stored for linearization efficiency) More...
 

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-8-2DSliceImages.cpp, io/viewers/viewer3D-8bis-2Dimages.cpp, io/viewers/viewer3D-9-3Dimages.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.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

◆ ConstIterator

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

Definition at line 265 of file ImageContainerBySTLVector.h.

◆ ConstRange

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

Definition at line 274 of file ImageContainerBySTLVector.h.

◆ ConstReverseIterator

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

Definition at line 267 of file ImageContainerBySTLVector.h.

◆ Container

template<typename TDomain, typename TValue>
typedef Parent DGtal::ImageContainerBySTLVector< TDomain, TValue >::Container

Definition at line 133 of file ImageContainerBySTLVector.h.

◆ Difference

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

Definition at line 268 of file ImageContainerBySTLVector.h.

◆ Dimension

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

Definition at line 142 of file ImageContainerBySTLVector.h.

◆ Domain

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

Definition at line 137 of file ImageContainerBySTLVector.h.

◆ Integer

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

Definition at line 140 of file ImageContainerBySTLVector.h.

◆ Iterator

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

Definition at line 264 of file ImageContainerBySTLVector.h.

◆ OutputIterator

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

Definition at line 270 of file ImageContainerBySTLVector.h.

◆ Parent

template<typename TDomain, typename TValue>
typedef std::vector<TValue> DGtal::ImageContainerBySTLVector< TDomain, TValue >::Parent

Definition at line 132 of file ImageContainerBySTLVector.h.

◆ Point

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

Definition at line 138 of file ImageContainerBySTLVector.h.

◆ Range

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

Definition at line 275 of file ImageContainerBySTLVector.h.

◆ ReverseIterator

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

Definition at line 266 of file ImageContainerBySTLVector.h.

◆ ReverseOutputIterator

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

Definition at line 271 of file ImageContainerBySTLVector.h.

◆ Self

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

Definition at line 131 of file ImageContainerBySTLVector.h.

◆ Size

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

Definition at line 141 of file ImageContainerBySTLVector.h.

◆ Value

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

Definition at line 153 of file ImageContainerBySTLVector.h.

◆ Vector

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

Definition at line 139 of file ImageContainerBySTLVector.h.

◆ Vertex

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

Definition at line 143 of file ImageContainerBySTLVector.h.

Constructor & Destructor Documentation

◆ ImageContainerBySTLVector() [1/2]

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

Constructor from a Domain

Parameters
aDomainthe image domain.

◆ ImageContainerBySTLVector() [2/2]

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::ImageContainerBySTLVector ( const ImageContainerBySTLVector< TDomain, TValue > &  other)

Copy constructor

Parameters
otherthe object to copy.

◆ ~ImageContainerBySTLVector()

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::~ImageContainerBySTLVector ( )

Destructor.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/2]

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

domain

◆ BOOST_CONCEPT_ASSERT() [2/2]

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

range of values

◆ BOOST_STATIC_ASSERT()

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

◆ BOOST_STATIC_CONSTANT()

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::BOOST_STATIC_CONSTANT ( Dimension  ,
dimension  = Domain::Space::dimension 
)

◆ className()

template<typename TDomain, typename TValue>
std::string DGtal::ImageContainerBySTLVector< TDomain, TValue >::className ( ) const
Returns
the style name used for drawing this object.

◆ constRange()

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.

◆ container() [1/2]

template<typename TDomain, typename TValue>
const Container& DGtal::ImageContainerBySTLVector< TDomain, TValue >::container ( ) const
inline

Give access to the underlying container.

Returns
a (might be const) reference to the container.

Definition at line 293 of file ImageContainerBySTLVector.h.

293 { return static_cast<Parent>(*this); };

◆ container() [2/2]

template<typename TDomain, typename TValue>
Container& DGtal::ImageContainerBySTLVector< TDomain, TValue >::container ( )
inline

Give access to the underlying container.

Returns
a (might be const) reference to the container.

Definition at line 298 of file ImageContainerBySTLVector.h.

298 { return static_cast<Parent>(*this); };

◆ domain()

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

◆ extent()

template<typename TDomain, typename TValue>
const Vector& DGtal::ImageContainerBySTLVector< TDomain, TValue >::extent ( ) const
Returns
the domain extension of the image.

Referenced by cmpTranslatedFFT(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurface(), and testFFTScaling().

◆ getValue()

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 517 of file ImageContainerBySTLVector.h.

518  {
519  return ( *it );
520  };

◆ isValid()

template<typename TDomain, typename TValue>
bool DGtal::ImageContainerBySTLVector< TDomain, TValue >::isValid ( ) const
Returns
the validity of the Image

◆ linearized()

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().

◆ operator()()

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.

◆ operator=()

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

◆ range()

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.

◆ selfDisplay()

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.

◆ setValue() [1/2]

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.

◆ setValue() [2/2]

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 474 of file ImageContainerBySTLVector.h.

475  {
476  it.setValue ( aValue );
477  }

◆ spanBegin()

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 489 of file ImageContainerBySTLVector.h.

490  {
491  return SpanIterator ( aPoint, aDimension, this );
492  }
const Point aPoint(3, 4)

◆ spanEnd()

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 504 of file ImageContainerBySTLVector.h.

505  {
506  Point tmp = aPoint;
507  tmp[ aDimension ] = myDomain.upperBound() [ aDimension ] + 1;
508  return SpanIterator ( tmp, aDimension, this );
509  }
const Point aPoint(3, 4)
MyPointD Point
Definition: testClone2.cpp:383

◆ translateDomain()

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

◆ myDomain

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

◆ myExtent

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

Domain extent (stored for linearization efficiency)

Definition at line 163 of file ImageContainerBySTLVector.h.

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


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