CortidQCT  1.2.2.52
Public Types | List of all members
CortidQCT::VoxelVolume Class Reference

Type representing a voxel volume. More...

#include <VoxelVolume.h>

Public Types

using ValueType = float
 Voxel value type.
 

Construction

 VoxelVolume () noexcept
 Constructs an empty volume.
 
 VoxelVolume (std::string const &filename)
 

IO

VoxelVolumeloadFromFile (std::string const &filename)
 Loads the volume data from file using format auto detection. More...
 

Accessors

VolumeSize const & size () const noexcept
 Returns the volume size.
 
VoxelSize const & voxelSize () const noexcept
 Returns the voxel size.
 
bool isEmpty () const noexcept
 Returns true iff the volume is empty.
 

Raw Data Access

The methods in this section all call a functional with a pointer to raw data as its argument. The pointer is only guaranteed to be valid within the call to the given functional.

Attention
Do not return the row pointer or save it any other way!
template<class F >
auto withUnsafeDataPointer (F &&f) const noexcept(noexcept(f(std::declval< VoxelData >().data())))
 Calls the given functional with an unsafe pointer to the raw voxel storage. More...
 

Detailed Description

Type representing a voxel volume.

A 3D voxel volume where each voxel has a floating point density value. Voxel size can be anisotropic.

Constructor & Destructor Documentation

CortidQCT::VoxelVolume::VoxelVolume ( std::string const &  filename)
inline

Constructs a volume by reading its data from a file

See also
loadFromFile

Member Function Documentation

VoxelVolume & CortidQCT::VoxelVolume::loadFromFile ( std::string const &  filename)

Loads the volume data from file using format auto detection.

Supported file formats are: bst

Parameters
filenamePath to the file to load the volume from
Returns
Reference to the loaded volume
Exceptions
std::invalid_argumentif the volume could not be loaded from the file given by filename
std::invalid_argumentif the file format could not be recognized
template<class F >
auto CortidQCT::VoxelVolume::withUnsafeDataPointer ( F &&  f) const
inlinenoexcept

Calls the given functional with an unsafe pointer to the raw voxel storage.

Voxel data are stored in column major order: y, x then z.

Template Parameters
Ffunction that accepts a ValueType const * pointer as the only argument.
Exceptions
noexcept(conditional)iff f(ValueType const *) is noexcept
Returns
The return value of the functional

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