CTL
0.6.1
Computed Tomography Library
|
The FixedXraySpectrumModel class is a data model that uses a single well-defined lookup table to sample its values, independent of the energy parameter that has been set to it. More...
#include <xrayspectrummodels.h>
Public Types | |
enum | { Type = 36 } |
![]() | |
enum | { Type = 0 } |
![]() | |
enum | { Type = -1, UserType = 65536 } |
Public Member Functions | |
int | type () const override |
float | valueAt (float position) const override |
float | binIntegral (float position, float binWidth) const override |
Returns the integral over model values in the interval [position - 0.5 * binWidth, position + 0.5 * binWidth]. More... | |
FixedXraySpectrumModel * | clone () const override |
FixedXraySpectrumModel (const TabulatedDataModel &table) | |
QVariant | parameter () const override |
void | setParameter (const QVariant ¶meter) override |
Sets the energy parameter to parameter. More... | |
TabulatedDataModel & | lookupTable () |
Returns the integral over model values in the interval [position - 0.5 * binWidth, position + 0.5 * binWidth]. More... | |
const TabulatedDataModel & | lookupTable () const |
Returns this instance's lookup table. | |
void | setLookupTable (const TabulatedDataModel &table) |
Sets the lookup table to table. 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 | |
TabulatedDataModel | _lookupTable |
The spectrum lookup table. | |
![]() | |
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 FixedXraySpectrumModel class is a data model that uses a single well-defined lookup table to sample its values, independent of the energy parameter that has been set to it.
The main use case of this model is introducing a fixed spectrum to the simulation, such as some spectrum pre-generated by an external tool, actual measurement data, or simply to make sure to exactly reproduce some spectrum from another source component without the need to consider its specific parameters.
The lookup table data can be set during construction, using setLookupTable(), or by direct manipulation through lookupTable().
Example 1: populate a TabulatedDataModel with data and use it as lookup table for a FixedXraySpectrumModel
Example 2: sample a spectrum from an XrayTube instance and use these values as a lookup table for a FixedXraySpectrumModel
|
overridevirtual |
Returns the integral over model values in the interval [position - 0.5 * binWidth, position + 0.5 * binWidth].
If the model output to input parameter \( x \) is given by \( f(x) \), this method computes and returns:
\( \begin{align*} \int_{position-\frac{binWidth}{2}}^{position+\frac{binWidth}{2}} f(x) \,dx \end{align*} \)
Implements CTL::AbstractIntegrableDataModel.
|
overridevirtual |
Creates a copy of this instance and returns a base class pointer to the new object.
Implements CTL::AbstractXraySpectrumModel.
Reimplemented in CTL::TASMIPSpectrumModel.
TabulatedDataModel & CTL::FixedXraySpectrumModel::lookupTable | ( | ) |
Returns the integral over model values in the interval [position - 0.5 * binWidth, position + 0.5 * binWidth].
Returns 1.0 only if the bin contains the current energy parameter of this instance. All other bin integrals are always zero. Let \( E \) be the energy parameter of this instance; then binIntegral() returns:
\( \begin{cases} 1.0 & position - 1/2\cdot binWidth \leq E \leq position + 1/2\cdot binWidth \\ 0.0 & else \end{cases} \)
Example:
|
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::FixedXraySpectrumModel::setLookupTable | ( | const TabulatedDataModel & | table | ) |
Sets the lookup table to table.
This replaces the previous lookup table.
|
overridevirtual |
Sets the energy parameter to parameter.
parameter can be either a single float
(i.e. the energy in keV) or a QVariantMap that contains the key-value-pair ("energy", [float
] value_to_set).
Note that, when used within an actual source component (AbstractSource::setSpectrumModel()), you do not need to deal with setting this parameter. This should be done automatically by the specific source component class.
Reimplemented from CTL::AbstractXraySpectrumModel.
Reimplemented in CTL::TASMIPSpectrumModel.
|
inlineoverridevirtual |
Returns the type id of this instance.
Reimplemented from CTL::AbstractDataModel.
Reimplemented in CTL::TASMIPSpectrumModel.
|
overridevirtual |
Returns the value sampled from the model at the given position.
Implements CTL::AbstractDataModel.