CTL  0.6.1
Computed Tomography Library
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CTL::CTSystem Class Reference

The CTSystem class manages the list of all components of a system. More...

#include <ctsystem.h>

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

Public Types

typedef std::unique_ptr< SystemComponentComponentPtr
 Alias for unique pointer to SystemComponent.
 
- Public Types inherited from CTL::SerializationInterface
enum  { Type = -1, UserType = 65536 }
 

Public Member Functions

 CTSystem (QString name=defaultName())
 
 CTSystem (const CTSystem &other)
 
 CTSystem (CTSystem &&other)=default
 
CTSystemoperator= (CTSystem &&other)=default
 
CTSystemoperator= (const CTSystem &other)
 
virtual ~CTSystem () override=default
 
virtual CTSystemclone () const &
 
virtual CTSystemclone () &&
 
virtual QString info () const
 
virtual QString overview () const
 
void fromVariant (const QVariant &variant) override
 
QVariant toVariant () const override
 
std::vector< AbstractDetector * > detectors () const
 
std::vector< AbstractGantry * > gantries () const
 
std::vector< AbstractSource * > sources () const
 
std::vector< AbstractBeamModifier * > modifiers () const
 
const std::vector< ComponentPtr > & components () const
 
const QString & name () const
 
uint nbComponents () const
 
void addComponent (ComponentPtr component)
 
void addComponent (SystemComponent *component)
 
void clear ()
 
bool isEmpty () const
 
bool isValid () const
 
bool isSimple () const
 
void rename (QString name)
 
void removeComponent (SystemComponent *component)
 
CTSystemoperator<< (ComponentPtr component)
 
CTSystemoperator<< (SystemComponent *component)
 
- Public Member Functions inherited from CTL::SerializationInterface
virtual int type () const
 
virtual ~SerializationInterface ()=default
 

Static Public Member Functions

static QString defaultName ()
 

Private Attributes

QString _name
 The name of the system.
 
std::vector< ComponentPtr_componentList
 The list of components.
 

Additional Inherited Members

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

Detailed Description

The CTSystem class manages the list of all components of a system.

This class is used to manage the list of system components. System components can be added using addComponent() or the "stream" operator<<(). The full component list can by filtered by the components' base types in order to assess, for example all detector components in the system.

CTSystem mySystem;
std::cout << mySystem.overview().toStdString();
// *** Output ***
// CT system: Generic CT-system
// Number of components: 0
// System is valid: false
// System is simple: false
// ----------------------------------
// Components:
mySystem.rename("Examplary system");
// We now create some components and add them to the system.
AbstractDetector* myDetector = new FlatPanelDetector(QSize(100, 100), QSizeF(1.0f, 1.0f));
AbstractSource* mySource = new XrayTube(120.0, 1.0);
AbstractGantry* myGantry = new TubularGantry(1000.0, 500.0);
mySystem.addComponent(myDetector);
mySystem.addComponent(mySource);
mySystem.addComponent(myGantry);
std::cout << mySystem.overview().toStdString();
// *** Output ***
// CT system: Examplary system
// Number of components: 3
// System is valid: true
// System is simple: true
// ----------------------------------
// Components:
// (*) Flat panel detector
// (*) Xray tube
// (*) Tubular gantry
// Note that the system is valid and simple, as it contains exactly one source, detector and gantry.
// We now add another source to the system.
AbstractSource* additionalSource = new XrayTube(70.0, 1.0, "Other tube");
mySystem.addComponent(additionalSource);
std::cout << mySystem.overview().toStdString();
// *** Output ***
// CT system: Examplary system
// Number of components: 4
// System is valid: true
// System is simple: false
// ----------------------------------
// Components:
// (*) Flat panel detector
// (*) Xray tube
// (*) Tubular gantry
// (*) Other tube
// Now the system has two sources. Hence it's still valid, but no longer simple.

Constructor & Destructor Documentation

◆ CTSystem() [1/3]

CTL::CTSystem::CTSystem ( QString  name = defaultName())

Constructs a CTSystem object named name.

◆ CTSystem() [2/3]

CTL::CTSystem::CTSystem ( const CTSystem other)

Constructs a copy of other.

◆ CTSystem() [3/3]

CTL::CTSystem::CTSystem ( CTSystem &&  other)
default

Default move constructor.

◆ ~CTSystem()

CTL::CTSystem::~CTSystem ( )
overridevirtualdefault

Default destructor.

Member Function Documentation

◆ addComponent() [1/2]

void CTL::CTSystem::addComponent ( CTSystem::ComponentPtr  component)

Adds component to the system. Does nothing if component is null.

◆ addComponent() [2/2]

void CTL::CTSystem::addComponent ( SystemComponent component)

Adds component to the system. This CTSystem instance takes ownership of component.

Does nothing if component is null.

◆ clear()

void CTL::CTSystem::clear ( )

Removes all components from the system.

◆ clone() [1/2]

CTSystem * CTL::CTSystem::clone ( ) const &
virtual

Constructs a copy of the system and returns a base-class pointer to the new object.

Reimplemented in CTL::SimpleCTSystem.

◆ clone() [2/2]

CTSystem * CTL::CTSystem::clone ( ) &&
virtual

Constructs a new CTSystem object and moves the content of this instance into the new object. Returns a base class pointer to the new instance.

Reimplemented in CTL::SimpleCTSystem.

◆ components()

const std::vector< CTSystem::ComponentPtr > & CTL::CTSystem::components ( ) const

Returns a constant reference to the list of components.

◆ defaultName()

QString CTL::CTSystem::defaultName ( )
static

Returns the default name for the component: "Generic CT-system".

◆ detectors()

std::vector< AbstractDetector * > CTL::CTSystem::detectors ( ) const

Returns a list of all components of elementary type AbstractDetector in the system.

◆ fromVariant()

void CTL::CTSystem::fromVariant ( const QVariant &  variant)
overridevirtual

Reads all member variables from the QVariant variant.

Reimplemented from CTL::SerializationInterface.

◆ gantries()

std::vector< AbstractGantry * > CTL::CTSystem::gantries ( ) const

Returns a list of all components of elementary type AbstractGantry in the system.

◆ info()

QString CTL::CTSystem::info ( ) const
virtual

Returns a string that contains full information about all components in the system.

◆ isEmpty()

bool CTL::CTSystem::isEmpty ( ) const

Returns true if the number of compontents is zero, otherwise it returns false.

◆ isSimple()

bool CTL::CTSystem::isSimple ( ) const

Returns true if the system is simple. To be simple, a system must have exactly one component of each of the following base types (or their derived classes):

The system may have an arbitrary number of AbstractBeamModifier components ans still be simple.

◆ isValid()

bool CTL::CTSystem::isValid ( ) const

Returns true if the system is valid. To be valid, a system must have at least one component of each of the following base types (or their derived classes):

The system may have an arbitrary number of AbstractBeamModifier components and still be valid.

◆ modifiers()

std::vector< AbstractBeamModifier * > CTL::CTSystem::modifiers ( ) const

Returns a list of all components of elementary type AbstractBeamModifier in the system.

◆ name()

const QString & CTL::CTSystem::name ( ) const

Returns the name of the system.

◆ nbComponents()

uint CTL::CTSystem::nbComponents ( ) const

Returns the number of components in the system.

Same as components().size().

◆ operator<<() [1/2]

CTSystem & CTL::CTSystem::operator<< ( CTSystem::ComponentPtr  component)

Operator style alternative to add component to the system.

Similar to addComponent() but also returns a reference to this instance.

◆ operator<<() [2/2]

CTSystem & CTL::CTSystem::operator<< ( SystemComponent component)

Operator style alternative to add component to the system. This CTSystem instance takes ownership of component.

Similar to addComponent() but also returns a reference to this instance.

◆ operator=() [1/2]

CTSystem & CTL::CTSystem::operator= ( CTSystem &&  other)
default

Default move assignment operator.

◆ operator=() [2/2]

CTSystem & CTL::CTSystem::operator= ( const CTSystem other)

Assigns the content of other to this system and returns a reference to this instance.

◆ overview()

QString CTL::CTSystem::overview ( ) const
virtual

Returns a string that gives an overview over this system. This contains the system's name and the number of components as well as their names. Additionally, is shows whether the system is valid and simple or not.

See also
isValid(), is Simple().

◆ removeComponent()

void CTL::CTSystem::removeComponent ( SystemComponent component)

Removes the component component from the system.

◆ rename()

void CTL::CTSystem::rename ( QString  name)

Sets the system's name to name.

◆ sources()

std::vector< AbstractSource * > CTL::CTSystem::sources ( ) const

Returns a list of all components of elementary type AbstractSource in the system.

◆ toVariant()

QVariant CTL::CTSystem::toVariant ( ) const
overridevirtual

Writes all components to a QVariant. This uses SerializationInterface::toVariant() of individual components in the system.

Reimplemented from CTL::SerializationInterface.


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