34 #include <boost/shared_ptr.hpp>
37 #include "../common/math/linearAlgebra/WVectorFixed.h"
38 #include "../common/math/WValue.h"
39 #include "../common/WAssert.h"
40 #include "../common/WLimits.h"
41 #include "WDataHandlerEnums.h"
42 #include "WValueSetBase.h"
90 return *(
m_ptr + i *
static_cast< std::size_t
>( i <
m_size ) );
130 m_minimum = std::numeric_limits< T >::max();
131 m_maximum = std::numeric_limits< T >::min();
132 for(
typename std::vector< T >::const_iterator iter = data->begin(); iter != data->end(); ++iter )
152 m_minimum = std::numeric_limits< T >::max();
153 m_maximum = std::numeric_limits< T >::min();
154 for(
typename std::vector< T >::const_iterator iter = data->begin(); iter != data->end(); ++iter )
169 WAssert(
m_dimension == 1,
"Although order zero, (dimension != 1) was found." );
178 WAssert(
false,
"Unsupported tensor order." );
197 return (*
m_data.get())[i];
206 return static_cast< double >( (*
m_data.get())[i] );
244 return &(*
m_data.get())[0];
269 WAssert( start + size <=
rawSize(),
"" );
270 WAssert( size != 0,
"" );
321 const boost::shared_ptr< std::vector< T > >
m_data;
330 return WValueSetVariant(
this );
336 WAssert(
m_order == 1 &&
m_dimension == 3,
"WValueSet<T>::getVector3D only implemented for order==1, dim==3 value sets" );
337 WAssert( ( index + 1 ) * 3 <=
m_data->size(),
"index in WValueSet<T>::getVector3D too big" );
338 size_t offset = index * 3;
344 WAssert(
m_order == 1,
"WValueSet<T>::getWValue only implemented for order==1 value sets" );
345 WAssert( ( index + 1 ) * m_dimension <= m_data->
size(),
"index in WValueSet<T>::getWValue too big" );
353 result[i] = ( *
m_data )[offset+i];
358 template<
typename T >
363 for(
size_t v = 0; v < oder; ++v )
371 #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.
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
A fixed size matrix class.
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