CTL  0.6.1
Computed Tomography Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
CTL::VoxelVolume< T > Class Template Reference

The VoxelVolume class provides a simple container for storage of voxelized 3D volume data. More...

#include <voxelvolume.h>

Collaboration diagram for CTL::VoxelVolume< T >:
Collaboration graph
[legend]

Classes

class  VoxelIterator
 

Public Types

using Dimensions = VoxelVolumeDimensions
 
using VoxelSize = VoxelVolumeVoxelSize
 
using Offset = VoxelVolumeOffset
 
using iterator = VoxelIterator< typename std::vector< T >::iterator >
 
using const_iterator = VoxelIterator< typename std::vector< T >::const_iterator >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
 VoxelVolume (const Dimensions &nbVoxels)
 
 VoxelVolume (const Dimensions &nbVoxels, const VoxelSize &voxelSize)
 
 VoxelVolume (uint nbVoxelX, uint nbVoxelY, uint nbVoxelZ)
 
 VoxelVolume (uint nbVoxelX, uint nbVoxelY, uint nbVoxelZ, float xSize, float ySize, float zSize)
 
 VoxelVolume (const Dimensions &nbVoxels, std::vector< T > data)
 
 VoxelVolume (const Dimensions &nbVoxels, const VoxelSize &voxelSize, std::vector< T > data)
 
 VoxelVolume (uint nbVoxelX, uint nbVoxelY, uint nbVoxelZ, std::vector< T > data)
 
 VoxelVolume (uint nbVoxelX, uint nbVoxelY, uint nbVoxelZ, float xSize, float ySize, float zSize, std::vector< T > data)
 
 VoxelVolume (const VoxelVolume &)=default
 
 VoxelVolume (VoxelVolume &&)=default
 
VoxelVolumeoperator= (const VoxelVolume &)=default
 
VoxelVolumeoperator= (VoxelVolume &&)=default
 
size_t allocatedElements () const
 
const std::vector< T > & constData () const
 
const std::vector< T > & data () const
 
std::vector< T > & data ()
 
const Dimensionsdimensions () const
 
bool hasData () const
 
const DimensionsnbVoxels () const
 
const Offsetoffset () const
 
T * rawData ()
 
const T * rawData () const
 
size_t totalVoxelCount () const
 
const VoxelSizevoxelSize () const
 
void setData (std::vector< T > &&data)
 
void setData (const std::vector< T > &data)
 
void setVolumeOffset (const Offset &offset)
 
void setVolumeOffset (float xOffset, float yOffset, float zOffset)
 
void setVoxelSize (const VoxelSize &size)
 
void setVoxelSize (float xSize, float ySize, float zSize)
 
void setVoxelSize (float isotropicSize)
 
void allocateMemory ()
 
void allocateMemory (const T &initValue)
 
VoxelCoordinates coordinates (const VoxelIndex &index) const
 
VoxelCoordinates coordinates (uint x, uint y, uint z) const
 
VoxelCoordinates cornerVoxel () const
 
VoxelIndex index (const VoxelCoordinates &coordinates) const
 
VoxelIndex index (float x_mm, float y_mm, float z_mm) const
 
bool isIsotropic () const
 
void fill (const T &fillValue)
 
void freeMemory ()
 
max () const
 
min () const
 
VoxelVolume< T > reslicedByX (bool reverse=false) const
 
VoxelVolume< T > reslicedByY (bool reverse=false) const
 
VoxelVolume< T > reslicedByZ (bool reverse=false) const
 
Chunk2D< T > sliceX (uint slice) const
 
Chunk2D< T > sliceY (uint slice) const
 
Chunk2D< T > sliceZ (uint slice) const
 
float smallestVoxelSize () const
 
VoxelCoordinates volumeCorner () const
 
std::vector< T >::reference operator() (uint x, uint y, uint z)
 
std::vector< T >::const_reference operator() (uint x, uint y, uint z) const
 
std::vector< T >::reference operator() (const VoxelIndex &index)
 
std::vector< T >::const_reference operator() (const VoxelIndex &index) const
 
VoxelVolume< T > & operator+= (const VoxelVolume< T > &other)
 
VoxelVolume< T > & operator-= (const VoxelVolume< T > &other)
 
VoxelVolume< T > & operator+= (const T &additiveShift)
 
VoxelVolume< T > & operator-= (const T &subtractiveShift)
 
VoxelVolume< T > & operator *= (const T &factor)
 
VoxelVolume< T > & operator/= (const T &divisor)
 
VoxelVolume< T > operator+ (const VoxelVolume< T > &other) const
 
VoxelVolume< T > operator- (const VoxelVolume< T > &other) const
 
VoxelVolume< T > operator+ (const T &additiveShift) const
 
VoxelVolume< T > operator- (const T &subtractiveShift) const
 
VoxelVolume< T > operator * (const T &factor) const
 
VoxelVolume< T > operator/ (const T &divisor) const
 

Static Public Member Functions

static VoxelVolume< T > fromChunk2DStack (const std::vector< Chunk2D< T >> &stack)
 
static VoxelVolume< T > ball (float radius, float voxelSize, const T &fillValue)
 
static VoxelVolume< T > cube (uint nbVoxel, float voxelSize, const T &fillValue)
 
static VoxelVolume< T > cylinderX (float radius, float height, float voxelSize, const T &fillValue)
 
static VoxelVolume< T > cylinderY (float radius, float height, float voxelSize, const T &fillValue)
 
static VoxelVolume< T > cylinderZ (float radius, float height, float voxelSize, const T &fillValue)
 

Protected Attributes

Dimensions _dim
 The dimensions of the volume.
 
VoxelSize _size = { 0.0f, 0.0f, 0.0f }
 The size of individual voxels (in mm).
 
Offset _offset = { 0.0f, 0.0f, 0.0f }
 The positional offset of the volume (in mm).
 
std::vector< T > _data
 The internal data of the volume.
 

Private Member Functions

bool hasEqualSizeAs (const std::vector< T > &other) const
 
template<class Function >
void parallelExecution (const Function &f) const
 

Detailed Description

template<typename T>
class CTL::VoxelVolume< T >

The VoxelVolume class provides a simple container for storage of voxelized 3D volume data.

This class is the main container used for storage of voxelized 3D volume data. The container is templated. Internally, data is stored using an std::vector<T> (one-dimensional). Typical types for T are:

To specify the volume, the number of voxels in each dimensions must be defined. Physical meaning is assigned to the volume by defining the dimensions of the voxels (in millimeter). The physical center of the volume coincides with the origin of the world coordinate system. Optionally, an offset can be specified to describe the an off-center location of the volume in space. Without any offset, the center of the volume is located exactly in the origin \([0,0,0]\) of the world coordinate system.

The internal storage has row major order, i.e. consecutive values are first all voxel values in x-direction followed by y-direction. At last, z is incremented.

Constructor & Destructor Documentation

◆ VoxelVolume() [1/8]

template<typename T >
CTL::VoxelVolume< T >::VoxelVolume ( const Dimensions nbVoxels)
explicit

Constructs a voxelized volume with nbVoxels voxels.

This constuctor does not allocate memory for the data. To enforce memory allocation, use allocateMemory().

◆ VoxelVolume() [2/8]

template<typename T >
CTL::VoxelVolume< T >::VoxelVolume ( const Dimensions nbVoxels,
const VoxelSize voxelSize 
)

Constructs a voxelized volume with nbVoxels voxels. Each voxel has the (physical) dimensions specified by voxelSize.

This constuctor does not allocate memory for the data. To enforce memory allocation, use allocateMemory().

◆ VoxelVolume() [3/8]

template<typename T >
CTL::VoxelVolume< T >::VoxelVolume ( uint  nbVoxelX,
uint  nbVoxelY,
uint  nbVoxelZ 
)

Constructs a voxelized volume with [nbVoxelX, nbVoxelY, nbVoxelZ] voxels.

This constuctor does not allocate memory for the data. To enforce memory allocation, use allocateMemory().

◆ VoxelVolume() [4/8]

template<typename T >
CTL::VoxelVolume< T >::VoxelVolume ( uint  nbVoxelX,
uint  nbVoxelY,
uint  nbVoxelZ,
float  xSize,
float  ySize,
float  zSize 
)

Constructs a voxelized volume with [nbVoxelX, nbVoxelY, nbVoxelZ] voxels. Each voxel has the (physical) dimensions xSize x ySize x zSize (in millimeters).

This constuctor does not allocate memory for the data. To enforce memory allocation, use allocateMemory().

◆ VoxelVolume() [5/8]

template<typename T>
CTL::VoxelVolume< T >::VoxelVolume ( const Dimensions nbVoxels,
std::vector< T >  data 
)

Constructs a voxelized volume with nbVoxels voxels and sets its data to data.

A dimension consistency check is performed to set the data, i.e. the number of elements in data need to match the number of voxels in the volume. Throws std::domain_error in case of mismatching dimensions.

◆ VoxelVolume() [6/8]

template<typename T>
CTL::VoxelVolume< T >::VoxelVolume ( const Dimensions nbVoxels,
const VoxelSize voxelSize,
std::vector< T >  data 
)

Constructs a voxelized volume with nbVoxels voxels and sets its data to data. Each voxel has the (physical) dimensions specified by voxelSize.

A dimension consistency check is performed to set the data, i.e. the number of elements in data need to match the number of voxels in the volume. Throws std::domain_error in case of mismatching dimensions.

◆ VoxelVolume() [7/8]

template<typename T>
CTL::VoxelVolume< T >::VoxelVolume ( uint  nbVoxelX,
uint  nbVoxelY,
uint  nbVoxelZ,
std::vector< T >  data 
)

Constructs a voxelized volume with [nbVoxelX, nbVoxelY, nbVoxelZ] voxels and sets its data to data.

A dimension consistency check is performed to set the data, i.e. the number of elements in data need to match the number of voxels in the volume. Throws std::domain_error in case of mismatching dimensions.

◆ VoxelVolume() [8/8]

template<typename T>
CTL::VoxelVolume< T >::VoxelVolume ( uint  nbVoxelX,
uint  nbVoxelY,
uint  nbVoxelZ,
float  xSize,
float  ySize,
float  zSize,
std::vector< T >  data 
)

Constructs a voxelized volume with [nbVoxelX, nbVoxelY, nbVoxelZ] voxels and sets its data to data. The voxels have the (physical) dimensions xSize x ySize x zSize (in millimeters).

A dimension consistency check is performed to set the data, i.e. the number of elements in data need to match the number of voxels in the volume. Throws std::domain_error in case of mismatching dimensions.

Member Function Documentation

◆ allocatedElements()

template<typename T >
size_t CTL::VoxelVolume< T >::allocatedElements ( ) const

Returns the number of elements for which memory has been allocated. This is either zero if no memory has been allocated (after instantiation with a non-allocating constructor) or equal to the number of elements.

Same as: constData().size().

See also
totalVoxelCount(), allocateMemory().

◆ allocateMemory() [1/2]

template<typename T >
void CTL::VoxelVolume< T >::allocateMemory ( )

Enforces memory allocation. This resizes the internal std::vector to the required number of elements, given by the dimensions of the chunk, i.e. width x heigth.

As a result, allocatedElements() will return the same as totalVoxelCount().

See also
totalVoxelCount().

◆ allocateMemory() [2/2]

template<typename T>
void CTL::VoxelVolume< T >::allocateMemory ( const T &  initValue)

Enforces memory allocation and if the current number of allocated elements is less than the number of elements in the chunk, additional copies of initValue are appended.

See also
allocatedElements(), allocateMemory(), fill().

◆ ball()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::ball ( float  radius,
float  voxelSize,
const T &  fillValue 
)
static

Constructs a voxelized volume with voxels of isotropic dimensions voxelSize (in mm) and fills all voxels inside a ball of radius radius (in mm) around the center of the volume with fillValue. The voxels surrounding the ball are filled with zeros.

The resulting volume will have \( \left\lceil 2\cdot radius/voxelSize\right\rceil \) voxels in each dimension.

◆ constData()

template<typename T >
const std::vector< T > & CTL::VoxelVolume< T >::constData ( ) const

Returns a constant reference to the stored data vector.

◆ coordinates() [1/2]

template<typename T >
VoxelCoordinates CTL::VoxelVolume< T >::coordinates ( const VoxelIndex index) const

Returns the (world) coordinates (in mm) of the center of the voxel with index index.

◆ coordinates() [2/2]

template<typename T >
VoxelCoordinates CTL::VoxelVolume< T >::coordinates ( uint  x,
uint  y,
uint  z 
) const

Returns the (world) coordinates (in mm) of the center of the voxel with index \([x,y,z]\).

◆ cornerVoxel()

template<typename T >
VoxelCoordinates CTL::VoxelVolume< T >::cornerVoxel ( ) const

Returns the (world) coordinates (in mm) of the center of the voxel with index \([0,0,0]\), i.e. located at the corner of the volume.

◆ cube()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::cube ( uint  nbVoxel,
float  voxelSize,
const T &  fillValue 
)
static

Constructs a cubic voxelized volume with nbVoxel x nbVoxel x nbVoxel voxels (voxel dimension: voxelSize x voxelSize x voxelSize), filled with fillValue.

◆ cylinderX()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::cylinderX ( float  radius,
float  height,
float  voxelSize,
const T &  fillValue 
)
static

Constructs a voxelized volume with voxels of isotropic dimensions voxelSize (in mm) and fills all voxels inside a cylinder of radius radius (in mm) and height height (in mm) aligned with the x-axis with* fillValue. The voxels surrounding the cylinder are filled with zeros.

The resulting volume will have \( \left\lceil 2\cdot radius/voxelSize\right\rceil \) voxels in y- and z-dimension and \( \left\lceil height/voxelSize\right\rceil \) in x-direction.

◆ cylinderY()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::cylinderY ( float  radius,
float  height,
float  voxelSize,
const T &  fillValue 
)
static

Constructs a voxelized volume with voxels of isotropic dimensions voxelSize (in mm) and fills all voxels inside a cylinder of radius radius (in mm) and height height (in mm) aligned with the y-axis with* fillValue. The voxels surrounding the cylinder are filled with zeros.

The resulting volume will have \( \left\lceil 2\cdot radius/voxelSize\right\rceil \) voxels in x- and z-dimension and \( \left\lceil height/voxelSize\right\rceil \) in y-direction.

◆ cylinderZ()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::cylinderZ ( float  radius,
float  height,
float  voxelSize,
const T &  fillValue 
)
static

Constructs a voxelized volume with voxels of isotropic dimensions voxelSize (in mm) and fills all voxels inside a cylinder of radius radius (in mm) and height height (in mm) aligned with the z-axis with* fillValue. The voxels surrounding the cylinder are filled with zeros.

The resulting volume will have \( \left\lceil 2\cdot radius/voxelSize\right\rceil \) voxels in x- and y-dimension and \( \left\lceil height/voxelSize\right\rceil \) in z-direction.

◆ data() [1/2]

template<typename T >
const std::vector< T > & CTL::VoxelVolume< T >::data ( ) const

Returns a constant reference to the stored data vector.

◆ data() [2/2]

template<typename T >
std::vector< T > & CTL::VoxelVolume< T >::data ( )

Returns a reference to the stored data vector.

◆ dimensions()

template<typename T >
const VoxelVolume< T >::Dimensions & CTL::VoxelVolume< T >::dimensions ( ) const

Returns the number of voxels in all three dimensions.

Same as nbVoxels().

◆ fill()

template<typename T>
void CTL::VoxelVolume< T >::fill ( const T &  fillValue)

Fills the volume with fillValue. Note that this will overwrite all data stored in the volume.

This method allocates memory for the data if it has not been allocated before.

◆ freeMemory()

template<typename T >
void CTL::VoxelVolume< T >::freeMemory ( )

Deletes the data of the voxel volume.

See also
allocateMemory()

◆ fromChunk2DStack()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::fromChunk2DStack ( const std::vector< Chunk2D< T >> &  stack)
static

Constructs a voxelized volume from a stack of slices (vector of Chunk2D). All slices in stack will be concatenated in z-direction.

Note that all slices are required to have identical dimensions. Throws an std::domain_error otherwise. Returns an empty VoxelVolume (all dimensions zero) when an empty stack is passed.

◆ hasData()

template<typename T >
bool CTL::VoxelVolume< T >::hasData ( ) const

Returns true if the number of allocated elements is equal to the total number of voxels. Otherwise the function returns false.

See also
totalVoxelCount(), allocatedElements()

◆ hasEqualSizeAs()

template<typename T>
bool CTL::VoxelVolume< T >::hasEqualSizeAs ( const std::vector< T > &  other) const
private

Checks if the number of elements in other match the voxel count of this instance.

◆ index() [1/2]

template<typename T >
VoxelIndex CTL::VoxelVolume< T >::index ( const VoxelCoordinates coordinates) const

Returns the index of the voxel whose center is closest to the world coordinate position coordinates.

Does not perform out of bounds checks.

◆ index() [2/2]

template<typename T >
VoxelIndex CTL::VoxelVolume< T >::index ( float  x_mm,
float  y_mm,
float  z_mm 
) const

Returns the index of the voxel whose center is closest to the world coordinate position \([x_mm, y_mm, z_mm]\)).

Does not perform out of bounds checks.

◆ isIsotropic()

template<typename T >
bool CTL::VoxelVolume< T >::isIsotropic ( ) const

Returns true if the voxel sizes in all three dimensions are considered equal; thus the size is isotropic. Returns false otherwise.

Same as

.

◆ max()

template<typename T >
T CTL::VoxelVolume< T >::max ( ) const

Returns the highest value in this volume. Returns zero for empty VoxelVolume objects.

◆ min()

template<typename T >
T CTL::VoxelVolume< T >::min ( ) const

Returns the smallest value in this volume. Returns zero for empty VoxelVolume objects.

◆ nbVoxels()

template<typename T >
const VoxelVolume< T >::Dimensions & CTL::VoxelVolume< T >::nbVoxels ( ) const

Returns the number of voxels in all three dimensions.

For the total number of voxels in the volume, use totalVoxelCount().

◆ offset()

template<typename T >
const VoxelVolume< T >::Offset & CTL::VoxelVolume< T >::offset ( ) const

Returns the offset of the volume.

◆ operator *()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::operator * ( const T &  factor) const

Returns a copy of this volume with all its voxel values multiplied by factor.

◆ operator *=()

template<typename T>
VoxelVolume< T > & CTL::VoxelVolume< T >::operator *= ( const T &  factor)

Multiplies all voxel values in this volume by factor and returns a reference to this instance.

◆ operator()() [1/4]

template<typename T >
std::vector< T >::reference CTL::VoxelVolume< T >::operator() ( uint  x,
uint  y,
uint  z 
)

Returns a reference to the data at voxel \([x,y,z]\). Does not perform boundary checks.

◆ operator()() [2/4]

template<typename T >
std::vector< T >::const_reference CTL::VoxelVolume< T >::operator() ( uint  x,
uint  y,
uint  z 
) const

Returns a constant reference to the data at voxel \([x,y,z]\). Does not perform boundary checks.

◆ operator()() [3/4]

template<typename T >
std::vector< T >::reference CTL::VoxelVolume< T >::operator() ( const VoxelIndex index)

Returns a constant reference to the data at voxel index index. Does not perform boundary checks.

◆ operator()() [4/4]

template<typename T >
std::vector< T >::const_reference CTL::VoxelVolume< T >::operator() ( const VoxelIndex index) const

Returns a constant reference to the data at voxel index index. Does not perform boundary checks.

◆ operator+() [1/2]

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::operator+ ( const VoxelVolume< T > &  other) const

Returns the (element-wise) sum of this volume and other. Throws an std::domain_error if the dimensions of other and this volume do not match.

Note that the voxel size will be ignored (i.e. there is no consistency check). Hence, the result will always have the voxel size of this instance (i.e. left hand side operand).

◆ operator+() [2/2]

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::operator+ ( const T &  additiveShift) const

Returns a copy of this volume in which additiveShift has been added to all voxel values.

◆ operator+=() [1/2]

template<typename T>
VoxelVolume< T > & CTL::VoxelVolume< T >::operator+= ( const VoxelVolume< T > &  other)

Adds the data from other to this volume and returns a reference to this instance. Throws an std::domain_error if the dimensions of other and this volume do not match.

Note that the voxel size will be ignored (i.e. there is no consistency check). Hence, the result will always have the voxel size of this instance.

◆ operator+=() [2/2]

template<typename T>
VoxelVolume< T > & CTL::VoxelVolume< T >::operator+= ( const T &  additiveShift)

Adds additiveShift to all voxel values in this volume and returns a reference to this instance.

◆ operator-() [1/2]

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::operator- ( const VoxelVolume< T > &  other) const

Returns the (element-wise) difference between this volume and other. Throws an std::domain_error if the dimensions of other and this volume do not match.

Note that the voxel size will be ignored (i.e. there is no consistency check). Hence, the result will always have the voxel size of this instance (i.e. left hand side operand).

◆ operator-() [2/2]

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::operator- ( const T &  subtractiveShift) const

Returns a copy of this volume in which subtractiveShift has been subtracted from all voxel values.

◆ operator-=() [1/2]

template<typename T>
VoxelVolume< T > & CTL::VoxelVolume< T >::operator-= ( const VoxelVolume< T > &  other)

Subtracts the data from other from this volume and returns a reference to this instance. Throws an std::domain_error if the dimensions of other and this volume do not match.

Note that the voxel size will be ignored (i.e. there is no consistency check). Hence, the result will always have the voxel size of this instance.

◆ operator-=() [2/2]

template<typename T>
VoxelVolume< T > & CTL::VoxelVolume< T >::operator-= ( const T &  subtractiveShift)

Subtracts subtractiveShift from all voxel values in this volume and returns a reference to this instance.

◆ operator/()

template<typename T>
VoxelVolume< T > CTL::VoxelVolume< T >::operator/ ( const T &  divisor) const

Returns a copy of this volume with all its voxel values divided by divisor.

◆ operator/=()

template<typename T>
VoxelVolume< T > & CTL::VoxelVolume< T >::operator/= ( const T &  divisor)

Divides all voxel values in this volume by divisor and returns a reference to this instance.

◆ parallelExecution()

template<typename T >
template<class Function >
void CTL::VoxelVolume< T >::parallelExecution ( const Function &  f) const
private

Helper function for running tasks in parallel over voxels.

◆ rawData() [1/2]

template<typename T >
T * CTL::VoxelVolume< T >::rawData ( )

Returns the pointer to the raw data.

Same as data().data().

◆ rawData() [2/2]

template<typename T >
const T * CTL::VoxelVolume< T >::rawData ( ) const

Returns the pointer to the constant raw data.

Same as constData().data().

◆ reslicedByX()

template<typename T >
VoxelVolume< T > CTL::VoxelVolume< T >::reslicedByX ( bool  reverse = false) const

Returns a copy of the volume resliced along the x-axis. If reverse is set true, reslicing will be performed in inverse order (i.e. with descending x value).

The reslicing process switches the orientation of the volume, such that the original axes: [x,y,z] change to [y,z,x].

◆ reslicedByY()

template<typename T >
VoxelVolume< T > CTL::VoxelVolume< T >::reslicedByY ( bool  reverse = false) const

Returns a copy of the volume resliced along the y-axis. If reverse is set true, reslicing will be performed in inverse order (i.e. with descending y value).

The reslicing process switches the orientation of the volume, such that the original axes: [x,y,z] change to [x,z,y].

◆ reslicedByZ()

template<typename T >
VoxelVolume< T > CTL::VoxelVolume< T >::reslicedByZ ( bool  reverse = false) const

Returns a copy of the volume resliced along the z-axis. If reverse is set true, reslicing will be performed in inverse order (i.e. with descending z value).

Since the volume is sliced in z-direction by default, this method will not change the axes when reverse is false (default value). It simply returns an exact copy of the volume.

◆ setData() [1/2]

template<typename T>
void CTL::VoxelVolume< T >::setData ( std::vector< T > &&  data)

Move-sets the data vector to data. This method performs a dimensionality check and throws an error if dimensions mismatch.

◆ setData() [2/2]

template<typename T>
void CTL::VoxelVolume< T >::setData ( const std::vector< T > &  data)

Sets the data vector to data. This method performs a dimensionality check and throws an error if dimensions mismatch.

◆ setVolumeOffset() [1/2]

template<typename T >
void CTL::VoxelVolume< T >::setVolumeOffset ( const Offset offset)

Sets the offset of the volume to offset. This is expected to be specified in millimeter.

◆ setVolumeOffset() [2/2]

template<typename T >
void CTL::VoxelVolume< T >::setVolumeOffset ( float  xOffset,
float  yOffset,
float  zOffset 
)

Convenience setter. Sets the offset of the volume using the components xOffset, yOffset and zOffset. Offset values are expected to be specified in millimeter.

◆ setVoxelSize() [1/3]

template<typename T >
void CTL::VoxelVolume< T >::setVoxelSize ( const VoxelSize size)

Sets the voxel size to size. This is expected to be specified in millimeter.

◆ setVoxelSize() [2/3]

template<typename T >
void CTL::VoxelVolume< T >::setVoxelSize ( float  xSize,
float  ySize,
float  zSize 
)

Convenience setter. Sets the voxel size using the components xSize, ySize and zSize. Dimensions are expected to be specified in millimeter.

◆ setVoxelSize() [3/3]

template<typename T >
void CTL::VoxelVolume< T >::setVoxelSize ( float  isotropicSize)

Sets an isotropic voxels size of isotropicSize (in mm).

◆ sliceX()

template<typename T >
Chunk2D< T > CTL::VoxelVolume< T >::sliceX ( uint  slice) const

Returns the yz-slice of the volume at position \(x=\) slice as a Chunk2D.

◆ sliceY()

template<typename T >
Chunk2D< T > CTL::VoxelVolume< T >::sliceY ( uint  slice) const

Returns the xz-slice of the volume at position \(y=\) slice as a Chunk2D.

◆ sliceZ()

template<typename T >
Chunk2D< T > CTL::VoxelVolume< T >::sliceZ ( uint  slice) const

Returns the xy-slice of the volume at position \(z=\) slice as a Chunk2D.

◆ smallestVoxelSize()

template<typename T >
float CTL::VoxelVolume< T >::smallestVoxelSize ( ) const

Returns the smallest edge length of the voxels (in millimeter).

◆ totalVoxelCount()

template<typename T >
size_t CTL::VoxelVolume< T >::totalVoxelCount ( ) const

Returns the total number of voxels in the volume. This is the product of the voxel count in all three dimensions.

◆ volumeCorner()

template<typename T >
VoxelCoordinates CTL::VoxelVolume< T >::volumeCorner ( ) const

Returns the (world) coordinates (in mm) of the corner of the volume (referring to voxel \([0,0,0]\)).

◆ voxelSize()

template<typename T >
const VoxelVolume< T >::VoxelSize & CTL::VoxelVolume< T >::voxelSize ( ) const

Returns the size of the voxels (in millimeter).


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