Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::Volume Class Reference

#include <volume.h>

Inheritance diagram for inviwo::Volume:

Public Types

using Config = VolumeConfig
Public Types inherited from inviwo::Data< Volume, VolumeRepresentation >
using self
using repr

Public Member Functions

 Volume (size3_t defaultDimensions=VolumeConfig::defaultDimensions, const DataFormatBase *defaultFormat=VolumeConfig::defaultFormat, const SwizzleMask &defaultSwizzleMask=VolumeConfig::defaultSwizzleMask, InterpolationType interpolation=VolumeConfig::defaultInterpolation, const Wrapping3D &wrapping=VolumeConfig::defaultWrapping)
 Volume (const VolumeConfig &config)
 Volume (std::shared_ptr< VolumeRepresentation >)
 Volume (const Volume &rhs, NoData noData, const VolumeConfig &config={})
 Volume (const Volume &)=default
 Volume (Volume &&)=default
Volumeoperator= (const Volume &that)=default
Volumeoperator= (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
SwizzleMask getSwizzleMask () const
void setInterpolation (InterpolationType interpolation)
InterpolationType getInterpolation () const
void setWrapping (const Wrapping3D &wrapping)
Wrapping3D getWrapping () const
vec3 getWorldSpaceGradientSpacing () const
 Computes the spacing to be used for gradient computation. Also works for volume with non-orthogonal basis.
virtual const AxisgetAxis (size_t index) const override
template<typename Kind>
const representation_traits< Volume, Kind >::type * getRep () const
HistogramCache::Result calculateHistograms (const std::function< void(const std::vector< Histogram1D > &)> &whenDone) const
void discardHistograms ()
VolumeConfig config () const
Public Member Functions inherited from inviwo::Data< Volume, VolumeRepresentation >
const T * getRepresentation () const
std::shared_ptr< const T > getRepresentationShared () 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)
void updateResource (const ResourceMeta &meta) const
Public Member Functions inherited from inviwo::StructuredGridEntity< 3 >
StructuredGridEntity< N > & operator= (const StructuredGridEntity< N > &that)=default
glm::mat4 getIndexMatrix () const
virtual const StructuredCoordinateTransformergetCoordinateTransformer () const override
Public Member Functions inherited from inviwo::SpatialEntity
 SpatialEntity (const glm::mat4 &modelMatrix)
 SpatialEntity (const glm::mat4 &modelMatrix, const glm::mat4 &worldMatrix)
 SpatialEntity (const SpatialEntity &rhs)
SpatialEntityoperator= (const SpatialEntity &that)
glm::vec3 getOffset () const
void setOffset (const glm::vec3 &offset)
glm::mat3 getBasis () const
void setBasis (const glm::mat3 &basis)
glm::mat4 getModelMatrix () const
void setModelMatrix (const glm::mat4 &modelMatrix)
glm::mat4 getWorldMatrix () const
void setWorldMatrix (const glm::mat4 &worldMatrix)
virtual const SpatialCameraCoordinateTransformergetCoordinateTransformer (const Camera &camera) const
Public Member Functions inherited from inviwo::MetaDataOwner
 MetaDataOwner (const MetaDataOwner &rhs)=default
 MetaDataOwner (MetaDataOwner &rhs)=default
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
MetaDataOwneroperator= (MetaDataOwner &)=default
void copyMetaDataFrom (const MetaDataOwner &src)
void copyMetaDataTo (MetaDataOwner &dst)
template<typename T>
requires std::derived_from<T, MetaData>
T * createMetaData (std::string_view key)
template<typename T, typename U>
requires std::derived_from<T, MetaData> && Settable<T, U>
void setMetaData (std::string_view key, U value)
template<typename T>
requires std::derived_from<T, MetaData>
bool unsetMetaData (std::string_view key)
 unset, i.e. remove the metadata entry matching the given key and type
template<typename T, typename U>
requires std::derived_from<T, MetaData> && Gettable<T, U>
getMetaData (std::string_view key, U val) const
template<typename T>
requires std::derived_from<T, MetaData>
T * getMetaData (std::string_view key)
template<typename T>
requires std::derived_from<T, MetaData>
const T * getMetaData (std::string_view key) const
MetaDataMapgetMetaDataMap ()
const MetaDataMapgetMetaDataMap () const
bool hasMetaData (std::string_view key) const
template<typename T>
requires std::derived_from<T, MetaData>
bool hasMetaData (std::string_view key) const
void serialize (Serializer &s) const
void deserialize (Deserializer &d)

Public Attributes

DataMapper dataMap
std::array< Axis, 3 > axes

Static Public Attributes

static constexpr uvec3 colorCode {188, 101, 101}
static constexpr std::string_view classIdentifier {"org.inviwo.Volume"}
static constexpr std::string_view dataName {"Volume"}

Protected Attributes

size3_t defaultDimensions_
const DataFormatBasedefaultDataFormat_
SwizzleMask defaultSwizzleMask_
InterpolationType defaultInterpolation_
Wrapping3D defaultWrapping_
HistogramCache histograms_
Protected Attributes inherited from inviwo::SpatialEntity
std::unique_ptr< SpatialCoordinateTransformertransformer_
std::unique_ptr< SpatialCameraCoordinateTransformercameraTransformer_
glm::mat4 modelMatrix_
glm::mat4 worldMatrix_
Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_

Additional Inherited Members

Protected Member Functions inherited from inviwo::Data< Volume, VolumeRepresentation >
Data< Volume, VolumeRepresentation > & operator= (const Data< Volume, VolumeRepresentation > &that)
decltype(auto) getLastOr (F &&f, T &&fallback) const
void setLastAndInvalidateOther (F &&f, T &&value)

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.

Constructor & Destructor Documentation

◆ Volume()

inviwo::Volume::Volume ( const Volume & rhs,
NoData noData,
const VolumeConfig & config = {} )

Create a volume based on rhs without copying any data. State from rhs can be overridden by the config

Parameters
rhssource volume providing the necessary information like dimensions, swizzle masks, interpolation, spatial transformations, etc.
noDataTag type to indicate that representations should not be copied from rhs
configcustom parameters overriding values from rhs

Member Function Documentation

◆ clone()

virtual Volume * inviwo::Volume::clone ( ) const
overridevirtual

◆ getAxis()

virtual const Axis * inviwo::Volume::getAxis ( size_t index) const
overridevirtual

returns the axis information corresponding to index

Returns
nullptr if there is no axis for index

Implements inviwo::SpatialEntity.

◆ getDimensions()

virtual size3_t inviwo::Volume::getDimensions ( ) const
overridevirtual

◆ 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 default data format. Existing representations will not be affected.

Note
Only useful before any representations have been created.
See also
DataFormatBase
Parameters
formatThe format of the data.

◆ setDimensions()

virtual 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 file:
  • volume.h