LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType > Class Template Reference

Computes the partitioning of volumetric data and the corresponding normal map. Also creates scene nodes that insert the volumetric data into a scene. More...

#include <VolumeGridHelper.hpp>

+ Inheritance diagram for LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >:
+ Collaboration diagram for LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >:

Public Member Functions

 VolumeGridHelper (const base::math::Vector3ui &nativeResolution, std::size_t maxSegmentBytesize=DEFAULT_MAX_SEGMENT_BYTESIZE)
 Creates a new base::VolumeGrid object. Initializes the segments of the grid so that the totally covered resolution is resolution or larger. It will be larger if the resolution of the buffers need to be rounded to even numbers.
 
virtual void releaseGeometryFeatures () override
 Releases all previously acquired textures. Invoke this method when the volume data changes, loadIntensities already does takes care of that.
 
base::VolumeGrid< SegmentIntensityVolumeType, SegmentNormalsVolumeType > & grid () const
 References the underlying grid.
 
virtual base::NodecreateNode (unsigned int geometryType, const Spacing &spacing) const override
 Creates renderable representation of the underlying grid, that can be put anywhere in the scene graph. The volume is centered in the node.
 
virtual base::NodecreateNode (unsigned int geometryType, const Extent &extent) const override
 Creates renderable representation of the underlying grid, that can be put anywhere in the scene graph. The volume is centered in the node.
 
template<typename LoadIntensitiesFunction >
void loadIntensities (const LoadIntensitiesFunction &intensityData)
 
virtual void loadIntensities (const std::function< float(const base::math::Vector3ui &) > &intensityData)=0
 Updates the data of the volume grid.
 
- Public Member Functions inherited from LibCarna::helpers::VolumeGridHelperBase
 VolumeGridHelperBase (const base::math::Vector3ui &nativeResolution)
 Instantiates.
 
virtual ~VolumeGridHelperBase ()
 Does nothing.
 
template<typename LoadIntensitiesFunction >
void loadIntensities (const LoadIntensitiesFunction &intensityData)
 
- Public Member Functions inherited from LibCarna::helpers::details::VolumeGridHelper::IntensityComponent< SegmentIntensityVolumeType, SegmentNormalsVolumeType >
 IntensityComponent ()
 Sets the role to use for attaching textures to base::Geometry nodes to DEFAULT_ROLE_INTENSITIES.
 
void setIntensitiesRole (unsigned int role)
 Sets the role to use for attaching textures to base::Geometry nodes.
 
unsigned int intensitiesRole () const
 Tels the role used for attaching textures to base::Geometry nodes.
 
- Public Member Functions inherited from LibCarna::helpers::details::VolumeGridHelper::TextureManager< IntensityTextureFactory< SegmentIntensityVolumeType, SegmentNormalsVolumeType > >
virtual ~TextureManager ()
 Releases all textures and deletes.
 
void releaseGeometryFeatures ()
 Releases all textures.
 

Public Attributes

const std::size_t maxSegmentBytesize
 Maximum memory size of a single segment volume.
 
const base::math::Vector3ui maxSegmentSize
 The maximum effective resolution of a single grid segment.
 
const details::VolumeGridHelper::Partionining partitioningX
 Describes the partitioning along the x-axis.
 
const details::VolumeGridHelper::Partionining partitioningY
 Describes the partitioning along the y-axis.
 
const details::VolumeGridHelper::Partionining partitioningZ
 Describes the partitioning along the z-axis.
 
const base::math::Vector3ui resolution
 Holds the effective resolution, i.e. the resolution covered by the grid.
 
- Public Attributes inherited from LibCarna::helpers::VolumeGridHelperBase
const base::math::Vector3ui nativeResolution
 Holds the original resolution of the loaded data.
 

Protected Member Functions

virtual base::math::Vector3ui gridResolution () const override
 
virtual void loadIntensities (const std::function< float(const base::math::Vector3ui &) > &intensityData) override
 Updates the data of the volume grid.
 
- Protected Member Functions inherited from LibCarna::helpers::details::VolumeGridHelper::IntensityComponent< SegmentIntensityVolumeType, SegmentNormalsVolumeType >
void attachTexture (base::Geometry &geometry, const base::VolumeSegment< SegmentIntensityVolumeType, SegmentNormalsVolumeType > &segment) const
 Attaches the texture that represents the base::VolumeSegment::intensities of segment to geometry using the previously configured role.
 
void initializeSegment (base::VolumeSegment< SegmentIntensityVolumeType, SegmentNormalsVolumeType > &segment, const base::math::Vector3ui &size) const
 Initializes intensity volume of segment.
 
- Protected Member Functions inherited from LibCarna::helpers::details::VolumeGridHelper::TextureManager< IntensityTextureFactory< SegmentIntensityVolumeType, SegmentNormalsVolumeType > >
void attachTexture (base::Geometry &geometry, unsigned int role, const base::VolumeSegment< typename TextureFactory::SegmentIntensityVolume, typename TextureFactory::SegmentNormalsVolume > &segment) const
 Attaches the texture that TextureFactory creates from segment to geometry using role.
 

Additional Inherited Members

- Static Public Attributes inherited from LibCarna::helpers::VolumeGridHelperBase
static const std::size_t DEFAULT_MAX_SEGMENT_BYTESIZE = 2 * 300 * 300 * 300
 Default maximum memory size of a single segment volume, 50 megabytes approximately. This determines the segments partitioning.
 
- Static Public Attributes inherited from LibCarna::helpers::details::VolumeGridHelper::IntensityComponent< SegmentIntensityVolumeType, SegmentNormalsVolumeType >
static const unsigned int DEFAULT_ROLE_INTENSITIES = 0
 Holds the default role to use for attaching textures to base::Geometry nodes.
 

Detailed Description

template<typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType>
class LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >

Computes the partitioning of volumetric data and the corresponding normal map. Also creates scene nodes that insert the volumetric data into a scene.

Parameters
SegmentIntensityVolumeTypeis the base::BufferedIntensityVolume compatible type to use for storing the intensity volume of a single partition.
SegmentNormalsVolumeTypeis the base::BufferedNormalMap3D compatible type to use for storing the normal map of a single partition. Set to void if a normal map is not required.

Normal Map Computation

The loadIntensities method performs the computation of the normals automatically. If the intensities are changed in a different way, it is within your responsibility to perform the computation of the normals by calling computeNormals on this object. Note that the computeNormals method is only available if SegmentNormalsVolumeType is not void.

Resolutions

This class needs to distinguish between three kinds of resolutions. The grid's volume textures are not disjoint, but must maintain redundant voxels along the segment faces that they have in common. Hence, the resolution of the data uploaded to the GPU from all segments, that is therefore called the total resolution, will usually be greater than the native resolution of the data passed to loadIntensities.

Furthermore, the effective resolution, that is the one covered by the grid and available for payload, might still be greater than the native resolution, because the resolution of the segments is rounded to even numbers. The additional voxels arising from this are not queried from the data source, but padded automatically.

Definition at line 218 of file VolumeGridHelper.hpp.

Constructor & Destructor Documentation

◆ VolumeGridHelper()

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::VolumeGridHelper ( const base::math::Vector3ui nativeResolution,
std::size_t  maxSegmentBytesize = DEFAULT_MAX_SEGMENT_BYTESIZE 
)

Creates a new base::VolumeGrid object. Initializes the segments of the grid so that the totally covered resolution is resolution or larger. It will be larger if the resolution of the buffers need to be rounded to even numbers.

Parameters
nativeResolutionThe resolution the grid is to be prepared for. This is the resolution that will be expected from the data source.
maxSegmentBytesizeMaximum memory size of a single segment volume. The segments partitioning is chosen according to this value.

Definition at line 351 of file VolumeGridHelper.hpp.

Member Function Documentation

◆ createNode() [1/2]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
base::Node * LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::createNode ( unsigned int  geometryType,
const Extent extent 
) const
overridevirtual

Creates renderable representation of the underlying grid, that can be put anywhere in the scene graph. The volume is centered in the node.

Warning
Only change the returned node's localTransform attribute when you know what you're doing! Put it into another node otherwise.
Parameters
geometryTypeWill be used for base::Geometry instantiation.
extentSpecifies the extent of the whole dataset.

Implements LibCarna::helpers::VolumeGridHelperBase.

Definition at line 510 of file VolumeGridHelper.hpp.

◆ createNode() [2/2]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
base::Node * LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::createNode ( unsigned int  geometryType,
const Spacing spacing 
) const
overridevirtual

Creates renderable representation of the underlying grid, that can be put anywhere in the scene graph. The volume is centered in the node.

Warning
Only change the returned node's localTransform attribute when you know what you're doing! Put it into another node otherwise.
Parameters
geometryTypeWill be used for base::Geometry instantiation.
spacingSpecifies the spacing between two succeeding voxel centers.

Implements LibCarna::helpers::VolumeGridHelperBase.

Definition at line 499 of file VolumeGridHelper.hpp.

◆ grid()

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
base::VolumeGrid< SegmentIntensityVolumeType, SegmentNormalsVolumeType > & LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::grid ( ) const

References the underlying grid.

Definition at line 412 of file VolumeGridHelper.hpp.

◆ gridResolution()

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
base::math::Vector3ui LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::gridResolution ( ) const
overrideprotectedvirtual

Definition at line 521 of file VolumeGridHelper.hpp.

◆ loadIntensities() [1/3]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
template<typename LoadIntensitiesFunction >
void LibCarna::helpers::VolumeGridHelperBase::loadIntensities ( const LoadIntensitiesFunction &  intensityData)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 154 of file VolumeGridHelper.hpp.

◆ loadIntensities() [2/3]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
void LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::loadIntensities ( const std::function< float(const base::math::Vector3ui &) > &  intensityData)
overrideprotectedvirtual

Updates the data of the volume grid.

The intensityData must be scaled to \(\left[0, 1\right]\).

Parameters
intensityDataUnary function that maps base::math::Vector3ui to an intensity value. It will be queried for all values up to nativeResolution.

The normal map is re-computed if SegmentNormalsVolumeType is not void.

Implements LibCarna::helpers::VolumeGridHelperBase.

Definition at line 393 of file VolumeGridHelper.hpp.

◆ loadIntensities() [3/3]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
virtual void LibCarna::helpers::VolumeGridHelperBase::loadIntensities ( const std::function< float(const base::math::Vector3ui &) > &  intensityData)
virtual

Updates the data of the volume grid.

The intensityData must be scaled to \(\left[0, 1\right]\).

Implements LibCarna::helpers::VolumeGridHelperBase.

◆ releaseGeometryFeatures()

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
void LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::releaseGeometryFeatures ( )
overridevirtual

Releases all previously acquired textures. Invoke this method when the volume data changes, loadIntensities already does takes care of that.

If this method is not invoked after an update of the volume data, succeeding calls to createNode will not reflect the new data. Note however, that if you call this method between two invocations of createNode without the volume data been altered, same textures will get uploaded twice to video memory, i.e. video resources will be wasted.

Implements LibCarna::helpers::VolumeGridHelperBase.

Definition at line 385 of file VolumeGridHelper.hpp.

Member Data Documentation

◆ maxSegmentBytesize

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
const std::size_t LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::maxSegmentBytesize

Maximum memory size of a single segment volume.

Definition at line 255 of file VolumeGridHelper.hpp.

◆ maxSegmentSize

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
const base::math::Vector3ui LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::maxSegmentSize

The maximum effective resolution of a single grid segment.

Definition at line 260 of file VolumeGridHelper.hpp.

◆ partitioningX

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
const details::VolumeGridHelper::Partionining LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::partitioningX

Describes the partitioning along the x-axis.

Definition at line 265 of file VolumeGridHelper.hpp.

◆ partitioningY

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
const details::VolumeGridHelper::Partionining LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::partitioningY

Describes the partitioning along the y-axis.

Definition at line 270 of file VolumeGridHelper.hpp.

◆ partitioningZ

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
const details::VolumeGridHelper::Partionining LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::partitioningZ

Describes the partitioning along the z-axis.

Definition at line 275 of file VolumeGridHelper.hpp.

◆ resolution

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
const base::math::Vector3ui LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::resolution

Holds the effective resolution, i.e. the resolution covered by the grid.

Definition at line 280 of file VolumeGridHelper.hpp.


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