Carna
Version 3.3.2
|
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>
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::Node * | createNode (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::Node * | createNode (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... | |
![]() | |
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) |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
const base::math::Vector3ui | nativeResolution |
Holds the original resolution of the loaded data. | |
Protected Member Functions | |
virtual base::math::Vector3ui | gridResolution () const override |
![]() | |
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. | |
![]() | |
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 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 const unsigned int | DEFAULT_ROLE_INTENSITIES = 0 |
Holds the default role to use for attaching textures to base::Geometry nodes. | |
Computes the partitioning of volumetric data and the corresponding normal map. Also creates scene nodes that insert the volumetric data into a scene.
SegmentIntensityVolumeType | is the base::BufferedIntensityVolume compatible type to use for storing the intensity volume of a single partition. |
SegmentNormalsVolumeType | is 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. |
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
.
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.
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.
nativeResolution | The resolution the grid is to be prepared for. This is the resolution that will be expected from the data source. |
maxSegmentBytesize | Maximum memory size of a single segment volume. The segments partitioning is chosen according to this value. |
Definition at line 386 of file VolumeGridHelper.h.
|
overridevirtual |
Creates renderable representation of the underlying grid, that can be put anywhere in the scene graph. The volume is centered in the node.
geometryType | Will be used for base::Geometry instantiation. |
spacing | Specifies the spacing between two succeeding voxel centers in millimeters. |
Implements Carna::helpers::VolumeGridHelperBase.
Definition at line 535 of file VolumeGridHelper.h.
|
overridevirtual |
Creates renderable representation of the underlying grid, that can be put anywhere in the scene graph. The volume is centered in the node.
geometryType | Will be used for base::Geometry instantiation. |
dimensions | Specifies the dimensions of the whole dataset in millimeters. |
Implements Carna::helpers::VolumeGridHelperBase.
Definition at line 545 of file VolumeGridHelper.h.
|
overridevirtual |
Updates the data of the volume grid.
The intensityData must be scaled to \(\left[0, 1\right]\).
intensityData | Unary 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.
|
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.
Documentation generated by Doxygen