Carna  Version 3.3.2
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Carna::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.h>

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

Public Member Functions

 VolumeGridHelper (const base::math::Vector3ui &nativeResolution, std::size_t maxSegmentBytesize=DEFAULT_MAX_SEGMENT_BYTESIZE)
 Creates new base::VolumeGrid object. Initializes its' segments s.t. the totally covered resolution is resolution at least. It may be chosen larger if the buffers' resolution need to be rounded to even numbers. More...
 
virtual void loadIntensities (const std::function< float(const base::math::Vector3ui &) > &intensityData) override
 Updates the data of the volume grid. More...
 
virtual void releaseGeometryFeatures () override
 Releases all previously acquired textures. Invoke this method when the volume data changes, loadIntensities already does takes care of that. More...
 
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. More...
 
virtual base::NodecreateNode (unsigned int geometryType, const Dimensions &dimensions) 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. More...
 
- Public Member Functions inherited from Carna::helpers::VolumeGridHelperBase
 VolumeGridHelperBase (const base::math::Vector3ui &nativeResolution)
 Instantiates. More...
 
virtual ~VolumeGridHelperBase ()
 Does nothing.
 
template<typename LoadIntensitiesFunction >
void loadIntensities (const LoadIntensitiesFunction &intensityData)
 
void loadHUData (const std::function< base::HUV(const base::math::Vector3ui &) > &huData)
 Updates the data of the volume grid. More...
 
template<typename LoadHUDataFunction >
void loadHUData (const LoadHUDataFunction &huData)
 
- Public Member Functions inherited from Carna::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 Carna::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 Carna::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
 
- Protected Member Functions inherited from Carna::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 Carna::helpers::details::VolumeGridHelper::TextureManager< IntensityTextureFactory< SegmentIntensityVolumeType, SegmentNormalsVolumeType > >
void attachTexture (base::Geometry &geometry, unsigned int role, const base::VolumeSegment< typename IntensityTextureFactory< SegmentIntensityVolumeType, SegmentNormalsVolumeType > ::SegmentIntensityVolume, typename IntensityTextureFactory< SegmentIntensityVolumeType, SegmentNormalsVolumeType > ::SegmentNormalsVolume > &segment) const
 Attaches the texture that TextureFactory creates from segment to geometry using role.
 

Additional Inherited Members

- Static Public Attributes inherited from Carna::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. More...
 
- Static Public Attributes inherited from Carna::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 Carna::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 the normal map is not required.

Normal Map Computation

The loadIntensities kicks off the computation of the normals automatically. If you alter the volume data differently, it is within your responsibility to do this 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 common segment faces. Hence, the resolution of the data uploaded to GPU from all segments, that we will call the total resolution therefore, will usually be greater than the resolution of the actually loaded data. We will refer to the latter as the native resolution.

Furthermore, the effective resolution, that is the one covered by the grid and available for payload, might still be greater than the native resolution, namely because the segments' resolution is rounded to even numbers. The additional voxels arising from this are not queried from the data source, but automatically padded with \(-1024\), s.t. the data source doesn't have to pay attention to this circumstance.

Author
Leonid Kostrykin
Date
8.3.15 - 29.3.15

Definition at line 216 of file Carna.h.

Constructor & Destructor Documentation

◆ VolumeGridHelper()

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

Creates new base::VolumeGrid object. Initializes its' segments s.t. the totally covered resolution is resolution at least. It may be chosen larger if the buffers' resolution 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 386 of file VolumeGridHelper.h.

Member Function Documentation

◆ createNode() [1/2]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
base::Node * Carna::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 in millimeters.

Implements Carna::helpers::VolumeGridHelperBase.

Definition at line 535 of file VolumeGridHelper.h.

◆ createNode() [2/2]

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
base::Node * Carna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::createNode ( unsigned int  geometryType,
const Dimensions dimensions 
) 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.
dimensionsSpecifies the dimensions of the whole dataset in millimeters.

Implements Carna::helpers::VolumeGridHelperBase.

Definition at line 545 of file VolumeGridHelper.h.

◆ loadIntensities()

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

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 Carna::helpers::VolumeGridHelperBase.

Definition at line 428 of file VolumeGridHelper.h.

◆ releaseGeometryFeatures()

template<typename SegmentIntensityVolumeType , typename SegmentNormalsVolumeType >
void Carna::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 Carna::helpers::VolumeGridHelperBase.

Definition at line 419 of file VolumeGridHelper.h.


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