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

The AbstractProjector class is the abstract base class defining the interfaces for forward projectors. More...

#include <abstractprojector.h>

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

Public Types

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

Public Member Functions

int type () const override
 
virtual void configure (const AcquisitionSetup &setup)=0
 Configures the projector. More...
 
virtual ProjectionData project (const VolumeData &volume)=0
 Provides the actual forward projection functionality. More...
 
 AbstractProjector (const AbstractProjector &)=delete
 
 AbstractProjector (AbstractProjector &&)=default
 
AbstractProjectoroperator= (const AbstractProjector &)=delete
 
AbstractProjectoroperator= (AbstractProjector &&)=default
 
 ~AbstractProjector () override=default
 
virtual bool isLinear () const
 Returns true if the projection operation is linear. More...
 
virtual ProjectionData projectComposite (const CompositeVolume &volume)
 Provides the functionality to forward project CompositeVolume data. More...
 
virtual ProjectionData projectSparse (const SparseVoxelVolume &volume)
 Provides the functionality to forward project SparseVoxelVolume data. More...
 
ProjectionData configureAndProject (const AcquisitionSetup &setup, const VolumeData &volume)
 Performs a forward projection with a precedent configuration of the projector. More...
 
ProjectionData configureAndProject (const AcquisitionSetup &setup, const CompositeVolume &volume)
 Performs a forward projection with a precedent configuration of the projector. More...
 
ProjectionData configureAndProject (const AcquisitionSetup &setup, const SparseVoxelVolume &volume)
 Performs a forward projection with a precedent configuration of the projector. More...
 
void fromVariant (const QVariant &variant) override
 Sets the contents of the object based on the QVariant variant. More...
 
QVariant toVariant () const override
 Stores the contents of this instance in a QVariant. More...
 
virtual QVariant parameter () const
 Returns the parameters of this instance as QVariant. More...
 
virtual void setParameter (const QVariant &parameter)
 Sets the parameters of this instance based on the passed QVariant parameter. Parameters need to follow the naming convention as described in parameter(). More...
 
virtual ProjectorNotifiernotifier ()
 Returns a pointer to the notifier of the projector. More...
 
void connectNotifierToMessageHandler (bool includeProgress=false)
 Connects the notifier to the CTL's MessageHandler. More...
 
- Public Member Functions inherited from CTL::SerializationInterface
virtual ~SerializationInterface ()=default
 

Private Attributes

std::unique_ptr< ProjectorNotifier_notifier
 The notifier object used for signal emission. More...
 

Friends

template<class >
struct SerializationHelper::RegisterWithSerializationHelper
 

Related Functions

(Note that these are not member functions.)

 VolumeData
 Alias name for CTL::SpectralVolumeData. More...
 
std::unique_ptr< ProjectorType > makeProjector (ConstructorArguments &&... arguments)
 

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 AbstractProjector class is the abstract base class defining the interfaces for forward projectors.

This class defines the interface every forward projection implementation needs to satisfy. This comes down to two methods that need to be provided:

Two structurally different ways of how such an implementation can be realized are given by the examples external::RayCasterAdapter and RayCasterProjector. Both can be found in the OpenCL module (ocl_routines.pri).

Constructor & Destructor Documentation

◆ ~AbstractProjector()

CTL::AbstractProjector::~AbstractProjector ( )
overridedefault

Virtual default destructor.

Member Function Documentation

◆ configure()

void CTL::AbstractProjector::configure ( const AcquisitionSetup setup)
pure virtual

Configures the projector.

This method should be used to gather all necessary information to prepare the actual forward projection. This usually contains all geometry and system information, which can be retrieved from setup.

If you intend to call configure() and project() (or projectComposite()) directly after each other, you should use configureAndProject() instead.

Implemented in CTL::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, CTL::ArealFocalSpotExtension, CTL::PoissonNoiseExtension, CTL::DetectorSaturationExtension, CTL::OCL::RayCasterProjector, CTL::OCL::SFPProjector, CTL::DynamicProjectorExtension, CTL::RayCasterProjectorCPU, and CTL::OCL::external::RayCasterAdapter.

◆ configureAndProject() [1/3]

ProjectionData CTL::AbstractProjector::configureAndProject ( const AcquisitionSetup setup,
const VolumeData volume 
)

Performs a forward projection with a precedent configuration of the projector.

This convenience method combines the calls to configure() and project() into a single call. Returns the result of project.

Same as:

configure(setup);
return project(volume);

Using this method is recommended over individual calls of configure() and project() directly after one another, because it may help you avoid mistakes. In particular, it prevents that configure() is missed to call before calling project(), e.g. after changing settings of the projector (which usually require a re-configure).

Note that this method usually changes the state of the projector due to the configure step.

See also
configure, project

◆ configureAndProject() [2/3]

ProjectionData CTL::AbstractProjector::configureAndProject ( const AcquisitionSetup setup,
const CompositeVolume volume 
)

Performs a forward projection with a precedent configuration of the projector.

This convenience method combines the calls to configure() and projectComposite() into a single call. Returns the result of projectComposite.

Same as:

configure(setup);
return projectComposite(volume);

Using this method is recommended over individual calls of configure() and projectComposite() directly after one another, because it may help you avoid mistakes. In particular, it prevents that configure() is missed to call before calling project(), e.g. after changing settings of the projector (which usually require a re-configure).

Note that this methods usually change the state of the projector due to the configure step.

See also
configure, projectComposite

◆ configureAndProject() [3/3]

ProjectionData CTL::AbstractProjector::configureAndProject ( const AcquisitionSetup setup,
const SparseVoxelVolume volume 
)

Performs a forward projection with a precedent configuration of the projector.

This convenience method combines the calls to configure() and projectSparse() into a single call. Returns the result of projectSparse.

Same as:

configure(setup);
return projectSparse(volume);

Using this method is recommended over individual calls of configure() and projectSparse() directly after one another, because it may help you avoid mistakes. In particular, it prevents that configure() is missed to call before calling project(), e.g. after changing settings of the projector (which usually require a re-configure).

Note that this methods usually change the state of the projector due to the configure step.

See also
configure, projectSparse

◆ connectNotifierToMessageHandler()

void CTL::AbstractProjector::connectNotifierToMessageHandler ( bool  includeProgress = false)

Connects the notifier to the CTL's MessageHandler.

Same as:

notifier()->connectToMessageHandler(includeProgress);
See also
ProjectorNotifier::connectToMessageHandler

◆ fromVariant()

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

Sets the contents of the object based on the QVariant variant.

Implementation of the deserialization interface. This method uses setParameter() to deserialize class members.

Reimplemented from CTL::SerializationInterface.

Reimplemented in CTL::ProjectorExtension, CTL::StandardPipeline, and CTL::ProjectionPipeline.

◆ isLinear()

bool CTL::AbstractProjector::isLinear ( ) const
virtual

Returns true if the projection operation is linear.

By default, this method returns true. Override this method to return false in case of sub-classing that leads to non-linear operations. Overrides of this method should never return an unconditional true (as this might outrule underlying non-linearity).

Reimplemented in CTL::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, CTL::ArealFocalSpotExtension, CTL::PoissonNoiseExtension, and CTL::DetectorSaturationExtension.

◆ notifier()

ProjectorNotifier * CTL::AbstractProjector::notifier ( )
virtual

Returns a pointer to the notifier of the projector.

The notifier object can be used to emit the signal ProjectorNotifier::projectionFinished(int) when the calculation of the viewNb'th view has been done.

To receive emitted signals, use Qt's connect() method to connect the notifier object to any receiver object of choice. The notifier can also conveniently be connected to the MessageHandler of the CTL using connectToMessageHandler() or directly from the projector through AbstractProjector::connectNotifierToMessageHandler().

Example - sending simulation progress information to a QProgressBar:

AbstractProjector* myProjector /* = new ActualProjector */;
QProgressBar* myProgressBar = new QProgressBar();
// ... e.g. add the progress bar somewhere in your GUI
connect(myProjector->notifier(), SIGNAL(projectionFinished(int)),
myProgressBar, SLOT(setValue(int)));

/// Example 2 - forwarding the information text to a QStatusBar

AbstractProjector* myProjector /* = new ActualProjector */;
QStatusBar* myStatusBar = new QStatusBar;
// ... e.g. add the status bar somewhere in your GUI (or take a pointer to an existing one)
QObject::connect(myProjector->notifier(), SIGNAL(information(QString)),
myStatusBar, SLOT(showMessage(QString)));

Reimplemented in CTL::StandardPipeline, and CTL::ProjectionPipeline.

◆ parameter()

QVariant CTL::AbstractProjector::parameter ( ) const
virtual

Returns the parameters of this instance as QVariant.

This shall return a QVariantMap with key-value-pairs representing all settings of the object.

This method is used within toVariant() to serialize the object's settings.

Reimplemented in CTL::SpectralEffectsExtension, CTL::ArealFocalSpotExtension, CTL::PoissonNoiseExtension, CTL::DetectorSaturationExtension, CTL::OCL::RayCasterProjector, and CTL::RayCasterProjectorCPU.

◆ project()

ProjectionData CTL::AbstractProjector::project ( const VolumeData volume)
pure virtual

Provides the actual forward projection functionality.

This method takes a voxelized dataset volume and shall return the full set of forward projections that have been requested by the AcquisitionSetup set in the configure() step.

The passed volume data can be either:

CompositeVolume data can be projected using projectComposite(); SparseVoxelVolume input can be processed by projectSparse().

Note that the functionality of specific ProjectorExtension classes might depend on a passing a certain type of volume data. Please refer to the documentation of the extensions you are using.

If you intend to call configure() and project() directly after each other, you should use configureAndProject() instead.

Implemented in CTL::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, CTL::OCL::RayCasterProjector, CTL::OCL::SFPProjector, CTL::DynamicProjectorExtension, CTL::RayCasterProjectorCPU, and CTL::OCL::external::RayCasterAdapter.

◆ projectComposite()

ProjectionData CTL::AbstractProjector::projectComposite ( const CompositeVolume volume)
virtual

Provides the functionality to forward project CompositeVolume data.

This method takes a composite dataset volume and returns the full set of forward projections according to the AcquisitionSetup set in the configure() step.

By default, this method performs separate calls to project() for each individual voxel volume stored in the composite volume. The final projection result is the sum of all these individual projections (extinction domain). Change this behavior in sub-classes, if this is not suitable for your desired purpose. This is typically the case for non-linear operations.

If you intend to call configure() and projectComposite() directly after each other, you should use configureAndProject() instead.

Reimplemented in CTL::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, and CTL::DynamicProjectorExtension.

◆ projectSparse()

ProjectionData CTL::AbstractProjector::projectSparse ( const SparseVoxelVolume volume)
virtual

Provides the functionality to forward project SparseVoxelVolume data.

This method takes a sparse dataset volume and returns the full set of forward projections according to the AcquisitionSetup set in the configure() step.

By default, this method performs converts volume to a regular VoxelVolume<float> and calls project() with it. Re-implement this method in sub-classes if you can provide more efficient ways of forward projecting sparse data.

If you intend to call configure() and projectSparse() directly after each other, you should use configureAndProject() instead.

Reimplemented in CTL::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, CTL::DynamicProjectorExtension, and CTL::OCL::SFPProjector.

◆ setParameter()

void CTL::AbstractProjector::setParameter ( const QVariant &  parameter)
virtual

Sets the parameters of this instance based on the passed QVariant parameter. Parameters need to follow the naming convention as described in parameter().

This method is used within fromVariant() to deserialize the object's settings. Direct use of this method is discouraged; consider using dedicated setter methods instead.

Reimplemented in CTL::SpectralEffectsExtension, CTL::ArealFocalSpotExtension, CTL::PoissonNoiseExtension, CTL::DetectorSaturationExtension, CTL::OCL::RayCasterProjector, and CTL::RayCasterProjectorCPU.

◆ toVariant()

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

Stores the contents of this instance in a QVariant.

Implementation of the serialization interface. Stores the object's type-id (from SerializationInterface::toVariant()).

This method uses parameter() to serialize class members.

Reimplemented from CTL::SerializationInterface.

Reimplemented in CTL::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, CTL::ArealFocalSpotExtension, CTL::PoissonNoiseExtension, CTL::DetectorSaturationExtension, CTL::OCL::RayCasterProjector, CTL::DynamicProjectorExtension, and CTL::RayCasterProjectorCPU.

◆ type()

int CTL::AbstractProjector::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::ProjectorExtension, CTL::StandardPipeline, CTL::SpectralEffectsExtension, CTL::ProjectionPipeline, CTL::ArealFocalSpotExtension, CTL::PoissonNoiseExtension, CTL::DetectorSaturationExtension, CTL::DynamicProjectorExtension, CTL::OCL::RayCasterProjector, and CTL::RayCasterProjectorCPU.

Friends And Related Function Documentation

◆ makeProjector()

std::unique_ptr< ProjectorType > makeProjector ( ConstructorArguments &&...  arguments)
related

Global (free) make function that creates a new Projector from possible constructor arguments. The component is returned as a std::unique_ptr<ProjectorType>, whereas ProjectorType is the template argument of this function that needs to be specified.

Example:

auto projector = makeProjector<RayCasterProjectorCPU>();

◆ VolumeData()

VolumeData
related

Alias name for CTL::SpectralVolumeData.

Also serves as a placeholder for potential future changes to the concept of volume data.

Member Data Documentation

◆ _notifier

std::unique_ptr<ProjectorNotifier> CTL::AbstractProjector::_notifier
private
Initial value:
{
new ProjectorNotifier
}

The notifier object used for signal emission.


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