Image Component Library (ICL)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
icl::core::DataSegment< T, N > Struct Template Reference

The DataSegment class defines a strided data segment (or 1D or 2D ordred array of vectors) More...

#include <DataSegment.h>

Inheritance diagram for icl::core::DataSegment< T, N >:
icl::core::DataSegmentBase

Public Types

typedef math::FixedColVector< T, N > VectorType
 vector typedef More...
 

Public Member Functions

 DataSegment (T *data=0, size_t stride=0, size_t numElements=0, icl32s organizedWidth=-1)
 Constructor (basically passes all parameters to the Base class) More...
 
math::FixedColVector< T, N > & operator[] (int idx)
 linear index operator More...
 
const math::FixedColVector< T, N > & operator[] (int idx) const
 linear index operator (const) More...
 
math::FixedColVector< T, N > & operator() (int x, int y)
 2D-index operator (only for organized data segments) More...
 
const math::FixedColVector< T, N > & operator() (int x, int y) const
 2D-index operator (only for organized data segments, const) More...
 
template<class OtherT >
void deepCopy (DataSegment< OtherT, N > dst) const
 copies the data segment to into another element-wise More...
 
bool isPacked () const
 returns whether the data is packed in memory (stride is sizeof(T)*N) More...
 
template<class OtherT >
bool equals (DataSegment< OtherT, N > dst, float tollerance=1.0e-5) const
 compares two data segments element wise given given maximun tollerance More...
 
template<class Fill >
void fillScalar (Fill scalarValue)
 fills each scalar value of each entry with given value More...
 
template<class Fill >
void fill (Fill vecValue)
 fills each vector entry with given value More...
 
- Public Member Functions inherited from icl::core::DataSegmentBase
bool isOrganized () const
 returns, whether the segment is 2D-organized More...
 
utils::Size getSize () const
 returns the ordred size of the segment of utils::Size::null if it's not organized More...
 
int getStride () const
 returns the internal stride used More...
 
int getDim () const
 returns the number of elements More...
 
core::depth getDepth () const
 returns the actual core::depth (data type) of the entries More...
 
int getElemDim () const
 returns the dimension of the contained elements More...
 
icl8ugetDataPointer ()
 returns the internal (strided) data pointer More...
 
const icl8ugetDataPointer () const
 returns the internal (strided) data pointer More...
 
 DataSegmentBase (void *data=0, size_t stride=0, size_t numElements=0, icl32s organizedWidth=-1, core::depth dataDepth=core::depth8u, size_t elemDim=0)
 Constructor with given parameters. More...
 
template<class T , int N>
const DataSegment< T, N > & as () const
 shallow and save cast from data segment base to special data segment version More...
 
Bytes operator[] (int idx)
 linear index operator More...
 
const Bytes operator[] (int idx) const
 linear index operator (const) More...
 
Bytes operator() (int x, int y)
 2D-index operator (only for organized data segments) More...
 
const Bytes operator() (int x, int y) const
 2D-index operator (only for organized data segments, const) More...
 

Static Public Member Functions

static DataSegment< T, N > fromVector (std::vector< T > &v)
 wrapps a data-segment around an std::vector More...
 
static const DataSegment< T, N > fromVector (const std::vector< T > &v)
 wrapps a data-segment around an std::vector (const version) More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from icl::core::DataSegmentBase
static int getSizeOf (core::depth d)
 associcates a core::depth values and the (byte)-size of the corresponding type More...
 
- Protected Attributes inherited from icl::core::DataSegmentBase
icl8udata
 data pointer orign More...
 
size_t stride
 stride between elements More...
 
size_t numElements
 number of vector elements contained More...
 
icl32s organizedWidth
 if > 0 , the data is 2D-organized More...
 
core::depth dataDepth
 underlying data depth More...
 
size_t elemDim
 vector element dim More...
 

Detailed Description

template<class T, int N>
struct icl::core::DataSegment< T, N >

The DataSegment class defines a strided data segment (or 1D or 2D ordred array of vectors)

Each data segment is defined by

Each single vector is assumed to be packed in memory (e.g. the vector element stride is always sizeof(T)) the distance between two vector entries can be set to an arbitrary constant value (stride). Optionally, an organizedWidth value > 0 can be given, which set up the DataSegement to be 2D-organized.

Member Typedef Documentation

◆ VectorType

template<class T, int N>
typedef math::FixedColVector<T,N> icl::core::DataSegment< T, N >::VectorType

vector typedef

Constructor & Destructor Documentation

◆ DataSegment()

template<class T, int N>
icl::core::DataSegment< T, N >::DataSegment ( T *  data = 0,
size_t  stride = 0,
size_t  numElements = 0,
icl32s  organizedWidth = -1 
)
inline

Constructor (basically passes all parameters to the Base class)

Member Function Documentation

◆ deepCopy()

template<class T, int N>
template<class OtherT >
void icl::core::DataSegment< T, N >::deepCopy ( DataSegment< OtherT, N >  dst) const
inline

copies the data segment to into another element-wise

◆ equals()

template<class T, int N>
template<class OtherT >
bool icl::core::DataSegment< T, N >::equals ( DataSegment< OtherT, N >  dst,
float  tollerance = 1.0e-5 
) const
inline

compares two data segments element wise given given maximun tollerance

If the source and destination segments have different dimensions, isOrganized flag or organized-size, the check returns always false

◆ fill()

template<class T, int N>
template<class Fill >
void icl::core::DataSegment< T, N >::fill ( Fill  vecValue)
inline

fills each vector entry with given value

value is a template parameter, so it can also be a class that can be converted to T elements.

◆ fillScalar()

template<class T, int N>
template<class Fill >
void icl::core::DataSegment< T, N >::fillScalar ( Fill  scalarValue)
inline

fills each scalar value of each entry with given value

value is a template parameter, so it can also be a class that can be converted to T elements

DataSegment<float,4> ds = ..;
fill(ds,URand(0,255));

◆ fromVector() [1/2]

template<class T, int N>
static DataSegment<T,N> icl::core::DataSegment< T, N >::fromVector ( std::vector< T > &  v)
inlinestatic

wrapps a data-segment around an std::vector

if N is not 1, a size of the data-segment becomes v.size()/N, so it uses N consecutive elements of the vector for each entry

◆ fromVector() [2/2]

template<class T, int N>
static const DataSegment<T,N> icl::core::DataSegment< T, N >::fromVector ( const std::vector< T > &  v)
inlinestatic

wrapps a data-segment around an std::vector (const version)

if N is not 1, a size of the data-segment becomes v.size()/N, so it uses N consecutive elements of the vector for each entry

◆ isPacked()

template<class T, int N>
bool icl::core::DataSegment< T, N >::isPacked ( ) const
inline

returns whether the data is packed in memory (stride is sizeof(T)*N)

◆ operator()() [1/2]

template<class T, int N>
math::FixedColVector<T,N>& icl::core::DataSegment< T, N >::operator() ( int  x,
int  y 
)
inline

2D-index operator (only for organized data segments)

◆ operator()() [2/2]

template<class T, int N>
const math::FixedColVector<T,N>& icl::core::DataSegment< T, N >::operator() ( int  x,
int  y 
) const
inline

2D-index operator (only for organized data segments, const)

◆ operator[]() [1/2]

template<class T, int N>
math::FixedColVector<T,N>& icl::core::DataSegment< T, N >::operator[] ( int  idx)
inline

linear index operator

◆ operator[]() [2/2]

template<class T, int N>
const math::FixedColVector<T,N>& icl::core::DataSegment< T, N >::operator[] ( int  idx) const
inline

linear index operator (const)


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