![]() |
LibCarna Version 3.4.0
|
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>
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::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. | |
virtual base::Node * | createNode (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. | |
![]() | |
VolumeGridHelperBase (const base::math::Vector3ui &nativeResolution) | |
Instantiates. | |
virtual | ~VolumeGridHelperBase () |
Does nothing. | |
template<typename LoadIntensitiesFunction > | |
void | loadIntensities (const LoadIntensitiesFunction &intensityData) |
![]() | |
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 |
virtual void | loadIntensities (const std::function< float(const base::math::Vector3ui &) > &intensityData) override |
Updates the data of the volume grid. | |
![]() | |
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 TextureFactory::SegmentIntensityVolume, typename TextureFactory::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. | |
![]() | |
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 a normal map is not required. |
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
.
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.
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.
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 351 of file VolumeGridHelper.hpp.
|
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. |
extent | Specifies the extent of the whole dataset. |
Implements LibCarna::helpers::VolumeGridHelperBase.
Definition at line 510 of file VolumeGridHelper.hpp.
|
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. |
Implements LibCarna::helpers::VolumeGridHelperBase.
Definition at line 499 of file VolumeGridHelper.hpp.
base::VolumeGrid< SegmentIntensityVolumeType, SegmentNormalsVolumeType > & LibCarna::helpers::VolumeGridHelper< SegmentIntensityVolumeType, SegmentNormalsVolumeType >::grid | ( | ) | const |
References the underlying grid.
Definition at line 412 of file VolumeGridHelper.hpp.
|
overrideprotectedvirtual |
Definition at line 521 of file VolumeGridHelper.hpp.
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.
|
overrideprotectedvirtual |
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 LibCarna::helpers::VolumeGridHelperBase.
Definition at line 393 of file VolumeGridHelper.hpp.
|
virtual |
Updates the data of the volume grid.
The intensityData must be scaled to \(\left[0, 1\right]\).
Implements LibCarna::helpers::VolumeGridHelperBase.
|
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.
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.
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.
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.
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.
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.
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.
Written by Leonid Kostrykin © 2021–2025. Based on Carna (© 2010-2016).
Documentation generated by Doxygen