CTL
0.6.1
Computed Tomography Library
|
Base class for source components. More...
#include <abstractsource.h>
Public Types | |
enum | { Type = 300 } |
![]() | |
enum | { Type = 0 } |
![]() | |
enum | { Type = -1, UserType = 65536 } |
Public Member Functions | |
int | type () const override |
virtual EnergyRange | nominalEnergyRange () const =0 |
virtual IntervalDataSeries | spectrum (uint nbSamples) const |
Returns the (relative) emitted radiation spectrum sampled with nbSamples bins covering the energy range of [energyRange().start(), energyRange().end()] keV. More... | |
virtual uint | spectrumDiscretizationHint () const |
virtual void | setSpectrumModel (AbstractXraySpectrumModel *model) |
QString | info () const override |
void | fromVariant (const QVariant &variant) override |
QVariant | toVariant () const override |
EnergyRange | energyRange () const |
float | meanEnergy () const |
double | photonFlux () const |
double | fluxModifier () const |
const QSizeF & | focalSpotSize () const |
const Vector3x1 & | focalSpotPosition () const |
const AbstractXraySpectrumModel * | spectrumModel () const |
void | setFluxModifier (double modifier) |
void | setFocalSpotSize (const QSizeF &size) |
void | setFocalSpotSize (double width, double height) |
void | setFocalSpotPosition (const Vector3x1 &position) |
void | setFocalSpotPosition (double x, double y, double z) |
void | setEnergyRangeRestriction (const EnergyRange &window) |
IntervalDataSeries | spectrum (EnergyRange range, uint nbSamples) const |
bool | hasSpectrumModel () const |
void | setSpectrumModel (std::unique_ptr< AbstractXraySpectrumModel > model) |
std::unique_ptr< GenericSource > | toGeneric () const |
![]() | |
int | type () const override |
SystemComponent (const QString &name=defaultName()) | |
virtual int | elementalType () const |
virtual SystemComponent * | clone () const |
void | fromVariant (const QVariant &variant) override |
QVariant | toVariant () const override |
const QString & | name () const |
void | rename (QString name) |
![]() | |
virtual | ~SerializationInterface ()=default |
Static Public Attributes | |
static const uint | DEFAULT_SPECTRUM_RESOLUTION_HINT = 10 |
Protected Member Functions | |
virtual double | nominalPhotonFlux () const =0 |
AbstractSource (const QString &name) | |
AbstractSource (const QSizeF &focalSpotSize, const QString &name) | |
AbstractSource (const QSizeF &focalSpotSize, const Vector3x1 &focalSpotPosition, const QString &name) | |
AbstractSource (const QSizeF &focalSpotSize, const Vector3x1 &focalSpotPosition, AbstractXraySpectrumModel *spectumModel, const QString &name) | |
AbstractSource (const AbstractSource &)=default | |
AbstractSource (AbstractSource &&)=default | |
AbstractSource & | operator= (const AbstractSource &)=default |
AbstractSource & | operator= (AbstractSource &&)=default |
![]() | |
SerializationInterface ()=default | |
SerializationInterface (const SerializationInterface &)=default | |
SerializationInterface (SerializationInterface &&)=default | |
SerializationInterface & | operator= (const SerializationInterface &)=default |
SerializationInterface & | operator= (SerializationInterface &&)=default |
Protected Attributes | |
QSizeF | _focalSpotSize = QSizeF(0.0, 0.0) |
Size of the focal spot (in mm). | |
Vector3x1 | _focalSpotPosition = Vector3x1(0.0) |
Position of the focal spot (relative to source center). | |
double | _fluxModifier = 1.0 |
Global (multiplicative) modifier for the photon flux. | |
DataModelPtr< AbstractXraySpectrumModel > | _spectrumModel |
Data model for the emitted radiation spectrum. | |
EnergyRange | _restrictedEnergyWindow = { 0.0f, 0.0f } |
Windowed energy range. | |
bool | _hasRestrictedEnergyWindow = false |
Friends | |
template<class > | |
struct | SerializationHelper::RegisterWithSerializationHelper |
Related Functions | |
(Note that these are not member functions.) | |
EnergyRange | |
Alias name for CTL::Range<float>. More... | |
![]() | |
std::unique_ptr< ComponentType > | makeComponent (ConstructorArguments &&... arguments) |
std::unique_ptr< SystemComponent > | makeComponentFromJson (const QJsonObject &object, bool fallbackToGenericType) |
Additional Inherited Members | |
![]() | |
static QString | defaultName () |
![]() | |
static QString | typeInfoString (const std::type_info &type) |
Base class for source components.
This is the base class for all source components. A source component is characterized by the size and position (optional) of its focal spot (i.e. the area from which radiation is emitted), the emitted X-ray spectrum (relative intensity contribution for each photon energy) and the overall photon flux that is emitted by the source.
The AbstractSource class has two abstract interface methods: energyRange() and nominalPhotonFlux(). The energyRange() method must provide the energy boundaries within which all radiation from the source is contained. This range will be used whenenver the source's radiation spectrum is queried using spectrum() in order to determine the required interval for a sampled representation of the spectrum. The nominalPhotonFlux() method shall return the (unmodified) flux of photons emitted by the source. This is used whithin the actual getter method photonFlux(), which returns the nominal flux multiplied by an (optional, defaults to 1.0) modifier (see fluxModifier() and setFluxModifier()).
Spectrum computation is based on an AbstractXraySpectrumModel, which can be set using the corresponding setter method setSpectrumModel(). To query the current spectrum, use the spectrum() method, passing the number of desired sampling points as an input.
Definition of the focal spot geometry, i.e. both size and position, refers to CT coordinates. The focal spot size is specified in the x-y-plane. Hence, a focal spot with size QSizeF(1.0, 2.0) would, for example, have an extension of 1mm in x-direction and 2mm in y-direction. The position of the focal spot can be defined in all three directions (in the CT coordinate system). This can be used to describe shifted focal spot positions. The zero position (i.e. Vector3x1(0.0, 0.0, 0.0)) corresponds to an unshifted focal spot. Example: A source with focal spot position Vector3x1(0.0, 10.0, -50.0), would have its focal spot shifted by 10mm in y-direction and 50mm in negative z-direction (the latter would, for example, mean that the point of radiation emission is 50mm further away from the detector compared to an unshifed focal spot).
When creating a sub-class of AbstractSource, make sure to register the new component in the enumeration using the CTL_TYPE_ID(newIndex) macro. It is required to specify a value for newIndex that is not already in use. This can be easily achieved by use of values starting from SerializationInterface::UserType, as these are reserved for user-defined types.
To enable de-/serialization of objects of the new sub-class, reimplement the toVariant() and fromVariant() methods. These should take care of all newly introduced information of the sub-class. Additionally, call the macro DECLARE_SERIALIZABLE_TYPE(YourNewClassName) within the .cpp file of your new class (substitute "YourNewClassName" with the actual class name). Objects of the new class can then be de-/serialized with any of the serializer classes (see also AbstractSerializer).
|
inlineprotected |
Constructs an AbstractSource object named name.
Focal spot size defaults to QSizeF(0.0, 0.0) and the focal spot position is initialized with Vector3x1(0.0).
|
inlineprotected |
Constructs an AbstractSource object named name with a focal spot size of focalSpotSize.
The focal spot position is initialized with Vector3x1(0.0).
|
inlineprotected |
Constructs an AbstractSource object named name with a focal spot size of focalSpotSize and its focal spot position at focalSpotPosition.
|
inlineprotected |
Constructs an AbstractSource object named name with a focal spot size of focalSpotSize and its focal spot position at focalSpotPosition. This constructor also sets the spectrum model to spectrumModel. This instance manages ownership of spectrumModel as a std::shared_ptr.
|
inline |
Abstract interface method. Returns the energy range that contains all radiation from the source.
|
inline |
Returns the flux modifier.
The flux modifier is a multiplicative factor that modifies the total photon flux returned by photonFlux().
|
inline |
Returns the focal spot position of this instance.
Definition of the focal spot position is in CT coordinates.
|
inline |
Returns the focal spot size of this instance.
Definition of the focal spot size is in CT coordinates. In particular, it is specified as the dimension in the x-y-plane.
|
inlineoverridevirtual |
Interface to read all member variables from the QVariant variant.
Reimplement this method such that it reads all newly introduced content when sub-classing. A typical reimplementation in sub-classes might look like this:
Reimplemented from CTL::SerializationInterface.
Reimplemented in CTL::XrayLaser, CTL::GenericSource, and CTL::XrayTube.
|
inline |
Returns true if a spectrum model is available in this instance.
|
inlineoverridevirtual |
Returns a formatted string with information about the object.
In addition to the information from the base class, the info string contains the following details:
Reimplemented from CTL::SystemComponent.
Reimplemented in CTL::GenericSource, CTL::XrayLaser, and CTL::XrayTube.
|
inline |
Returns the mean energy (in keV) of the spectrum emitted by this instance. Spectrum sampling is performed using the number of samples returned by spectrumDiscretizationHint(). Note that, in general, this is only an approximative mean.
|
protectedpure virtual |
Abstract interface method. Returns the nominal photon flux (i.e. photons per cm²) of the source in a distance of one meter.
To query the actual photon flux of the source component, use photonFlux().
Implemented in CTL::XrayLaser, CTL::GenericSource, and CTL::XrayTube.
|
inline |
Returns the photon flux (i.e. photons per cm²) emitted by the source in a distance of one meter.
This method returns the nominal photon flux (as returned by nominalPhotonFlux()) multiplied with the flux modifier.
So far, the emitted flux cannot be direction-dependent (planned for future releases). However, direction-dependency can be introduced using a beam modifier (see AbstractBeamModifier).
|
inline |
Sets the flux modifier to modifier.
The flux modifier is a multiplicative factor considered when querying the photon flux of the source component. This value can be used to describe global variation of the emitted photon flux. However, local solutions in sub-classes of AbstractSource are recommended when trying to model intensity variation. Best practice is to realize this within the (re-)implementation of nominalPhotonFlux() by utilization of dedicated class members (e.g. tube emission current).
|
inline |
Sets the focal spot position to position.
Definition of the focal spot position is in CT coordinates.
|
inline |
Sets the focal spot position to the point (x, y, z).
Convenience alternative. Same as setFocalSpotPosition(Vector3x1({ x, y, z })).
|
inline |
Sets the focal spot size size.
Definition of the focal spot size is in CT coordinates. In particular, it is specified as the dimension in the x-y-plane.
|
inline |
Sets the focal spot size to a rectangle with dimensions width x height.
Convenience alternative. Same as setFocalSpotSize(QSizeF(width, height)).
|
inlinevirtual |
Sets the spectrum model to model.
This instance manages ownership of model as a std::shared_ptr.
|
inline |
Sets the spectrum model to model.
|
inlinevirtual |
Returns the (relative) emitted radiation spectrum sampled with nbSamples bins covering the energy range of [energyRange().start(), energyRange().end()] keV.
The method spectrumDiscretizationHint() can provide a hint for a reasonable number of samples.
Each energy bin in the returned data series is defined to represent the integral over the contribution to the total number of emitted photons of all energies within that particular bin. The individual contributions are extracted from the AbstractXraySpectrumModel set to the component.
The returned spectrum contains relative photon flux, i.e. the sum over all bins equals to one. To get quantitative energy-dependent photon flux values, multiply this (relative) spectrum with the photon flux constant (see photonFlux()).
Throws std::runtime_error if no spectrum model is available.
Example: this example is based on the derived class 'XrayTube'
Reimplemented in CTL::XrayLaser.
|
inlinevirtual |
Returns a hint for a reasonable number of sampling points when querying a spectrum of the component. By default, this method returns 10. Re-implement this method in sub-classes to return meaningful hints for your particular source component type.
Reimplemented in CTL::XrayLaser, CTL::GenericSource, and CTL::XrayTube.
|
inline |
Returns a pointer to the spectrum model of this instance.
|
inlineoverridevirtual |
Interface to store all member variables in a QVariant.
Stores the object's type-id.
Reimplement this method such that it stores all newly introduced object data when sub-classing. This needs to cover everything that is necessary to fully determine the state of an object. Best practice is to invoke the base class version of this method to take care of all content originating from underlying base classes.
A typical reimplementation in sub-classes might look like this:
Reimplemented from CTL::SerializationInterface.
Reimplemented in CTL::XrayLaser, CTL::GenericSource, and CTL::XrayTube.
|
inlineoverridevirtual |
Returns the type-id of the serializable object. Used in deserialization to determine the proper object type.
Add derived classes to the enumeration using the CTL_TYPE_ID macro.
Reimplemented from CTL::SerializationInterface.
Reimplemented in CTL::XrayLaser, CTL::GenericSource, and CTL::XrayTube.
|
related |
Alias name for CTL::Range<float>.
Holds the borders (i.e. minimum to maximum) of the energy range.