33 #include <boost/shared_ptr.hpp>
35 #include "../common/math/linearAlgebra/WVectorFixed.h"
36 #include "../common/math/WValue.h"
37 #include "../common/WAssert.h"
38 #include "../common/WLimits.h"
39 #include "WDataHandlerEnums.h"
40 #include "WValueSetBase.h"
88 return *(
m_ptr + i *
static_cast< std::size_t
>( i <
m_size ) );
128 m_minimum = std::numeric_limits< T >::max();
129 m_maximum = std::numeric_limits< T >::min();
130 for(
typename std::vector< T >::const_iterator iter = data->begin(); iter != data->end(); ++iter )
150 m_minimum = std::numeric_limits< T >::max();
151 m_maximum = std::numeric_limits< T >::min();
152 for(
typename std::vector< T >::const_iterator iter = data->begin(); iter != data->end(); ++iter )
167 WAssert(
m_dimension == 1,
"Although order zero, (dimension != 1) was found." );
176 WAssert(
false,
"Unsupported tensor order." );
195 return (*
m_data.get())[i];
204 return static_cast< double >( (*
m_data.get())[i] );
242 return &(*
m_data.get())[0];
267 WAssert( start + size <=
rawSize(),
"" );
268 WAssert( size != 0,
"" );
319 const boost::shared_ptr< std::vector< T > >
m_data;
328 return WValueSetVariant(
this );
334 WAssert(
m_order == 1 &&
m_dimension == 3,
"WValueSet<T>::getVector3D only implemented for order==1, dim==3 value sets" );
335 WAssert( ( index + 1 ) * 3 <=
m_data->size(),
"index in WValueSet<T>::getVector3D too big" );
336 size_t offset = index * 3;
342 WAssert(
m_order == 1,
"WValueSet<T>::getWValue only implemented for order==1 value sets" );
343 WAssert( ( index + 1 ) * m_dimension <= m_data->
size(),
"index in WValueSet<T>::getWValue too big" );
351 result[i] = ( *
m_data )[offset+i];
356 template<
typename T >
361 for(
size_t v = 0; v < oder; ++v )
369 #endif // WVALUESET_H
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...
virtual size_t order() const
const size_t m_dimension
The dimension of the tensors for this ValueSet.
Base class for all higher level values like tensors, vectors, matrices and so on. ...
const T * rawData() const
Sometimes we need raw access to the data array, for e.g.
T m_minimum
The smallest value in m_data.
WValueSet(size_t order, size_t dimension, const boost::shared_ptr< std::vector< T > > data)
Constructs a value set with values of type T.
SubArray const getSubArray(std::size_t start, std::size_t size) const
Request (read-) access object to a subarray of this valueset.
A helper class granting safe access to a certain part of the valueset.
virtual double getScalarDouble(size_t i) const
WValue< T > getWValue(size_t index) const
Get the i'th WValue with the dimension of WValueSet.
virtual T getScalar(size_t i) const
T ValueT
The type of the single value in this value set.
An object that knows an appropriate dataType flag for the typename T.
std::size_t const m_size
the size of the subarray
virtual WValueSetVariant const getVariant() const
Get a variant reference to this valueset (the reference is stored in the variant).
virtual size_t rawSize() const
UnitTests the WValueSet class.
dataType
Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense to...
virtual double getMinimumValue() const
This method returns the smallest value in the valueset.
virtual double getMaximumValue() const
This method returns the largest value in the valueset.
WValueSet(size_t order, size_t dimension, const boost::shared_ptr< std::vector< T > > data, dataType inDataType)
Constructs a value set with values of type T.
SubArray(T const *const p, std::size_t size)
Construct an object that allows safe access.
virtual size_t size() const
Base Class for all value set types.
T m_maximum
The largest value in m_data.
Abstract base class to all WValueSets.
virtual WValue< double > getWValueDouble(size_t i) const
const boost::shared_ptr< std::vector< T > > m_data
Stores the values of type T as simple array which never should be modified.
virtual size_t dimension() const
const std::vector< T > * rawDataVectorPointer() const
Sometimes we need raw access to the data vector.
T const & operator[](std::size_t i) const
Safe access.
WVector3d getVector3D(size_t index) const
Get the i'th vector.
const size_t m_order
The order of the tensors for this ValueSet.
T const *const m_ptr
the pointer to the first element