35 #include "../common/WAssert.h"
36 #include "../common/WLimits.h"
37 #include "../common/math/WValue.h"
38 #include "../common/math/linearAlgebra/WVectorFixed.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." );
186 return ( *
m_data.get() ).size();
195 return ( *
m_data.get() )[i];
204 return static_cast< double >( ( *
m_data.get() )[i] );
242 return &( *
m_data.get() )[0];
252 return &( *
m_data.get() );
268 WAssert(
size != 0,
"" );
319 const std::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 )
Abstract base class to all WValueSets.
const size_t m_dimension
The dimension of the tensors for this ValueSet.
const size_t m_order
The order of the tensors for this ValueSet.
virtual size_t dimension() const
virtual size_t order() const
UnitTests the WValueSet class.
A helper class granting safe access to a certain part of the valueset.
std::size_t const m_size
the size of the subarray
SubArray(T const *const p, std::size_t size)
Construct an object that allows safe access.
T const & operator[](std::size_t i) const
Safe access.
T const *const m_ptr
the pointer to the first element
Base Class for all value set types.
T m_minimum
The smallest value in m_data.
virtual size_t size() const
WValue< T > getWValue(size_t index) const
Get the i'th WValue with the dimension of WValueSet.
WVector3d getVector3D(size_t index) const
Get the i'th vector.
SubArray const getSubArray(std::size_t start, std::size_t size) const
Request (read-) access object to a subarray of this valueset.
T m_maximum
The largest value in m_data.
const std::vector< T > * rawDataVectorPointer() const
Sometimes we need raw access to the data vector.
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.
virtual T getScalar(size_t i) const
WValueSet(size_t order, size_t dimension, const std::shared_ptr< std::vector< T > > data)
Constructs a value set with values of type T.
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...
const T * rawData() const
Sometimes we need raw access to the data array, for e.g.
virtual WValueSetVariant const getVariant() const
Get a variant reference to this valueset (the reference is stored in the variant).
virtual WValue< double > getWValueDouble(size_t i) const
const std::shared_ptr< std::vector< T > > m_data
Stores the values of type T as simple array which never should be modified.
virtual double getMaximumValue() const
This method returns the largest value in the valueset.
T ValueT
The type of the single value in this value set.
virtual double getScalarDouble(size_t i) const
virtual double getMinimumValue() const
This method returns the smallest value in the valueset.
virtual size_t rawSize() const
Base class for all higher level values like tensors, vectors, matrices and so on.
dataType
Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense to...
An object that knows an appropriate dataType flag for the typename T.