DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Data Structures | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
DGtal::ImageContainerBySTLVector< TDomain, TValue > Class Template Reference

#include <ImageContainerBySTLVector.h>

Inheritance diagram for DGtal::ImageContainerBySTLVector< TDomain, TValue >:
Inheritance graph
[legend]
Collaboration diagram for DGtal::ImageContainerBySTLVector< TDomain, TValue >:
Collaboration graph
[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 vector< Value >::iterator Iterator
typedef vector< Value >
::const_iterator 
ConstIterator
typedef vector< Value >
::reverse_iterator 
ReverseIterator
typedef vector< Value >
::const_reverse_iterator 
ConstReverseIterator
typedef vector< Value >
::difference_type 
Difference
typedef vector< Value >::iterator OutputIterator
typedef vector< Value >
::reverse_iterator 
ReverseOutputIterator
typedef
SimpleRandomAccessConstRangeFromPoint
< ConstIterator,
DistanceFunctorFromPoint< Self > > 
ConstRange
typedef
SimpleRandomAccessRangeFromPoint
< ConstIterator, Iterator,
DistanceFunctorFromPoint< Self > > 
Range

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CDomain< TDomain >))
 BOOST_STATIC_ASSERT ((boost::is_same< Domain, HyperRectDomain< SpaceND< dimension, Integer > > >::value))
 BOOST_CONCEPT_ASSERT ((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

Static Public Attributes

static const Domain::Dimension dimension = Domain::dimension

Private Attributes

Domain myDomain
Vector myExtent

Additional Inherited Members

- Data Fields inherited from std::vector< T >
elements

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:
geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, io/digitalSetFromVol.cpp, io/display3DToOFF.cpp, topology/3dBorderExtractionImg.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, topology/frontierAndBoundary.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, and tutorial-examples/freemanChainFromImage.cpp.

Definition at line 126 of file ImageContainerBySTLVector.h.


Member Typedef Documentation

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

Definition at line 266 of file ImageContainerBySTLVector.h.

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

Definition at line 275 of file ImageContainerBySTLVector.h.

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

Definition at line 268 of file ImageContainerBySTLVector.h.

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

Definition at line 269 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 vector<Value>::iterator DGtal::ImageContainerBySTLVector< TDomain, TValue >::Iterator

Definition at line 265 of file ImageContainerBySTLVector.h.

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

Definition at line 271 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 276 of file ImageContainerBySTLVector.h.

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

Definition at line 267 of file ImageContainerBySTLVector.h.

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

Definition at line 272 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 152 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>
ImageContainerBySTLVector::ImageContainerBySTLVector ( const Domain aDomain)
inline

Constructor from a Domain

Parameters:
aDomainthe image domain.

Definition at line 48 of file ImageContainerBySTLVector.ih.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::myDomain.

:
myDomain(aDomain), myExtent(aDomain.extent())
{
this->resize( myDomain.size() );
}
template<typename Domain , typename T >
DGtal::ImageContainerBySTLVector< Domain, T >::ImageContainerBySTLVector ( const ImageContainerBySTLVector< TDomain, TValue > &  other)
inline

Copy constructor

Parameters:
otherthe object to copy.

Definition at line 58 of file ImageContainerBySTLVector.ih.

: vector<T>(other),
myDomain(other.myDomain), myExtent(other.myExtent)
{
}
template<typename Domain , typename T >
DGtal::ImageContainerBySTLVector< Domain, T >::~ImageContainerBySTLVector ( )
inline

Destructor.

Definition at line 83 of file ImageContainerBySTLVector.ih.

{
}

Member Function Documentation

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

domain

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

range of values

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

domain should be rectangular

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

Definition at line 187 of file ImageContainerBySTLVector.ih.

{
return "ImageContainerBySTLVector";
}
template<typename Domain , typename T >
DGtal::ImageContainerBySTLVector< Domain, T >::ConstRange DGtal::ImageContainerBySTLVector< Domain, T >::constRange ( ) const
inline
Returns:
the range providing begin and end iterators to scan the values of image.

Definition at line 132 of file ImageContainerBySTLVector.ih.

{
return ConstRange( this->begin(), this->end(), DistanceFunctorFromPoint<Self>(this));
}
template<typename Domain , typename T >
const DGtal::ImageContainerBySTLVector< Domain, T >::Domain & DGtal::ImageContainerBySTLVector< Domain, T >::domain ( ) const
inline
Returns:
the domain associated to the image.

Definition at line 123 of file ImageContainerBySTLVector.ih.

{
return myDomain;
}
template<typename Domain , typename T >
DGtal::ImageContainerBySTLVector< Domain, T >::Vector DGtal::ImageContainerBySTLVector< Domain, T >::extent ( ) const
inline
Returns:
the domain extension of the image.

Definition at line 149 of file ImageContainerBySTLVector.ih.

{
return myExtent;
}
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 509 of file ImageContainerBySTLVector.h.

{
return ( *it );
};
template<typename Domain , typename T >
bool DGtal::ImageContainerBySTLVector< Domain, T >::isValid ( ) const
inline
Returns:
the validity of the Image

Definition at line 177 of file ImageContainerBySTLVector.ih.

{
return (this != NULL);
}
template<typename TDomain, typename TValue>
ImageContainerBySTLVector< Domain, T >::Size ImageContainerBySTLVector::linearized ( const Point aPoint) const
inline

Linearized a point and return the vector position.

Parameters:
aPointthe point to convert to an index
Returns:
the index of
Parameters:
aPointin the container

Definition at line 304 of file ImageContainerBySTLVector.ih.

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

{
return linearizer<Domain, Domain::dimension >::apply( aPoint,
myDomain.lowerBound(),
}
template<typename Domain , typename T >
T DGtal::ImageContainerBySTLVector< Domain, T >::operator() ( const Point aPoint) const
inline

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.

Definition at line 92 of file ImageContainerBySTLVector.ih.

{
ASSERT(this->domain().isInside(aPoint));
return this->operator[](linearized( aPoint ) );
}
template<typename Domain , typename T >
DGtal::ImageContainerBySTLVector< Domain, T > & DGtal::ImageContainerBySTLVector< Domain, T >::operator= ( const ImageContainerBySTLVector< TDomain, TValue > &  other)
inline

Assignment operator

Parameters:
otherthe object to copy.
Returns:
a reference on *this

Definition at line 68 of file ImageContainerBySTLVector.ih.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::myDomain, and DGtal::ImageContainerBySTLVector< TDomain, TValue >::myExtent.

{
if (this != &other)
{
myDomain = other.myDomain;
myExtent = other.myExtent;
}
return *this;
}
template<typename Domain , typename T >
ImageContainerBySTLVector< Domain, T >::Range DGtal::ImageContainerBySTLVector< Domain, T >::range ( )
inline
Returns:
the range providing begin and end iterators to scan the values of image.

Definition at line 141 of file ImageContainerBySTLVector.ih.

{
return Range ( this->begin(), this->end(), DistanceFunctorFromPoint<Self>(this) );
}
template<typename TDomain , typename V >
void DGtal::ImageContainerBySTLVector< TDomain, V >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 167 of file ImageContainerBySTLVector.ih.

{
out << "[Image - STLVector] size=" << this->size() << " valuetype="
<< sizeof(V) << "bytes Domain=" << myDomain;
}
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.

Referenced by DGtal::VoronoiMap< TSpace, TPointPredicate, p >::compute(), DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::computeFirstStep1D(), DGtal::VoronoiMap< TSpace, TPointPredicate, p >::computeOtherStep1D(), and DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::computeOtherStep1D().

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

{
it.setValue ( aValue );
}
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 481 of file ImageContainerBySTLVector.h.

Referenced by DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::computeOtherStep1D().

{
return SpanIterator ( aPoint, aDimension, this );
}
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 496 of file ImageContainerBySTLVector.h.

Referenced by DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::computeOtherStep1D().

{
Point tmp = aPoint;
tmp[ aDimension ] = myDomain.upperBound() [ aDimension ] + 1;
return SpanIterator ( tmp, aDimension, this );
}
template<typename Domain , typename T >
void DGtal::ImageContainerBySTLVector< Domain, T >::translateDomain ( const Vector aShift)
inline

Translate the underlying domain by aShift

Parameters:
aShiftany vector

Definition at line 158 of file ImageContainerBySTLVector.ih.

Referenced by DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::compute().

{
myDomain = Domain(myDomain.lowerBound()+aShift, myDomain.upperBound()+aShift);
}

Field Documentation

template<typename TDomain, typename TValue>
const Domain::Dimension DGtal::ImageContainerBySTLVector< TDomain, TValue >::dimension = Domain::dimension
static

static constants

Definition at line 144 of file ImageContainerBySTLVector.h.

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

Image domain.

Definition at line 161 of file ImageContainerBySTLVector.h.

Referenced by DGtal::ImageContainerBySTLVector< TDomain, TValue >::ImageContainerBySTLVector(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::operator=(), and DGtal::ImageContainerBySTLVector< Domain, Value >::spanEnd().

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

Domain extent (stored for linearization efficiency)

Definition at line 164 of file ImageContainerBySTLVector.h.

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


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