Inviwo  0.9.10.1
Inviwo documentation
inviwo::Volume Class Reference

#include <volume.h>

+ Inheritance diagram for inviwo::Volume:

Public Member Functions

 Volume (size3_t defaultDimensions=size3_t(128, 128, 128), const DataFormatBase *defaultFormat=DataUInt8::get(), const SwizzleMask &defaultSwizzleMask=swizzlemasks::rgba)
 
 Volume (std::shared_ptr< VolumeRepresentation >)
 
 Volume (const Volume &)=default
 
Volumeoperator= (const Volume &that)=default
 
virtual Volumeclone () const override
 
Document getInfo () const
 
virtual void setDimensions (const size3_t &dim)
 
virtual size3_t getDimensions () const override
 
void setDataFormat (const DataFormatBase *format)
 
const DataFormatBasegetDataFormat () const
 
void setSwizzleMask (const SwizzleMask &mask)
 update the swizzle mask of the color channels when sampling the volume More...
 
SwizzleMask getSwizzleMask () const
 
virtual const StructuredCameraCoordinateTransformer< 3 > & getCoordinateTransformer (const Camera &camera) const override
 
vec3 getWorldSpaceGradientSpacing () const
 Computes the spacing to be used for gradient computation. Also works for volume with non-orthogonal basis. More...
 
template<typename Kind >
const representation_traits< Volume, Kind >::type * getRep () const
 
- Public Member Functions inherited from inviwo::Data< Volume, VolumeRepresentation >
const T * getRepresentation () const
 
T * getEditableRepresentation ()
 
bool hasRepresentation () const
 
bool hasRepresentations () const
 
void addRepresentation (std::shared_ptr< VolumeRepresentation > representation)
 
void removeRepresentation (const VolumeRepresentation *representation)
 
void removeOtherRepresentations (const VolumeRepresentation *representation)
 
void clearRepresentations ()
 
void invalidateAllOther (const VolumeRepresentation *repr)
 
- Public Member Functions inherited from inviwo::StructuredGridEntity< 3 >
 StructuredGridEntity (const StructuredGridEntity< N > &rhs)=default
 
 StructuredGridEntity (const Vector< N, size_t > &dimensions, const Vector< N, float > &spacing)
 
 StructuredGridEntity (const Matrix< N+1, float > &modelMatrix)
 
 StructuredGridEntity (const Matrix< N+1, float > &modelMatrix, const Matrix< N+1, float > &worldMatrix)
 
StructuredGridEntity< N > & operator= (const StructuredGridEntity< N > &that)=default
 
Matrix< N+1, float > getIndexMatrix () const
 
virtual const StructuredCoordinateTransformer< N > & getCoordinateTransformer () const
 
virtual const StructuredCameraCoordinateTransformer< N > & getCoordinateTransformer (const CameraND< N > &camera) const
 
- Public Member Functions inherited from inviwo::SpatialEntity< N >
 SpatialEntity (const SpatialEntity< N > &rhs)
 
 SpatialEntity (const Matrix< N+1, float > &modelMatrix)
 
 SpatialEntity (const Matrix< N+1, float > &modelMatrix, const Matrix< N+1, float > &worldMatrix)
 
SpatialEntity< N > & operator= (const SpatialEntity< N > &that)
 
Vector< N, float > getOffset () const
 
void setOffset (const Vector< N, float > &offset)
 
Matrix< N, float > getBasis () const
 
void setBasis (const Matrix< N, float > &basis)
 
Matrix< N+1, float > getModelMatrix () const
 
void setModelMatrix (const Matrix< N+1, float > &modelMatrix)
 
Matrix< N+1, float > getWorldMatrix () const
 
void setWorldMatrix (const Matrix< N+1, float > &worldMatrix)
 
- Public Member Functions inherited from inviwo::MetaDataOwner
 MetaDataOwner (const MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
 
void copyMetaDataFrom (const MetaDataOwner &src)
 
void copyMetaDataTo (MetaDataOwner &dst)
 
template<typename T >
T * createMetaData (const std::string &key)
 
template<typename T , typename U >
void setMetaData (const std::string &key, U value)
 
template<typename T >
bool unsetMetaData (const std::string &key)
 unset, i.e. remove the metadata entry matching the given key and type More...
 
template<typename T , typename U >
getMetaData (const std::string &key, U val) const
 
template<typename T >
T * getMetaData (const std::string &key)
 
template<typename T >
const T * getMetaData (const std::string &key) const
 
MetaDataMapgetMetaDataMap ()
 
const MetaDataMapgetMetaDataMap () const
 
template<typename T >
bool hasMetaData (const std::string &key) const
 
virtual void serialize (Serializer &s) const
 
virtual void deserialize (Deserializer &d)
 

Public Attributes

DataMapper dataMap_
 

Static Public Attributes

static uvec3 colorCode = uvec3(188, 101, 101)
 
static const std::string classIdentifier = "org.inviwo.Volume"
 
static const std::string dataName = "Volume"
 

Protected Attributes

size3_t defaultDimensions_
 
const DataFormatBasedefaultDataFormat_
 
SwizzleMask defaultSwizzleMask_
 
- Protected Attributes inherited from inviwo::Data< Volume, VolumeRepresentation >
std::mutex mutex_
 
std::unordered_map< std::type_index, std::shared_ptr< VolumeRepresentation > > representations_
 
std::shared_ptr< VolumeRepresentationlastValidRepresentation_
 
- Protected Attributes inherited from inviwo::SpatialEntity< N >
SpatialCoordinateTransformer< N > * transformer_
 
SpatialCameraCoordinateTransformer< N > * cameraTransformer_
 
Matrix< N+1, float > modelMatrix_
 
Matrix< N+1, float > worldMatrix_
 
- Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_
 

Additional Inherited Members

- Public Types inherited from inviwo::Data< Volume, VolumeRepresentation >
using self = Volume
 
using repr = VolumeRepresentation
 
- Protected Member Functions inherited from inviwo::Data< Volume, VolumeRepresentation >
 Data (const Data< Volume, VolumeRepresentation > &rhs)
 
Data< Volume, VolumeRepresentation > & operator= (const Data< Volume, VolumeRepresentation > &rhs)
 
const T * getValidRepresentation () const
 
void copyRepresentationsTo (Data< Volume, VolumeRepresentation > *targetData) const
 
std::shared_ptr< VolumeRepresentationaddRepresentationInternal (std::shared_ptr< VolumeRepresentation > representation) const
 

Detailed Description

Data structure for volumetric data in form of a structured three-dimensional grid. Basis and offset determine the position and extent of the volume in model space. Skewed volumes are represented by providing a non-orthogonal basis.

In case a volume was loaded via VolumeSource or Volume, the filename of the source data is available via MetaData.

Member Function Documentation

◆ getWorldSpaceGradientSpacing()

vec3 inviwo::Volume::getWorldSpaceGradientSpacing ( ) const

Computes the spacing to be used for gradient computation. Also works for volume with non-orthogonal basis.

For orthogonal lattices this will be equal to the world space voxel spacing. For non-orthogonal lattices it will be the longest of the axes projected onto the world space axes.

   World space

    b ^           ^
     /            |

y ^ / dy | / Voxel | | /__________>a \/ | <-—dx—> |____________> x

The actual gradient spacing vectors are given by mat3{ gradientSpacing.x, 0, 0, 0, gradientSpacing.y, 0, 0, 0, gradientSpacing.z } However, we do not return the zeroes.

To get the spacing in texture space use: mat3(glm::scale(worldToTextureMatrix, getWorldSpaceGradientSpacing()));

Returns
Step size for gradient computation in world space.

◆ setDataFormat()

void inviwo::Volume::setDataFormat ( const DataFormatBase format)

Set the format of the data.

See also
DataFormatBase
Parameters
formatThe format of the data.

◆ setDimensions()

void inviwo::Volume::setDimensions ( const size3_t &  dim)
virtual

Resize to dimension. This is destructive, the data will not be preserved.

Note
Resizes the last valid representation and erases all representations. Last valid representation will remain valid after changing the dimension.

◆ setSwizzleMask()

void inviwo::Volume::setSwizzleMask ( const SwizzleMask &  mask)

update the swizzle mask of the color channels when sampling the volume

Parameters
masknew swizzle mask

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