CTL
0.6.1
Computed Tomography Library
|
The XraySpectrumTabulatedModel class provides an implementation of an X-ray spectrum model based on tabulated data. More...
#include <xrayspectrummodels.h>
Public Types | |
enum | { Type = 35 } |
![]() | |
enum | { Type = 0 } |
![]() | |
enum | { Type = -1, UserType = 65536 } |
Public Member Functions | |
int | type () const override |
float | valueAt (float position) const override |
Returns the value (i.e. photon count per energy) of the model at the given position (in keV). More... | |
float | binIntegral (float position, float binWidth) const override |
Returns the integral over model values (i.e. total number of photons) in the (energy) interval [position - 0.5 * binWidth, position + 0.5 * binWidth]. More... | |
XraySpectrumTabulatedModel * | clone () const override |
XraySpectrumTabulatedModel () | |
Creates an empty XraySpectrumTabulatedModel. More... | |
void | addLookupTable (float voltage, const TabulatedDataModel &table) |
Inserts table as a lookup table for the energy setting voltage. More... | |
void | setLookupTables (const QMap< float, TabulatedDataModel > &tables) |
Sets the lookup tables used by this instance to tables. More... | |
QVariant | parameter () const override |
void | setParameter (const QVariant ¶meter) override |
Sets the parameters of this instance based in data in parameter. More... | |
bool | hasTabulatedDataFor (float voltage) const |
Returns true if this instance can provide data for an energy parameter set to voltage. More... | |
![]() | |
float | meanValue (float position, float binWidth) const |
![]() | |
void | fromVariant (const QVariant &variant) override |
QVariant | toVariant () const override |
bool | isIntegrable () const |
void | setName (const QString &name) |
const QString & | name () const |
![]() | |
virtual | ~SerializationInterface ()=default |
Protected Attributes | |
QMap< float, TabulatedDataModel > | _lookupTables |
The spectra lookup tables (key = energy). | |
![]() | |
float | _energy = 0.0f |
Control parameter of device setting (usually tube voltage). | |
Friends | |
template<class > | |
struct | SerializationHelper::RegisterWithSerializationHelper |
Additional Inherited Members | |
![]() | |
AbstractIntegrableDataModel (const AbstractIntegrableDataModel &)=default | |
AbstractIntegrableDataModel (AbstractIntegrableDataModel &&)=default | |
AbstractIntegrableDataModel & | operator= (const AbstractIntegrableDataModel &)=default |
AbstractIntegrableDataModel & | operator= (AbstractIntegrableDataModel &&)=default |
![]() | |
AbstractDataModel (const AbstractDataModel &)=default | |
AbstractDataModel (AbstractDataModel &&)=default | |
AbstractDataModel & | operator= (const AbstractDataModel &)=default |
AbstractDataModel & | operator= (AbstractDataModel &&)=default |
![]() | |
SerializationInterface ()=default | |
SerializationInterface (const SerializationInterface &)=default | |
SerializationInterface (SerializationInterface &&)=default | |
SerializationInterface & | operator= (const SerializationInterface &)=default |
SerializationInterface & | operator= (SerializationInterface &&)=default |
![]() | |
DataModelPtr | |
Template alias name for CopyableUniquePtr<ModelType> to a suitable ModelType. | |
AbstractDataModelPtr | |
Alias name for DataModelPtr<AbstractDataModel>. More... | |
std::unique_ptr< ModelType > | makeDataModel (ConstructorArguments &&... arguments) |
using DataModelPtr | CopyableUniquePtr |
Alias name for CopyableUniquePtr<ModelType> to a suitable ModelType. | |
The XraySpectrumTabulatedModel class provides an implementation of an X-ray spectrum model based on tabulated data.
This class implements AbstractXraySpectrumModel with a backend of several TabulatedDataModel lookup tables. Each of these tables corresponds to a particular energy of operation (e.g. tube voltage). Lookup tables can be added through addLookupTable(). If an energy parameter is set for which no exact match exists in the lookup tables, interpolation between the tables closest to the requested energy parameter is performed.
Note that for introducing a fixed spectrum to the simulation (e.g. some spectrum pre-generated by an external tool), the class FixedXraySpectrumModel might be a more suitable choice.
Example: creating an XraySpectrumTabulatedModel with two lookup tables for spectra at 40 kV and 70 kV, and setting it to provide (interpolated) data for a 55 kV setting.
CTL::XraySpectrumTabulatedModel::XraySpectrumTabulatedModel | ( | ) |
Creates an empty XraySpectrumTabulatedModel.
Use addLookupTable() or setLookupTables() to provide it with actual data.
void CTL::XraySpectrumTabulatedModel::addLookupTable | ( | float | voltage, |
const TabulatedDataModel & | table | ||
) |
Inserts table as a lookup table for the energy setting voltage.
Overrides any already existing table for that particular energy (i.e. voltage).
|
overridevirtual |
Returns the integral over model values (i.e. total number of photons) in the (energy) interval [position - 0.5 * binWidth, position + 0.5 * binWidth].
The bin integral is computed using sampled values from the available lookup tables of this instance. If a lookup table is available for the exact energy currently set as parameter of this instance, this call reduces to a call of binIntegral() of that particular table (see also TabulatedDataModel::binIntegral()). In case an energy parameter is set for which no exact match exists in the lookup tables, (linear) interpolation between the tables closest to the requested energy parameter is performed by computing the bin integrals from the corresponding tables and computing the weighted sum.
Requires that either a lookup table for the exact energy (i.e. the current energy parameter of this instance) is available or at least one lookup table for an energy lower as well as higher than the current energy parameter must be present (see also hasTabulatedDataFor()).
Implements CTL::AbstractIntegrableDataModel.
|
overridevirtual |
Creates a copy of this instance and returns a base class pointer to the new object.
Implements CTL::AbstractXraySpectrumModel.
bool CTL::XraySpectrumTabulatedModel::hasTabulatedDataFor | ( | float | voltage | ) | const |
Returns true if this instance can provide data for an energy parameter set to voltage.
Data for a particular energy setting can be provided if there exists at least one lookup table for an energy lower and higher than voltage. The only exception is if a table with the exact energy (i.e. energy == voltage) is available, in which case this is sufficient to return true.
Returns true if these conditions are met; returns false otherwise (includes models without any lookup tables).
|
overridevirtual |
Returns the parameters of this instance as a QVariant.
Re-implement this method within your sub-class such that it encapsulates all necessary information into a QVariant.
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::AbstractXraySpectrumModel.
void CTL::XraySpectrumTabulatedModel::setLookupTables | ( | const QMap< float, TabulatedDataModel > & | tables | ) |
Sets the lookup tables used by this instance to tables.
Each lookup table (one entry in the QMap) consist of a key-value-pair in which the key refers to the energy the table belongs to (e.g. tube voltage setting) and the value is the actual table (TabulatedDataModel) holding the spectrum data.
Overrides any already existing data.
|
overridevirtual |
Sets the parameters of this instance based in data in parameter.
The passed QVariant paramter must be a QVariantMap containing the key-value-pair ("energy", [float
] value_to_set) (see also AbstractXraySpectrumModel::setParameter()) and might also contain a key-value-pair with key "lookup tables" and a QVariantList holding the variants for all lookup tables that shall be set. Note that this overrides any already existing lookup tables.
In general, it is not advised to use this method to set lookup table data. Consider using addLookupTable() or setLookupTables() instead.
Reimplemented from CTL::AbstractXraySpectrumModel.
|
inlineoverridevirtual |
Returns the type id of this instance.
Reimplemented from CTL::AbstractDataModel.
|
overridevirtual |
Returns the value (i.e. photon count per energy) of the model at the given position (in keV).
The value is computed using sampled values from the available lookup tables of this instance. If a lookup table is available for the exact energy currently set as parameter of this instance, this call reduces to a call of valueAt() of that particular table (see also TabulatedDataModel::valueAt()). In case an energy parameter is set for which no exact match exists in the lookup tables, (linear) interpolation between the tables closest to the requested energy parameter is performed by sampling values from the corresponding tables and computing the weighted sum.
Requires that either a lookup table for the exact energy (i.e. the current energy parameter of this instance) is available or at least one lookup table for an energy lower as well as higher than the current energy parameter must be present (see also hasTabulatedDataFor()).
Implements CTL::AbstractDataModel.