29 #include "../common/WAssert.h"
30 #include "../common/WException.h"
31 #include "../common/WPrototyped.h"
32 #include "WDataSetSingle.h"
33 #include "WDataTexture3D.h"
35 #include "WGridRegular3D.h"
36 #include "WValueSet.h"
42 std::shared_ptr< WGrid > newGrid )
46 WAssert( newValueSet,
"Need a value set for new data set." );
47 WAssert( newGrid,
"Need a grid for new data set." );
48 WAssert( newValueSet->size() == newGrid->size(),
49 "Number of grid position unequal number of values in value set." );
57 std::shared_ptr< WGridRegular3D > regGrid = std::dynamic_pointer_cast< WGridRegular3D >(
m_grid );
120 return "WDataSetSingle";
125 return "A single dataset containing a number of WValues on a structured"
126 "grid. Single, in this case, means not time-dependent and not one type of"
127 "data for several subjects.";
149 case W_DT_UNSIGNED_CHAR:
151 return static_cast< double >( std::dynamic_pointer_cast< WValueSet< uint8_t > >(
getValueSet() )->getScalar(
id ) );
155 return static_cast< double >( std::dynamic_pointer_cast< WValueSet< uint16_t > >(
getValueSet() )->getScalar(
id ) );
159 return static_cast< double >( std::dynamic_pointer_cast< WValueSet< int16_t > >(
getValueSet() )->getScalar(
id ) );
161 case W_DT_SIGNED_INT:
163 return static_cast< double >( std::dynamic_pointer_cast< WValueSet< int32_t > >(
getValueSet() )->getScalar(
id ) );
167 return static_cast< double >( std::dynamic_pointer_cast< WValueSet< float > >(
getValueSet() )->getScalar(
id ) );
171 return static_cast< double >( std::dynamic_pointer_cast< WValueSet< double > >(
getValueSet() )->getScalar(
id ) );
174 WAssert(
false,
"Unknow data type in dataset." );
std::shared_ptr< WValueSetBase > getValueSet() const
WDataSetSingle()
Construct an empty and unusable instance.
virtual const std::string getDescription() const
Gets the description for this prototype.
virtual const std::string getName() const
Gets the name of this prototype.
virtual bool isTexture() const
Determines whether this dataset can be used as a texture.
virtual WDataSetSingle::SPtr clone() const
Creates a copy (clone) of this instance.
OW_API_DEPRECATED T getValueAt(size_t id)
Get the scalar value stored at id-th position of the array of the value set.
static std::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
std::shared_ptr< WGrid > m_grid
Stores the reference of the WGrid of this DataSetSingle instance.
osg::ref_ptr< WDataTexture3D > m_texture
The 3D texture representing this dataset.
static std::shared_ptr< WPrototyped > m_prototype
The prototype as singleton.
virtual osg::ref_ptr< WDataTexture3D > getTexture() const
Returns the texture representation of the dataset.
std::shared_ptr< WGrid > getGrid() const
double getSingleRawValue(size_t id) const
Get the raw scalar value stored at id-th position of the raw array of the value set.
std::shared_ptr< WValueSetBase > m_valueSet
Stores the reference of the WValueSet of this DataSetSingle instance.
std::shared_ptr< WDataSetSingle > SPtr
Convenience typedef for a std::shared_ptr.
virtual ~WDataSetSingle()
Destroys this DataSet instance.
Base class for all data set types.
std::shared_ptr< WProperties > m_infoProperties
The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION".
This class allows simple creation of WGETexture3D by using a specified grid and value-set.