CTL  0.6.1
Computed Tomography Library
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
CTL::AbstractBeamModifier Class Referenceabstract

Base class for components that modify the X-ray beam. More...

#include <abstractbeammodifier.h>

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

Public Types

enum  { Type = 400 }
 
- Public Types inherited from CTL::SystemComponent
enum  { Type = 0 }
 
- Public Types inherited from CTL::SerializationInterface
enum  { Type = -1, UserType = 65536 }
 

Public Member Functions

int type () const override
 
virtual IntervalDataSeries modifiedSpectrum (const IntervalDataSeries &inputSpectrum)=0
 
virtual double modifiedFlux (double inputFlux, const IntervalDataSeries &inputSpectrum)=0
 
QString info () const override
 
void fromVariant (const QVariant &variant) override
 
QVariant toVariant () const override
 
- Public Member Functions inherited from CTL::SystemComponent
int type () const override
 
 SystemComponent (const QString &name=defaultName())
 
virtual int elementalType () const
 
virtual SystemComponentclone () const
 
void fromVariant (const QVariant &variant) override
 
QVariant toVariant () const override
 
const QString & name () const
 
void rename (QString name)
 
- Public Member Functions inherited from CTL::SerializationInterface
virtual ~SerializationInterface ()=default
 

Protected Member Functions

 AbstractBeamModifier (const QString &name)
 
 AbstractBeamModifier (const AbstractBeamModifier &)=default
 
 AbstractBeamModifier (AbstractBeamModifier &&)=default
 
AbstractBeamModifieroperator= (const AbstractBeamModifier &)=default
 
AbstractBeamModifieroperator= (AbstractBeamModifier &&)=default
 
- Protected Member Functions inherited from CTL::SerializationInterface
 SerializationInterface ()=default
 
 SerializationInterface (const SerializationInterface &)=default
 
 SerializationInterface (SerializationInterface &&)=default
 
SerializationInterfaceoperator= (const SerializationInterface &)=default
 
SerializationInterfaceoperator= (SerializationInterface &&)=default
 

Friends

template<class >
struct SerializationHelper::RegisterWithSerializationHelper
 

Additional Inherited Members

- Static Public Member Functions inherited from CTL::SystemComponent
static QString defaultName ()
 
- Static Protected Member Functions inherited from CTL::SystemComponent
static QString typeInfoString (const std::type_info &type)
 

Detailed Description

Base class for components that modify the X-ray beam.

This is the base class for system components that modify the X-ray beam. Possible examples are radiation filters or collimator systems.

Sub-classes of AbstractBeamModifier can be created to define all kinds of individual modifiers. A sub-class needs to implement the two methods that describe the modification of the spectrum and flux: The modifiedSpectrum() method takes a (constant) reference to the incident radiation spectrum and must return the spectrum afted the radiation passed the beam modifier component. The modifiedFlux() method takes the input flux and a (constant) reference to the incident radiation spectrum and must return the remaining flux behind the beam modifier component.

When creating a sub-class of AbstractBeamModifier, 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 GenericComponent::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).

Constructor & Destructor Documentation

◆ AbstractBeamModifier()

CTL::AbstractBeamModifier::AbstractBeamModifier ( const QString &  name)
inlineprotected

Constructs an AbstractBeamModifier object named name.

Member Function Documentation

◆ fromVariant()

void CTL::AbstractBeamModifier::fromVariant ( const QVariant &  variant)
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:

DirectBaseClass::fromVariant(variant);
// assuming our class has a member "double _myMemberVariable"
_myMemberVariable = variant.toMap().value("my member variable").toDouble();

Reimplemented from CTL::SerializationInterface.

Reimplemented in CTL::AttenuationFilter, and CTL::GenericBeamModifier.

◆ info()

QString CTL::AbstractBeamModifier::info ( ) const
inlineoverridevirtual

Returns a formatted string that contains information about the component.

Reimplemented from CTL::SystemComponent.

Reimplemented in CTL::AttenuationFilter, and CTL::GenericBeamModifier.

◆ toVariant()

QVariant CTL::AbstractBeamModifier::toVariant ( ) const
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:

QVariantMap ret = DirectBaseClass::toVariant().toMap();
ret.insert("my member variable", _myMemberVariable);
return ret;

Reimplemented from CTL::SerializationInterface.

Reimplemented in CTL::AttenuationFilter, and CTL::GenericBeamModifier.

◆ type()

int CTL::AbstractBeamModifier::type ( ) const
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::GenericBeamModifier, and CTL::AttenuationFilter.


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