CTL  0.6.1
Computed Tomography Library
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
CTL::LinearDynamicVolume Class Reference

The LinearDynamicVolume class is an implementation of AbstractDynamicVolumeData with a linear relation of the attenuation values of each voxel. More...

#include <lineardynamicvolume.h>

Inheritance diagram for CTL::LinearDynamicVolume:
Inheritance graph
[legend]
Collaboration diagram for CTL::LinearDynamicVolume:
Collaboration graph
[legend]

Public Member Functions

SpectralVolumeDataclone () const override
 
 LinearDynamicVolume (float slope, float offset, const VoxelVolume< float >::Dimensions &nbVoxel, const VoxelVolume< float >::VoxelSize &voxelSize)
 
 LinearDynamicVolume (VoxelVolume< float > slope, VoxelVolume< float > offset, const VoxelVolume< float >::VoxelSize &voxelSize)
 
 LinearDynamicVolume (VoxelVolume< float > slope, VoxelVolume< float > offset)
 
XYDataSeries timeCurve (uint x, uint y, uint z, const std::vector< float > &timePoints) override
 
virtual XYDataSeries timeCurve (uint x, uint y, uint z, const std::vector< float > &timePoints)
 
XYDataSeries timeCurve (uint x, uint y, uint z, float tStart, float tEnd, uint nbSamples)
 
XYDataSeries timeCurve (uint x, uint y, uint z, SamplingRange timeRange, uint nbSamples)
 
- Public Member Functions inherited from CTL::AbstractDynamicVolumeData
 AbstractDynamicVolumeData (const SpectralVolumeData &other)
 
void setTime (double seconds)
 
double time () const
 
XYDataSeries timeCurve (uint x, uint y, uint z, float tStart, float tEnd, uint nbSamples)
 
XYDataSeries timeCurve (uint x, uint y, uint z, SamplingRange timeRange, uint nbSamples)
 
- Public Member Functions inherited from CTL::SpectralVolumeData
 SpectralVolumeData (VoxelVolume< float > muValues)
 Constructs a SpectralVolumeData representing the attenuation coefficients muValues (in 1/mm). More...
 
 SpectralVolumeData (VoxelVolume< float > muValues, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel, float referenceEnergy, const QString &materialName=QString())
 Constructs a SpectralVolumeData representing the attenuation coefficients muValues (in 1/mm) with respect to the given referenceEnergy (in keV) for a material described by absorptionModel. More...
 
 SpectralVolumeData (VoxelVolume< float > materialDensity, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel, const QString &materialName=QString())
 Constructs a SpectralVolumeData representing the density values materialDensity (in g/cm^3) for a material described by absorptionModel. More...
 
std::shared_ptr< AbstractIntegrableDataModelabsorptionModel () const
 
std::unique_ptr< SpectralVolumeDatadensityVolume () const
 
bool hasSpectralInformation () const
 
bool isDensityVolume () const
 
bool isMuVolume () const
 
float massAttenuationCoeff (float atEnergy) const
 
const QString & materialName () const
 
float meanMassAttenuationCoeff (float centerEnergy, float binWidth) const
 
std::unique_ptr< SpectralVolumeDatamuVolume (float referenceEnergy) const
 
std::unique_ptr< SpectralVolumeDatamuVolume (float centerEnergy, float binWidth) const
 
float referenceEnergy () const
 
float referenceMassAttenuationCoeff () const
 
void replaceAbsorptionModel (AbstractIntegrableDataModel *absorptionModel)
 
void replaceAbsorptionModel (std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
 
void setDensity (VoxelVolume< float > density)
 
void setMaterialName (const QString &name)
 
 SpectralVolumeData (const SpectralVolumeData &)=default
 
 SpectralVolumeData (SpectralVolumeData &&)=default
 
SpectralVolumeDataoperator= (const SpectralVolumeData &)=default
 
SpectralVolumeDataoperator= (SpectralVolumeData &&)=default
 
void transformToAttenuationCoeff (float referenceEnergy)
 
void transformToDensity ()
 
- Public Member Functions inherited from CTL::VoxelVolume< float >
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
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< float > data)
 
 VoxelVolume (const Dimensions &nbVoxels, const VoxelSize &voxelSize, std::vector< float > data)
 
 VoxelVolume (uint nbVoxelX, uint nbVoxelY, uint nbVoxelZ, std::vector< float > data)
 
 VoxelVolume (uint nbVoxelX, uint nbVoxelY, uint nbVoxelZ, float xSize, float ySize, float zSize, std::vector< float > data)
 
 VoxelVolume (const VoxelVolume &)=default
 
 VoxelVolume (VoxelVolume &&)=default
 
VoxelVolumeoperator= (const VoxelVolume &)=default
 
VoxelVolumeoperator= (VoxelVolume &&)=default
 
size_t allocatedElements () const
 
const std::vector< float > & constData () const
 
const std::vector< float > & data () const
 
std::vector< float > & data ()
 
const Dimensionsdimensions () const
 
bool hasData () const
 
const DimensionsnbVoxels () const
 
const Offsetoffset () const
 
float * rawData ()
 
const float * rawData () const
 
size_t totalVoxelCount () const
 
const VoxelSizevoxelSize () const
 
void setData (std::vector< float > &&data)
 
void setData (const std::vector< float > &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 float &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 float &fillValue)
 
void freeMemory ()
 
float max () const
 
float min () const
 
VoxelVolume< float > reslicedByX (bool reverse=false) const
 
VoxelVolume< float > reslicedByY (bool reverse=false) const
 
VoxelVolume< float > reslicedByZ (bool reverse=false) const
 
Chunk2D< float > sliceX (uint slice) const
 
Chunk2D< float > sliceY (uint slice) const
 
Chunk2D< float > sliceZ (uint slice) const
 
float smallestVoxelSize () const
 
VoxelCoordinates volumeCorner () const
 
std::vector< float >::reference operator() (uint x, uint y, uint z)
 
std::vector< float >::const_reference operator() (uint x, uint y, uint z) const
 
std::vector< float >::reference operator() (const VoxelIndex &index)
 
std::vector< float >::const_reference operator() (const VoxelIndex &index) const
 
VoxelVolume< float > & operator+= (const VoxelVolume< float > &other)
 
VoxelVolume< float > & operator+= (const float &additiveShift)
 
VoxelVolume< float > & operator-= (const VoxelVolume< float > &other)
 
VoxelVolume< float > & operator-= (const float &subtractiveShift)
 
VoxelVolume< float > & operator *= (const float &factor)
 
VoxelVolume< float > & operator/= (const float &divisor)
 
VoxelVolume< float > operator+ (const VoxelVolume< float > &other) const
 
VoxelVolume< float > operator+ (const float &additiveShift) const
 
VoxelVolume< float > operator- (const VoxelVolume< float > &other) const
 
VoxelVolume< float > operator- (const float &subtractiveShift) const
 
VoxelVolume< float > operator * (const float &factor) const
 
VoxelVolume< float > operator/ (const float &divisor) const
 

Static Public Member Functions

static LinearDynamicVolume ball (float radius, float voxelSize, float slope, float offset)
 
static LinearDynamicVolume cube (uint nbVoxel, float voxelSize, float slope, float offset)
 
static LinearDynamicVolume cylinderX (float radius, float height, float voxelSize, float slope, float offset)
 
static LinearDynamicVolume cylinderY (float radius, float height, float voxelSize, float slope, float offset)
 
static LinearDynamicVolume cylinderZ (float radius, float height, float voxelSize, float slope, float offset)
 
- Static Public Member Functions inherited from CTL::SpectralVolumeData
static SpectralVolumeData ball (float radius, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
 
static SpectralVolumeData cube (uint nbVoxel, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
 
static SpectralVolumeData cylinderX (float radius, float height, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
 
static SpectralVolumeData cylinderY (float radius, float height, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
 
static SpectralVolumeData cylinderZ (float radius, float height, float voxelSize, float density, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel)
 
static SpectralVolumeData fromMuVolume (VoxelVolume< float > muValues, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel, float referenceEnergy=50.0f)
 
static SpectralVolumeData fromHUVolume (VoxelVolume< float > HUValues, std::shared_ptr< AbstractIntegrableDataModel > absorptionModel, float referenceEnergy=50.0f)
 
- Static Public Member Functions inherited from CTL::VoxelVolume< float >
static VoxelVolume< float > fromChunk2DStack (const std::vector< Chunk2D< float >> &stack)
 
static VoxelVolume< float > ball (float radius, float voxelSize, const float &fillValue)
 
static VoxelVolume< float > cube (uint nbVoxel, float voxelSize, const float &fillValue)
 
static VoxelVolume< float > cylinderX (float radius, float height, float voxelSize, const float &fillValue)
 
static VoxelVolume< float > cylinderY (float radius, float height, float voxelSize, const float &fillValue)
 
static VoxelVolume< float > cylinderZ (float radius, float height, float voxelSize, const float &fillValue)
 

Protected Member Functions

void updateVolume () override
 
- Protected Member Functions inherited from CTL::AbstractDynamicVolumeData
 AbstractDynamicVolumeData (const AbstractDynamicVolumeData &)=default
 
 AbstractDynamicVolumeData (AbstractDynamicVolumeData &&)=default
 
AbstractDynamicVolumeDataoperator= (const AbstractDynamicVolumeData &)=default
 
AbstractDynamicVolumeDataoperator= (AbstractDynamicVolumeData &&)=default
 

Private Attributes

VoxelVolume< float > _lag
 
VoxelVolume< float > _slope
 

Additional Inherited Members

- Public Types inherited from CTL::VoxelVolume< float >
using Dimensions = VoxelVolumeDimensions
 
using VoxelSize = VoxelVolumeVoxelSize
 
using Offset = VoxelVolumeOffset
 
using iterator = VoxelIterator< typename std::vector< float >::iterator >
 
using const_iterator = VoxelIterator< typename std::vector< float >::const_iterator >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
- Protected Attributes inherited from CTL::VoxelVolume< float >
Dimensions _dim
 The dimensions of the volume.
 
VoxelSize _size
 The size of individual voxels (in mm).
 
Offset _offset
 The positional offset of the volume (in mm).
 
std::vector< float > _data
 The internal data of the volume.
 

Detailed Description

The LinearDynamicVolume class is an implementation of AbstractDynamicVolumeData with a linear relation of the attenuation values of each voxel.

The following example code shows how to create a ball whose attenuation values increase linearly over time as well as a cubic volume holding linearly decreasing values:

// create a ball phantom with attenuation values increasing by 0.1/mm each millisecond
// attenuation values start at 0.0/mm at time point 0 ms
LinearDynamicVolume dynamicBall(VoxelVolume<float>::ball(30.0f, 1.0f, 0.1f),
VoxelVolume<float>::ball(30.0f, 1.0f, 0.0f));
// create a cubic phantom with attenuation values decreasing by 0.05/mm each millisecond
// attenuation values start at 1.0/mm at time point 0 ms
LinearDynamicVolume dynamicCube(VoxelVolume<float>::cube(100, 1.0f, -0.05f),
VoxelVolume<float>::cube(100, 1.0f, 1.0f));

Constructor & Destructor Documentation

◆ LinearDynamicVolume() [1/2]

CTL::LinearDynamicVolume::LinearDynamicVolume ( VoxelVolume< float >  slope,
VoxelVolume< float >  offset,
const VoxelVolume< float >::VoxelSize &  voxelSize 
)

Constructs a LinearDynamicVolume with linear relation for the attenuation coefficients in each voxel \(\mu(x,y,z)\) specified by slope and offset, corresponding to:

\( \mu(x,y,z) = t \cdot slope(x,y,z) + offset(x,y,z) \), where \(t\) denotes the time point set via setTime() in milliseconds.

The voxel size is set to voxelSize. Note that the number of voxels in slope and offset must be equal; throws an exception otherwise.

◆ LinearDynamicVolume() [2/2]

CTL::LinearDynamicVolume::LinearDynamicVolume ( VoxelVolume< float >  slope,
VoxelVolume< float >  offset 
)

Constructs a LinearDynamicVolume with linear relation for the attenuation coefficients in each voxel \(\mu(x,y,z)\) specified by slope and offset, corresponding to:

\( \mu(x,y,z) = t \cdot slope(x,y,z) + offset(x,y,z) \), where \(t\) denotes the time point set via setTime() in milliseconds.

The voxel size is taken from slope. Note that both the number of voxels and the voxel size in slope and offset must be equal; throws an exception otherwise.

Member Function Documentation

◆ ball()

LinearDynamicVolume CTL::LinearDynamicVolume::ball ( float  radius,
float  voxelSize,
float  slope,
float  offset 
)
static

Constructs a LinearDynamicVolume volume with voxels of isotropic dimensions voxelSize (in mm) All voxels inside a ball of radius radius (in mm) around the center of the volume will follow a linear relation for their attenuation values of:

\( \mu(x,y,z) = t \cdot slope + offset \), where \(t\) denotes the time point set via setTime() in milliseconds.

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.

◆ cube()

LinearDynamicVolume CTL::LinearDynamicVolume::cube ( uint  nbVoxel,
float  voxelSize,
float  slope,
float  offset 
)
static

Constructs a cubic LinearDynamicVolume volume with nbVoxel x nbVoxel x nbVoxel voxels (voxel dimension: voxelSize x voxelSize x voxelSize). All voxels will follow a linear relation for their attenuation values of:

\( \mu(x,y,z) = t \cdot slope + offset \), where \(t\) denotes the time point set via setTime() in milliseconds.

◆ cylinderX()

LinearDynamicVolume CTL::LinearDynamicVolume::cylinderX ( float  radius,
float  height,
float  voxelSize,
float  slope,
float  offset 
)
static

Constructs a LinearDynamicVolume volume with voxels of isotropic dimensions voxelSize (in mm) All voxels inside a cylinder of radius radius (in mm) and height height (in mm) aligned with the x-axis will follow a linear relation for their attenuation values of:

\( \mu(x,y,z) = t \cdot slope + offset \), where \(t\) denotes the time point set via setTime() in milliseconds.

The voxels surrounding the ball 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()

LinearDynamicVolume CTL::LinearDynamicVolume::cylinderY ( float  radius,
float  height,
float  voxelSize,
float  slope,
float  offset 
)
static

Constructs a LinearDynamicVolume volume with voxels of isotropic dimensions voxelSize (in mm) All voxels inside a cylinder of radius radius (in mm) and height height (in mm) aligned with the y-axis will follow a linear relation for their attenuation values of:

\( \mu(x,y,z) = t \cdot slope + offset \), where \(t\) denotes the time point set via setTime() in milliseconds.

The voxels surrounding the ball 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()

LinearDynamicVolume CTL::LinearDynamicVolume::cylinderZ ( float  radius,
float  height,
float  voxelSize,
float  slope,
float  offset 
)
static

Constructs a LinearDynamicVolume volume with voxels of isotropic dimensions voxelSize (in mm) All voxels inside a cylinder of radius radius (in mm) and height height (in mm) aligned with the z-axis will follow a linear relation for their attenuation values of:

\( \mu(x,y,z) = t \cdot slope + offset \), where \(t\) denotes the time point set via setTime() in milliseconds.

The voxels surrounding the ball 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.

◆ timeCurve() [1/4]

XYDataSeries CTL::LinearDynamicVolume::timeCurve ( uint  x,
uint  y,
uint  z,
const std::vector< float > &  timePoints 
)
overridevirtual

Returns the data series containing the data of voxel (x, y, z) at the time points specified in timePoints (to be specified in ms):

\( \mu(x,y,z;t) = t \cdot slope(x,y,z) + offset(x,y,z) \quad \forall t \in timePoints\)

Reimplemented from CTL::AbstractDynamicVolumeData.

◆ timeCurve() [2/4]

XYDataSeries CTL::AbstractDynamicVolumeData::timeCurve
inline

Convenience alternative of timeCurve(uint, uint, uint, const std::vector<float>&).

Returns the time series sampled at nbSamples equally-spaced positions within the interval [tStart, tEnd] (in ms).

◆ timeCurve() [3/4]

XYDataSeries CTL::AbstractDynamicVolumeData::timeCurve
inline

Returns the data series containing the data of voxel (x, y, z) at the time points specified in timePoints (to be specified in ms).

Note that this is a highly inefficient implementation that requires updating the entire volume for each requested time point using updateVolume(). Make sure to override this method in sub- classes to use more efficient ways of evaluating values of the requested voxel alone, if possible.

◆ timeCurve() [4/4]

XYDataSeries CTL::AbstractDynamicVolumeData::timeCurve
inline

Convenience alternative of timeCurve(uint, uint, uint, const std::vector<float>&).

Returns the time series sampled at nbSamples equally-spaced positions within the interval specified by timeRange.

Same as:

timeCurve(x, y, z, timeRange.linspace(nbSamples));

◆ updateVolume()

void CTL::LinearDynamicVolume::updateVolume ( )
overrideprotectedvirtual

Sets the voxels to the values given by the linear relation:

\( \mu(x,y,z) = t \cdot slope(x,y,z) + offset(x,y,z) \), where \(t\) denotes the time point set via setTime() in milliseconds.

Implements CTL::AbstractDynamicVolumeData.


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