CTL
0.6.1
Computed Tomography Library
|
The CompositeVolume class is a container to hold multiple volume datasets of any type from the CTL. More...
#include <compositevolume.h>
Public Types | |
using | SubVolPtr = CopyableUniquePtr< SpectralVolumeData > |
Public Member Functions | |
template<class Volume , class... Volumes> | |
CompositeVolume (Volume &&volume, Volumes &&... otherVolumes) | |
Constructs a CompositeVolume and adds all data passed to the constructor as sub-volumes. More... | |
CompositeVolume (const CompositeVolume &volume)=default | |
CompositeVolume (CompositeVolume &&volume)=default | |
CompositeVolume & | operator= (const CompositeVolume &volume)=default |
CompositeVolume & | operator= (CompositeVolume &&volume)=default |
const std::vector< SubVolPtr > & | data () const |
std::vector< SubVolPtr > & | data () |
bool | isEmpty () const |
std::unique_ptr< SpectralVolumeData > | muVolume (uint volIdx, float centerEnergy, float binWidth) const |
uint | nbSubVolumes () const |
const SpectralVolumeData & | subVolume (uint volIdx) const |
SpectralVolumeData & | subVolume (uint volIdx) |
void | addSubVolume (SpectralVolumeData volume) |
void | addSubVolume (std::unique_ptr< SpectralVolumeData > volume) |
void | addSubVolume (const AbstractDynamicVolumeData &volume) |
void | addSubVolume (CompositeVolume &&volume) |
void | addSubVolume (const CompositeVolume &volume) |
template<class Volume , class... Volumes> | |
void | addSubVolumes (Volume &&volume, Volumes &&... otherVolumes) |
Adds all data passed to this function as sub-volumes of the CompositeVolume. More... | |
Private Member Functions | |
void | addSubVolumes () const |
Static Private Member Functions | |
template<class Volume , class... Volumes> | |
static uint | getTotalNbSubVolumes (const Volume &volume, const Volumes &... otherVolumes) |
template<class Volume > | |
static constexpr uint | getTotalNbSubVolumes (const Volume &volume) |
static uint | getTotalNbSubVolumes (const CompositeVolume &volume) |
Private Attributes | |
std::vector< SubVolPtr > | _subVolumes |
the managed sub-volumes. | |
The CompositeVolume class is a container to hold multiple volume datasets of any type from the CTL.
This class can hold multiple volume datasets of SpectralVolumeData or its subclasses. More precisely, an instance of CompositeVolume can consume (copy or move)
When used with a projector, the CompositeVolume object must be passed to AbstractProjector::projectComposite(). This results in computation of projections considering all sub-volumes held by the CompositeVolume object (with all their individual properties, such as spectral information or temporal dynamics; given that appropriate projector extensions are in use).
Sub-volume are added to the container using addSubVolume(). Alternatively, the CompositeVolume can be created directly using a constructor and passing to it all sub-volumes that shall be added.
All sub-volumes may differ in any arbitrary property, for example:
The following code example shows one possibility to construct a volume consisting of a cube filled with extinction value 0.02/mm and two balls, a smaller one with 0.05/mm and a slightly larger one with 0.1/mm. We want the first ball to be positioned slightly in negative y-direction and the second one in the opposite direction.
We can now create a projection image from this composite with the following example code:
The same can be done with spectral volumes as well. It is also possible to mix both types as shown in the following example. Note, however, that these mixtures are currently (v. 0.3.1) only supported in the non-linear case of SpectralEffectsExtension (which is used for example with the StandardPipeline in No_Approximation preset).
|
explicit |
Constructs a CompositeVolume and adds all data passed to the constructor as sub-volumes.
Data passed to this constructor can be any number of volume objects of any of the following types:
Examples:
void CTL::CompositeVolume::addSubVolume | ( | SpectralVolumeData | volume | ) |
Adds volume as aub-volume to this instance.
Example:
void CTL::CompositeVolume::addSubVolume | ( | std::unique_ptr< SpectralVolumeData > | volume | ) |
Adds volume as aub-volume to this instance.
void CTL::CompositeVolume::addSubVolume | ( | const AbstractDynamicVolumeData & | volume | ) |
Adds volume as aub-volume to this instance. The volume will be cloned.
Example:
void CTL::CompositeVolume::addSubVolume | ( | CompositeVolume && | volume | ) |
Adds all sub-volumes of volume to this instance.
Example:
void CTL::CompositeVolume::addSubVolume | ( | const CompositeVolume & | volume | ) |
Adds all sub-volumes of volume to this instance. All sub-volumes will be cloned.
Example:
void CTL::CompositeVolume::addSubVolumes | ( | Volume && | volume, |
Volumes &&... | otherVolumes | ||
) |
Adds all data passed to this function as sub-volumes of the CompositeVolume.
Data passed to this method can be any number of volume objects of any of the following types:
const std::vector< CompositeVolume::SubVolPtr > & CTL::CompositeVolume::data | ( | ) | const |
Returns a constant reference to the data managed by this instance.
std::vector< CompositeVolume::SubVolPtr > & CTL::CompositeVolume::data | ( | ) |
Returns a (modifiably) reference to the data managed by this instance.
|
staticprivate |
Returns the total number of (sub-)volumes that is passed.
|
staticprivate |
Handles all non-composite volume types. Returns one, accordingly.
|
inlinestaticprivate |
Handels CompositeVolume input to getTotalNbSubVolumes(). Returns the number of (sub-)volumes in volume.
bool CTL::CompositeVolume::isEmpty | ( | ) | const |
Returns true if this instance has no sub-volumes.
std::unique_ptr< SpectralVolumeData > CTL::CompositeVolume::muVolume | ( | uint | volIdx, |
float | centerEnergy, | ||
float | binWidth | ||
) | const |
Convenience method; returns the sub-volume at position volIdx transformed to attenuation values corresponding to the energy bin specified by centerEnergy and binWidth. Same as: subVolume(volIdx).muVolume(centerEnergy, binWidth)
Does not perform out-of-range checks.
uint CTL::CompositeVolume::nbSubVolumes | ( | ) | const |
Returns the number of sub-volumes in this instance.
const SpectralVolumeData & CTL::CompositeVolume::subVolume | ( | uint | volIdx | ) | const |
Returns a constant reference to the sub-volume at position volIdx.
Does not perform out-of-range checks.
SpectralVolumeData & CTL::CompositeVolume::subVolume | ( | uint | volIdx | ) |
Returns a (modifiable) reference to the sub-volume at position volIdx.
Does not perform out-of-range checks.