CTL  0.6.1
Computed Tomography Library
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CTL::ArealFocalSpotExtension Class Reference

The ArealFocalSpotExtension class is an extension for forward projectors that considers the finite dimensions of the focal spot. More...

#include <arealfocalspotextension.h>

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

Public Types

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

Public Member Functions

int type () const override
 
void configure (const AcquisitionSetup &setup) override
 
 ArealFocalSpotExtension (const QSize &discretization, bool lowExtinctionApproximation=false)
 
void setDiscretization (const QSize &discretization)
 
void enableLowExtinctionApproximation (bool enable=true)
 
QVariant toVariant () const override
 Stores the contents of this instance in a QVariant. More...
 
QVariant parameter () const override
 
void setParameter (const QVariant &parameter) override
 Sets the parameters of this instance based on the passed QVariant parameter. Parameters need to follow the naming convention as described in parameter(). More...
 
bool isLinear () const override
 
 ProjectorExtension (AbstractProjector *projector=nullptr)
 
 ProjectorExtension (std::unique_ptr< AbstractProjector > projector)
 
- Public Member Functions inherited from CTL::ProjectorExtension
int type () const override
 
void configure (const AcquisitionSetup &setup) override
 
ProjectionData project (const VolumeData &volume) override
 
 ProjectorExtension (AbstractProjector *projector=nullptr)
 
 ProjectorExtension (std::unique_ptr< AbstractProjector > projector)
 
ProjectionData projectComposite (const CompositeVolume &volume) override
 Provides the functionality to forward project CompositeVolume data. More...
 
ProjectionData projectSparse (const SparseVoxelVolume &volume) override
 Provides the functionality to forward project SparseVoxelVolume data. More...
 
bool isLinear () const override
 Returns true if the projection operation is linear. More...
 
virtual void use (AbstractProjector *other)
 
void use (std::unique_ptr< AbstractProjector > other)
 
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...
 
AbstractProjectorrelease ()
 
void reset ()
 
- Public Member Functions inherited from CTL::AbstractProjector
 AbstractProjector (const AbstractProjector &)=delete
 
 AbstractProjector (AbstractProjector &&)=default
 
AbstractProjectoroperator= (const AbstractProjector &)=delete
 
AbstractProjectoroperator= (AbstractProjector &&)=default
 
 ~AbstractProjector () override=default
 
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...
 
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
 

Protected Member Functions

ProjectionData extendedProject (const MetaProjector &nestedProjector) override
 
QVector< QPointF > discretizationGrid () const
 
- Protected Member Functions inherited from CTL::SerializationInterface
 SerializationInterface ()=default
 
 SerializationInterface (const SerializationInterface &)=default
 
 SerializationInterface (SerializationInterface &&)=default
 
SerializationInterfaceoperator= (const SerializationInterface &)=default
 
SerializationInterfaceoperator= (SerializationInterface &&)=default
 

Protected Attributes

QSize _discretizationSteps { 1, 1 }
 Requested number of discretization steps in both dimensions.
 
AcquisitionSetup _setup
 A copy of the setup used for acquisition.
 
bool _lowExtinctionApprox { false }
 True if low attenuation approximation has been enabled.
 

Friends

template<class >
struct SerializationHelper::RegisterWithSerializationHelper
 

Additional Inherited Members

Detailed Description

The ArealFocalSpotExtension class is an extension for forward projectors that considers the finite dimensions of the focal spot.

This class is an extension for projectors that takes into account the finite extent of the X-ray source. Typically, forward projection routines assume a point source, which is only an approximation of the real scenario.

In reality, the origin of the radiation - henceforth referred to as the focal spot - covers the area of \(\left[-\frac{w_{fs}}{2},\frac{w_{fs}}{2}\right]\times \left[-\frac{h_{fs}}{2},\frac{h_{fs}}{2}\right]\), where \(w_{fs}\) and \(h_{fs}\) denote the width and height of the focal spot, respectively. To simulate this extended area, projections will be simulated for a grid of sampling points (see figure below) and averaged afterwards. The number of discretization steps can be specified using setDiscretization().

By default, the focal spot discretization defaults to [1, 1], resulting in conventional point source approximation.

Illustration of the focal spot discretization principle.

Note that this extension will increase the time required for projection linearly with the number of requested sampling points. It also doubles the required system memory (needs to keep two full sets of projections in memory simultaneously).

The following example shows how to extend a simple ray caster algorithm to approximate the focal spot extensions with a 5x5 grid:

// some definitions
VolumeData volume;
// ...
AcquisitionSetup acquisitionSetup;
// ...
// Core part
auto simpleProjector = new RayCasterProjector; // our simple projector
// optional parameter settings for the projector
// e.g. simpleProjector->settings().raySampling = 0.1f;
// this is what you do without extension:
// simpleProjector->configure(acquisitionSetup);
// ProjectionData projections = simpleProjector->project(volume);
// instead we now do the following
ArealFocalSpotExtension* extension = new ArealFocalSpotExtension;
extension->use(simpleProjector); // tell the extension to use the ray caster
extension->setDiscretization(QSize(5, 5)); // set discretization grid to 5x5 points
extension->configure(acquisitionSetup); // configure the simulation
ProjectionData projections = extension->project(volume); // (compute and) get the final projections

Constructor & Destructor Documentation

◆ ArealFocalSpotExtension()

CTL::ArealFocalSpotExtension::ArealFocalSpotExtension ( const QSize &  discretization,
bool  lowExtinctionApproximation = false 
)
explicit

Constructs an ArealFocalSpotExtension with a focal spot sub-sampling given by discretization and linearization approximation enabled if lowExtinctionApproximation = true.

See also
setDiscretization(), enableLowExtinctionApproximation()

Member Function Documentation

◆ configure()

void CTL::ArealFocalSpotExtension::configure ( const AcquisitionSetup setup)
overridevirtual

Re-implementation of the configuration step. This takes copies of the AcquisitionSetup and the AbstractProjectorConfig. The actual configure() method of the nested projector is called within project(). Use setDiscretization() to change the level of discretization.

Implements CTL::AbstractProjector.

◆ discretizationGrid()

QVector< QPointF > CTL::ArealFocalSpotExtension::discretizationGrid ( ) const
protected

Computes and returns the grid of (relative) sampling points.

This discretizes the area of the focal spot, i.e. \(\left[-\frac{1}{2},\frac{1}{2}\right]\times \left[-\frac{1}{2},\frac{1}{2}\right]\) into _discretizationSteps.width() x _discretizationSteps.height() steps.

See detailed class description for a figure depicting the discretization pattern.

◆ enableLowExtinctionApproximation()

void CTL::ArealFocalSpotExtension::enableLowExtinctionApproximation ( bool  enable = true)

Sets the use of the low extinction approximation to enable.

When activated, the low extinction approximation causes projection images of individual focal spot sub-samples to be averaged in extinction domain instead of in intensity domain. This is an approximation that allows the ArealFocalSpotExtension to become a linear extension, which has potential performance benefit when used in combination with other extensions. However, the result will become inaccurate, particularly if strong extinction gradients are present in the projection images. For low extinction (and esp. their gradients), the approximation is acceptable.

From a mathematical point of view, this requires: \( -\ln\frac{1}{F}\sum_{f=1}^{F}\exp(-\epsilon_{f})\approx\frac{1}{F}\sum_{f=1}^{F}\epsilon_{f}, \)

where \(\epsilon_{f}\) denotes the extinction value of a certain pixel for focal spot sub-sample \(f\). It can be shown that this is fulfilled for \(\epsilon_{f}\ll 1\) (overall low extinction values) or \(\epsilon_{f}=\epsilon+\delta_{f}\) with \(\delta_{f}\ll 1\) (small gradients, i.e. different focal spot positions create only small changes in extinction).

◆ extendedProject()

ProjectionData CTL::ArealFocalSpotExtension::extendedProject ( const MetaProjector nestedProjector)
overrideprotectedvirtual

Re-implementation of the projection step.

This method invokes an individual projection computation (i.e. delegation to the project() method of the nested projector object) for each of the discretization points that are requested. Returns the average of the resulting individual projection images.

In short, the work flow is as follows:

foreach discretizationPoint

  • Create a copy of the AcquisitionSetup
  • Compute offset of discretizationPoint w.r.t. to focal spot center (i.e. [0,0,0]) for the specific focal spot size of all views in the setup
  • Add this offset to the preparation pipeline for the corresponding views
  • Call configure() of the nested projector with the resulting setup
  • Invoke project() of the nested projector
  • Accumulate projections (in intensity domain, unless low extinction approximation activated)

end foreach

  • Return averaged projections.

Detailled description:
Technically, this is realized using the source displacement functionality. The focal spot covers the area of \(\left[-\frac{w_{fs}}{2},\frac{w_{fs}}{2}\right]\times \left[-\frac{h_{fs}}{2},\frac{h_{fs}}{2}\right]\), where \(w_{fs}\) and \(h_{fs}\) denote the width and height of the focal spot, respectively. This area is discretized into _discretizationSteps.width() x _discretizationSteps.height() steps. For each of these points, the corresponding spatial shift (w.r.t. the point source location used in conventional methods) is added to the source displacement. Afterwards, the nested projector is configured (using its configure() method) and and projections are simulated with the resulting system (using project() from the nested projector). Note that adding this displacement component is required (instead of simply setting it) in order to allow for other sources of displacement that already exist in the system before simulating the focal spot extent.

This extension will invoke an individual projection computation for each of the sampling points. Hence, computation time increases (at least) linearly with the number of requested sampling points. Furthermore, required system memory is doubled, since two full sets of projections need to be kept in memory simultaneously.

By default, projections are averaged in intensity domain. This makes the extension non-linear. To enforce averaging in extinction domain, and by that, make the extension linear, enable the low extinction approximation (see enableLowExtinctionApproximation()).

Reimplemented from CTL::ProjectorExtension.

◆ isLinear()

bool CTL::ArealFocalSpotExtension::isLinear ( ) const
overridevirtual

Returns false (requires averaging operation in intensity domain) unless the low extinction approximation is enabled.

See also
enableLowExtinctionApproximation()

Reimplemented from CTL::AbstractProjector.

◆ parameter()

QVariant CTL::ArealFocalSpotExtension::parameter ( ) const
overridevirtual

Returns the parameters of this instance as QVariant.

This returns a QVariantMap with three key-value-pairs: The first to are ("Discretization X", _discretizationSteps.width()) and ("Discretization Y", _discretizationSteps.height()), which refer to the number of sampling points used to sub-sample the focal spot in x and y direction (CT coordinates), respectively. The third key-value-pair is ("Low extinction approx", _lowExtinctionApprox) and represents the information whether this instance has the low extinction approximation enabled.

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

Reimplemented from CTL::AbstractProjector.

◆ ProjectorExtension() [1/2]

CTL::ProjectorExtension::ProjectorExtension
explicit

Constructs a ProjectorExtension object and sets the nested projector to projector. The nested projector is internally used as a basis for computing forward projections. Note that the constructed object takes over the ownership of projector.

◆ ProjectorExtension() [2/2]

CTL::ProjectorExtension::ProjectorExtension
explicit

Constructs a ProjectorExtension object and sets the nested projector to projector. A good practice to create a ProjectorExtension on the heap is to use the make function makeExtension(std::unique_ptr<AbstractProjector> projector) which will interally use this constructor.

◆ setDiscretization()

void CTL::ArealFocalSpotExtension::setDiscretization ( const QSize &  discretization)

Sets the discretization of the focal spot to discretization. The focal spot will then be sampled with discretization.width() x discretization.height() sampling points. These sampling dimensions correspond to the width and height of the focal spot (or x and y direction in CT coordinates).

◆ setParameter()

void CTL::ArealFocalSpotExtension::setParameter ( const QVariant &  parameter)
overridevirtual

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 from CTL::AbstractProjector.

◆ toVariant()

QVariant CTL::ArealFocalSpotExtension::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::AbstractProjector.

◆ type()

int CTL::ArealFocalSpotExtension::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::AbstractProjector.


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