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

Base class for gantry components. More...

#include <abstractgantry.h>

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

Public Types

enum  { Type = 200 }
 
- 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
 
QString info () const override
 
void fromVariant (const QVariant &variant) override
 
QVariant toVariant () const override
 
mat::Location sourceLocation () const
 
mat::Location detectorLocation () const
 
const mat::LocationdetectorDisplacement () const
 
const mat::LocationgantryDisplacement () const
 
const mat::LocationsourceDisplacement () const
 
void setDetectorDisplacement (const mat::Location &displacement)
 
void setGantryDisplacement (const mat::Location &displacement)
 
void setSourceDisplacement (const mat::Location &displacement)
 
Vector3x1 sourcePosition () const
 
Matrix3x3 sourceRotation () const
 
Vector3x1 detectorPosition () const
 
Matrix3x3 detectorRotation () const
 
void setDetectorDisplacementAngles (double rollAngle, double tiltAngle, double twistAngle)
 
void setDetectorDisplacementPosition (const Vector3x1 &position)
 
void setDetectorDisplacementPosition (double x, double y, double z)
 
void setGantryDisplacementPosition (const Vector3x1 &position)
 
void setGantryDisplacementPosition (double x, double y, double z)
 
void setSourceDisplacementPosition (const Vector3x1 &position)
 
void setSourceDisplacementPosition (double x, double y, double z)
 
std::unique_ptr< GenericGantrytoGeneric () const
 
- 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

virtual mat::Location nominalDetectorLocation () const =0
 
virtual mat::Location nominalSourceLocation () const =0
 
 AbstractGantry (const QString &name)
 
 AbstractGantry (const AbstractGantry &)=default
 
 AbstractGantry (AbstractGantry &&)=default
 
AbstractGantryoperator= (const AbstractGantry &)=default
 
AbstractGantryoperator= (AbstractGantry &&)=default
 
- Protected Member Functions inherited from CTL::SerializationInterface
 SerializationInterface ()=default
 
 SerializationInterface (const SerializationInterface &)=default
 
 SerializationInterface (SerializationInterface &&)=default
 
SerializationInterfaceoperator= (const SerializationInterface &)=default
 
SerializationInterfaceoperator= (SerializationInterface &&)=default
 

Private Attributes

mat::Location _globalGantryDisplacement
 Displacement of the whole gantry.
 
mat::Location _detectorDisplacement
 Displacement of the detector component.
 
mat::Location _sourceDisplacement
 Displacement of the source component.
 

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 gantry components.

This class manages the positioning of a source and a detector component. This refers to the components' positions in world coordinate system (WCS) and the transformation matrices that describe the transformation between the component's intrinsic system (see below for details) and the WCS.

The location (i.e. position and rotation) of the components is interpreted as follows:

Source: the position refers to the point in space (in WCS) where the radiation is originating from (e.g. the focal spot of an X-ray tube). The rotation matrix describes the transformation from the source coordinate system to the WCS. Here, the source coordinate system means an unaltered CT coordinate system (right-handed), where the source is located at the origin (0,0,0), the detector is in the x-y-plane and the z-axis points towards the detector.

Detector: the position refers to the mechanical center of the detector system in world coordinates. For example: In case of a flat panel detector in an unaltered CT system, this would be the position of the principal point expressed in world coordinates. The rotation matrix describes the transformation from WCS to CT coordinates of the entire detector system.

The AbstractGantry class provides the option to specify so-called displacements for the source and detector (both individually). This displacement is considered to represent deviations from the actual positioning of the components. It can be used e.g. to simulate errors in the mounting of the compontents and/or influences from various other sources of disturbance (e.g. inaccuracies in position reproducability, deformations due to mechanical stress, movement etc.) The displacement consists of a position term (to describe translational dislocation) and a rotation matrix (to explain orientation deviation). The effect of displacement is automatically considered when querying the location of source or detector via sourceLocation() and detectorLocation() (or their convenience alternatives, respectively).

Sub-classes of AbstractGantry can be created to use customized parametrizations for the location of source and detector. To do so, override the methods nominalDetectorLocation() and nominalSourceLocation() in the new class, such that these methods extract the location of both components (i.e. source and detector) based on your chosen parametrization.

When creating a sub-class of AbstractGantry, 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

◆ AbstractGantry()

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

Constructs an AbstractGantry object named name.

Member Function Documentation

◆ detectorDisplacement()

const mat::Location & CTL::AbstractGantry::detectorDisplacement ( ) const
inline

Returns the specified displacement of the detector.

\( L_{\textrm{det}}^{\textrm{displ}}= (t_{\textrm{det}}^{\textrm{displ}},R_{\textrm{det}}^{\textrm{displ}}) \)

◆ detectorLocation()

mat::Location CTL::AbstractGantry::detectorLocation ( ) const
inline

Returns the final detector location. This considers (optional) effects of a detector displacement.

The location contains the position in world coordinates as well as the rotation matrix that holds the transformation from world coordinates to the CT coordinate system of the detector as a whole.

\( L_{\textrm{det}}^{\textrm{total}}= (t_{\textrm{det}}^{\textrm{total}},R_{\textrm{det}}^{\textrm{total}}) \)

See also
detectorPosition(), detectorRotation().

◆ detectorPosition()

Vector3x1 CTL::AbstractGantry::detectorPosition ( ) const
inline

Convenience method. Returns the final position of the detector center in world coordinates.

\( \begin{align*} t_{\textrm{det}}^{\textrm{total}} & =R_{\textrm{gantry}}^{\textrm{displ}}\cdot \left(t_{\textrm{det}}^{\textrm{nominal}}+\left(R_{\textrm{det}}^{\textrm{displ}}\right)^{T} \cdot R_{\textrm{det}}^{\textrm{nominal}}\cdot t_{\textrm{det}}^{\textrm{displ}}\right) +t_{\textrm{gantry}}^{\textrm{displ}}\\& =R_{\textrm{gantry}}^{\textrm{displ}} \cdot t_{\textrm{det}}^{\textrm{nominal}}+\left(R_{\textrm{det}}^{\textrm{total}}\right)^{T} \cdot t_{\textrm{det}}^{\textrm{displ}}+t_{\textrm{gantry}}^{\textrm{displ}} \end{align*} \)

Same as: detectorLocation().position.

◆ detectorRotation()

Matrix3x3 CTL::AbstractGantry::detectorRotation ( ) const
inline

Convenience method. Returns the total transformation matrix from world coordinates to the CT coordinate system of the detector as a whole.

\( R_{\textrm{WCS-CTS}}:=R_{\textrm{det}}^{\textrm{total}}=\left(R_{\textrm{det}}^{\textrm{displ}} \right)^{T}\cdot R_{\textrm{det}}^{\textrm{nominal}}\cdot\left(R_{\textrm{gantry}}^{\textrm{displ}} \right)^{T} \)

Same as: detectorLocation().rotation.

◆ fromVariant()

void CTL::AbstractGantry::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::TubularGantry, CTL::GenericGantry, and CTL::CarmGantry.

◆ gantryDisplacement()

const mat::Location & CTL::AbstractGantry::gantryDisplacement ( ) const
inline

Returns the specified displacement of the whole gantry.

\( L_{\textrm{gantry}}^{\textrm{displ}}= (t_{\textrm{gantry}}^{\textrm{displ}},R_{\textrm{gantry}}^{\textrm{displ}}) \)

◆ info()

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

Returns a formatted string with information about the object.

In addition to the information from the base class (GenericComponent), the info string contains the following details:

  • Source Displacement
  • Detector Displacement.

Reimplemented from CTL::SystemComponent.

Reimplemented in CTL::TubularGantry, CTL::GenericGantry, and CTL::CarmGantry.

◆ nominalDetectorLocation()

mat::Location CTL::AbstractGantry::nominalDetectorLocation ( ) const
protectedpure virtual

Returns the nominal location of the detector. Nominal means the positioning without consideration of the displacement. This is the expected (or ideal) location as it would occur in a perfect system.

Implement this method in derived classes such that it extracts the location of the detector component based on the parametrization used in that particular sub-class.

Implemented in CTL::TubularGantry, CTL::GenericGantry, and CTL::CarmGantry.

◆ nominalSourceLocation()

mat::Location CTL::AbstractGantry::nominalSourceLocation ( ) const
protectedpure virtual

Returns the nominal location of the source. Nominal means the positioning without consideration of the displacement. This is the expected (or ideal) location as it would occur in a perfect system.

Implement this method in derived classes such that it extracts the location of the source component based on the parametrization used in that particular sub-class.

Implemented in CTL::TubularGantry, CTL::GenericGantry, and CTL::CarmGantry.

◆ setDetectorDisplacement()

void CTL::AbstractGantry::setDetectorDisplacement ( const mat::Location displacement)
inline

Sets the displacement of the detector to displacement.

The detector displacement is defined in the CT coordinate system.

◆ setDetectorDisplacementAngles()

void CTL::AbstractGantry::setDetectorDisplacementAngles ( double  rollAngle,
double  tiltAngle,
double  twistAngle 
)
inline

Convenience setter. Sets the rotation component of the detector displacement regarding three rotations specified by rollAngle,tiltAngle and twistAngle. In CT coordinates, these rotations refer to:

  • Roll: rotation around the y-axis
  • Tilt: rotation around the x-axis
  • Twist: rotation around the z-axis
See also
setDetectorDisplacement()

◆ setDetectorDisplacementPosition() [1/2]

void CTL::AbstractGantry::setDetectorDisplacementPosition ( const Vector3x1 position)
inline

Convenience setter. Sets the position component of the detector displacement to position.

See also
setDetectorDisplacement()

◆ setDetectorDisplacementPosition() [2/2]

void CTL::AbstractGantry::setDetectorDisplacementPosition ( double  x,
double  y,
double  z 
)
inline

Convenience setter. Sets the position component of the detector displacement to (x, y, z).

See also
setDetectorDisplacement()

◆ setGantryDisplacement()

void CTL::AbstractGantry::setGantryDisplacement ( const mat::Location displacement)
inline

Sets the displacement of the whole gantry to displacement.

The gantry displacement is defined in the world coordinate system.

◆ setGantryDisplacementPosition() [1/2]

void CTL::AbstractGantry::setGantryDisplacementPosition ( const Vector3x1 position)
inline

Convenience setter. Sets the position component of the whole gantry displacement to position.

See also
setGantryDisplacement()

◆ setGantryDisplacementPosition() [2/2]

void CTL::AbstractGantry::setGantryDisplacementPosition ( double  x,
double  y,
double  z 
)
inline

Convenience setter. Sets the position component of the whole gantry displacement to (x, y, z).

See also
setGantryDisplacement()

◆ setSourceDisplacement()

void CTL::AbstractGantry::setSourceDisplacement ( const mat::Location displacement)
inline

Sets the displacement of the source to displacement.

The source displacement is defined in the world coordinate system.

◆ setSourceDisplacementPosition() [1/2]

void CTL::AbstractGantry::setSourceDisplacementPosition ( const Vector3x1 position)
inline

Convenience setter. Sets the position component of the source displacement to position.

See also
setSourceDisplacement()

◆ setSourceDisplacementPosition() [2/2]

void CTL::AbstractGantry::setSourceDisplacementPosition ( double  x,
double  y,
double  z 
)
inline

Convenience setter. Sets the position component of the source displacement to (x, y, z).

See also
setSourceDisplacement()

◆ sourceDisplacement()

const mat::Location & CTL::AbstractGantry::sourceDisplacement ( ) const
inline

Returns the specified displacement of the source.

\( L_{\textrm{src}}^{\textrm{displ}}= (t_{\textrm{src}}^{\textrm{displ}},R_{\textrm{src}}^{\textrm{displ}}) \)

◆ sourceLocation()

mat::Location CTL::AbstractGantry::sourceLocation ( ) const
inline

Returns the final source location. This considers (optional) effects of a source displacement.

The location contains the position in world coordinates as well as the rotation matrix that holds the transformation from an unaltered source coordinate system to the WCS.

\( L_{\textrm{src}}^{\textrm{total}}= (t_{\textrm{src}}^{\textrm{total}},R_{\textrm{src}}^{\textrm{total}}) \)

See also
sourcePosition(), sourceRotation().

◆ sourcePosition()

Vector3x1 CTL::AbstractGantry::sourcePosition ( ) const
inline

Convenience method. Returns the final source position in world coordinates.

\( t_{\textrm{src}}^{\textrm{total}}=R_{\textrm{gantry}}^{\textrm{displ}} \cdot t_{\textrm{src}}^{\textrm{nominal}}+R_{\textrm{src}}^{\textrm{total}} \cdot t_{\textrm{src}}^{\textrm{displ}}+t_{\textrm{gantry}}^{\textrm{displ}} \)

Same as: sourceLocation().position.

◆ sourceRotation()

Matrix3x3 CTL::AbstractGantry::sourceRotation ( ) const
inline

Convenience method. Returns the total transformation matrix from an unaltered source coordinate system to the WCS.

\( R_{\textrm{src}}^{\textrm{total}}=R_{\textrm{gantry}}^{\textrm{displ}} \cdot R_{\textrm{src}}^{\textrm{nominal}}\cdot R_{\textrm{src}}^{\textrm{displ}} \)

Same as sourceLocation().rotation.

◆ toVariant()

QVariant CTL::AbstractGantry::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::TubularGantry, CTL::GenericGantry, and CTL::CarmGantry.

◆ type()

int CTL::AbstractGantry::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::TubularGantry, CTL::GenericGantry, and CTL::CarmGantry.


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