OpenWalnut  1.5.0dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
WValueSet< T > Class Template Reference

Base Class for all value set types. More...

#include <WValueSet.h>

+ Inheritance diagram for WValueSet< T >:
+ Collaboration diagram for WValueSet< T >:

Classes

class  SubArray
 A helper class granting safe access to a certain part of the valueset. More...
 

Public Types

typedef T ValueT
 The type of the single value in this value set. More...
 
- Public Types inherited from WValueSetBase
typedef std::shared_ptr< WValueSetBaseSPtr
 Shared pointer to an instance of this class. More...
 
typedef std::shared_ptr< const WValueSetBaseConstSPtr
 Shared pointer to an const instance of this class. More...
 

Public Member Functions

 WValueSet (size_t order, size_t dimension, const std::shared_ptr< std::vector< T > > data, dataType inDataType)
 Constructs a value set with values of type T. More...
 
 WValueSet (size_t order, size_t dimension, const std::shared_ptr< std::vector< T > > data)
 Constructs a value set with values of type T. More...
 
virtual size_t size () const
 
virtual size_t rawSize () const
 
virtual T getScalar (size_t i) const
 
virtual double getScalarDouble (size_t i) const
 
virtual WValue< double > getWValueDouble (size_t i) const
 
WVector3d getVector3D (size_t index) const
 Get the i'th vector. More...
 
WValue< T > getWValue (size_t index) const
 Get the i'th WValue with the dimension of WValueSet. More...
 
const T * rawData () const
 Sometimes we need raw access to the data array, for e.g. More...
 
const std::vector< T > * rawDataVectorPointer () const
 Sometimes we need raw access to the data vector. More...
 
SubArray const getSubArray (std::size_t start, std::size_t size) const
 Request (read-) access object to a subarray of this valueset. More...
 
virtual double getMinimumValue () const
 This method returns the smallest value in the valueset. More...
 
virtual double getMaximumValue () const
 This method returns the largest value in the valueset. More...
 
- Public Member Functions inherited from WValueSetBase
 WValueSetBase (size_t order, size_t dimension, dataType inDataType)
 Despite this is an abstract class all subclasses should have an order and dimension. More...
 
virtual ~WValueSetBase ()=0
 Dummy since each class with virtual member functions needs one. More...
 
virtual size_t dimension () const
 
virtual size_t order () const
 
virtual size_t elementsPerValue () const
 Returns the number of elements of type T per value. More...
 
virtual dataType getDataType () const
 
template<typename Func_T >
Func_T::result_type applyFunction (Func_T const &func)
 Apply a function object to this valueset. More...
 

Static Public Member Functions

static size_t getRequiredRawSizePerVoxel (size_t oder, size_t dimension)
 Calculates the needed number of integral values for a valueset with specified order and dimension for one voxel. More...
 

Protected Attributes

m_minimum
 The smallest value in m_data. More...
 
m_maximum
 The largest value in m_data. More...
 
- Protected Attributes inherited from WValueSetBase
const size_t m_order
 The order of the tensors for this ValueSet. More...
 
const size_t m_dimension
 The dimension of the tensors for this ValueSet. More...
 
const dataType m_dataType
 The data type of the values' elements. More...
 

Private Member Functions

virtual WValueSetVariant const getVariant () const
 Get a variant reference to this valueset (the reference is stored in the variant). More...
 

Private Attributes

const std::shared_ptr< std::vector< T > > m_data
 Stores the values of type T as simple array which never should be modified. More...
 

Friends

class WValueSetTest
 Only UnitTests are allowed to be friends. More...
 

Detailed Description

template<typename T>
class WValueSet< T >

Base Class for all value set types.

forward declaration

Definition at line 46 of file WValueSet.h.

Member Typedef Documentation

◆ ValueT

template<typename T >
typedef T WValueSet< T >::ValueT

The type of the single value in this value set.

Definition at line 57 of file WValueSet.h.

Constructor & Destructor Documentation

◆ WValueSet() [1/2]

template<typename T >
WValueSet< T >::WValueSet ( size_t  order,
size_t  dimension,
const std::shared_ptr< std::vector< T > >  data,
dataType  inDataType 
)
inline

Constructs a value set with values of type T.

Sets order and dimension to allow to interpret the values as tensors of a certain order and dimension.

Parameters
ordertensor order of values stored in the value set
dimensiontensor dimension of values stored in the value set
datathe vector holding the raw data
inDataTypeindicator telling us which dataType comes in

Definition at line 122 of file WValueSet.h.

References WValueSet< T >::m_maximum, and WValueSet< T >::m_minimum.

◆ WValueSet() [2/2]

template<typename T >
WValueSet< T >::WValueSet ( size_t  order,
size_t  dimension,
const std::shared_ptr< std::vector< T > >  data 
)
inline

Constructs a value set with values of type T.

Sets order and dimension to allow to interpret the values as tensors of a certain order and dimension.

Parameters
ordertensor order of values stored in the value set
dimensiontensor dimension of values stored in the value set
datathe vector holding the raw data

Definition at line 144 of file WValueSet.h.

References WValueSet< T >::m_maximum, and WValueSet< T >::m_minimum.

Member Function Documentation

◆ getMaximumValue()

template<typename T >
virtual double WValueSet< T >::getMaximumValue ( ) const
inlinevirtual

This method returns the largest value in the valueset.

It does not handle vectors, matrices and so on well. It simply returns the largest value in the data array. This is especially useful for texture scaling or other statistic tools (histograms).

Returns
the largest value in the data.

Implements WValueSetBase.

Definition at line 289 of file WValueSet.h.

References WValueSet< T >::m_maximum.

Referenced by WSegmentationAlgoThreshold::operator()().

+ Here is the caller graph for this function:

◆ getMinimumValue()

template<typename T >
virtual double WValueSet< T >::getMinimumValue ( ) const
inlinevirtual

This method returns the smallest value in the valueset.

It does not handle vectors, matrices and so on well. It simply returns the smallest value in the data array. This is especially useful for texture scaling or other statistic tools (histograms).

Returns
the smallest value in the data.

Implements WValueSetBase.

Definition at line 278 of file WValueSet.h.

References WValueSet< T >::m_minimum.

Referenced by WSegmentationAlgoThreshold::operator()().

+ Here is the caller graph for this function:

◆ getRequiredRawSizePerVoxel()

template<typename T >
size_t WValueSet< T >::getRequiredRawSizePerVoxel ( size_t  oder,
size_t  dimension 
)
static

Calculates the needed number of integral values for a valueset with specified order and dimension for one voxel.

The whole dataset will then be as large as the number of voxels multiplied by this value.

Parameters
oderdesired tensor order.
dimensiondesired dimension.
Returns
the number of values needed

Definition at line 357 of file WValueSet.h.

References WValueSetBase::dimension().

+ Here is the call graph for this function:

◆ getScalar()

template<typename T >
virtual T WValueSet< T >::getScalar ( size_t  i) const
inlinevirtual
Parameters
iid of the scalar to retrieve
Returns
The i-th scalar stored in this value set. There are rawSize() such scalars.

Definition at line 193 of file WValueSet.h.

References WValueSet< T >::m_data.

Referenced by WSegmentationAlgoThreshold::operator()().

+ Here is the caller graph for this function:

◆ getScalarDouble()

template<typename T >
virtual double WValueSet< T >::getScalarDouble ( size_t  i) const
inlinevirtual
Parameters
iid of the scalar to retrieve
Returns
The i-th scalar stored in this value set. There are rawSize() such scalars.

Implements WValueSetBase.

Definition at line 202 of file WValueSet.h.

References WValueSet< T >::m_data.

◆ getSubArray()

template<typename T >
SubArray const WValueSet< T >::getSubArray ( std::size_t  start,
std::size_t  size 
) const
inline

Request (read-) access object to a subarray of this valueset.

The object returned by this function can be used as an array ( starting at index 0 ), whose elements are the data elements at positions start to ( including ) start + size - 1 of the valueset.

Parameters
startThe position of the first element of the subarray.
sizeThe number of elements in the subarray.
Returns
The subarray.

Definition at line 265 of file WValueSet.h.

References WValueSet< T >::rawData(), WValueSet< T >::rawSize(), and WValueSet< T >::size().

+ Here is the call graph for this function:

◆ getVariant()

template<typename T >
virtual WValueSetVariant const WValueSet< T >::getVariant ( ) const
inlineprivatevirtual

Get a variant reference to this valueset (the reference is stored in the variant).

Note
Use this as a temporary object inside a function or something like that.
Returns
var A variant reference.

Reimplemented from WValueSetBase.

Definition at line 326 of file WValueSet.h.

◆ getVector3D()

template<typename T >
WVector3d WValueSet< T >::getVector3D ( size_t  index) const

Get the i'th vector.

Parameters
indexthe index number of the vector
Returns
the vector

Definition at line 332 of file WValueSet.h.

References WValueSet< T >::m_data, WValueSetBase::m_dimension, and WValueSetBase::m_order.

◆ getWValue()

template<typename T >
WValue< T > WValueSet< T >::getWValue ( size_t  index) const

Get the i'th WValue with the dimension of WValueSet.

Parameters
indexthe index number of the WValue
Returns
a WValue with the dimension WValueSet

Definition at line 340 of file WValueSet.h.

References WValueSet< T >::m_data, WValueSetBase::m_dimension, WValueSetBase::m_order, and WValueSet< T >::size().

Referenced by WValueSet< T >::getWValueDouble().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWValueDouble()

template<typename T >
virtual WValue< double > WValueSet< T >::getWValueDouble ( size_t  i) const
inlinevirtual
Parameters
iid of the WValue to retrieve
Returns
The i-th WValue stored in this value set. There are size() such scalars.

Implements WValueSetBase.

Definition at line 211 of file WValueSet.h.

References WValueSet< T >::getWValue().

+ Here is the call graph for this function:

◆ rawData()

template<typename T >
const T* WValueSet< T >::rawData ( ) const
inline

Sometimes we need raw access to the data array, for e.g.

OpenGL.

Returns
the raw data pointer

Definition at line 240 of file WValueSet.h.

References WValueSet< T >::m_data.

Referenced by WValueSet< T >::getSubArray(), and VisitorVSetB< VSetAType >::operator()().

+ Here is the caller graph for this function:

◆ rawDataVectorPointer()

template<typename T >
const std::vector< T >* WValueSet< T >::rawDataVectorPointer ( ) const
inline

Sometimes we need raw access to the data vector.

Returns
the data vector

Definition at line 250 of file WValueSet.h.

References WValueSet< T >::m_data.

◆ rawSize()

template<typename T >
virtual size_t WValueSet< T >::rawSize ( ) const
inlinevirtual
Returns
The number of integral types stored in this set.

Implements WValueSetBase.

Definition at line 184 of file WValueSet.h.

References WValueSet< T >::m_data.

Referenced by WValueSet< T >::getSubArray(), VisitorVSetB< VSetAType >::operator()(), and WValueSet< T >::size().

+ Here is the caller graph for this function:

◆ size()

template<typename T >
virtual size_t WValueSet< T >::size ( ) const
inlinevirtual
Returns
The number of tensors stored in this set.

Implements WValueSetBase.

Definition at line 162 of file WValueSet.h.

References WValueSetBase::m_dimension, WValueSetBase::m_order, and WValueSet< T >::rawSize().

Referenced by WValueSet< T >::getSubArray(), WValueSet< T >::getWValue(), and WSegmentationAlgoThreshold::operator()().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ WValueSetTest

template<typename T >
friend class WValueSetTest
friend

Only UnitTests are allowed to be friends.

Definition at line 51 of file WValueSet.h.

Member Data Documentation

◆ m_data

template<typename T >
const std::shared_ptr< std::vector< T > > WValueSet< T >::m_data
private

◆ m_maximum

template<typename T >
T WValueSet< T >::m_maximum
protected

The largest value in m_data.

Definition at line 313 of file WValueSet.h.

Referenced by WValueSet< T >::getMaximumValue(), and WValueSet< T >::WValueSet().

◆ m_minimum

template<typename T >
T WValueSet< T >::m_minimum
protected

The smallest value in m_data.

Definition at line 308 of file WValueSet.h.

Referenced by WValueSet< T >::getMinimumValue(), and WValueSet< T >::WValueSet().


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