ImFusion SDK 4.3

#include <ImFusion/CT/Gl2D3DRegistration.h>

OpenGL-accelerated 2D-3D registration for cone-beam projections. More...

+ Inheritance diagram for Gl2D3DRegistration:

Detailed Description

OpenGL-accelerated 2D-3D registration for cone-beam projections.

GPU-based implementation of intensity-based 2D-3D registration.

Public Types

enum class  ParameterMode { Detector , Iso , Global }
 
enum class  DRRMode { Full , Masked }
 
- Public Types inherited from Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
 

Public Member Functions

 Gl2D3DRegistration (SharedImageSet *data, GlConeBeamForward *fw)
 Constructor requiring cone-beam data and forward projector.
 
 Gl2D3DRegistration (SharedImageSet *data, SharedImageSet *vol)
 Constructor with cone-beam data and volume.
 
 ~Gl2D3DRegistration () override
 Destructor deleting auxiliary data.
 
void setDrrZeroMask (bool flag, int frame=-1)
 If true, zero intensities in the DRR will be ignored by the similarity measure.
 
void setLocalSimilarityImage (bool flag)
 Specify whether a local similarity image shall be computed for the focus frame (LNCC mode only)
 
void setPosePenalty (const std::function< double(int n, const double *x)> &penaltyFunction)
 Set an optional penalty function on the pose parameters.
 
const std::function< double(int n, const double *x)> & posePenalty ()
 Retrieve the optional penalty function on the pose parameters.
 
void setWeightImages (const std::vector< SharedImage * > &images)
 Set optional images to use as pixel-wise weighting of the similarity measure for each frame.
 
const std::vector< SharedImage * > & weightImages ()
 Access weight images.
 
SimilarityMeasureWrappersimilarityMeasure ()
 Access the similarity measure to set parameters.
 
void similarityMeasureChanged () const
 Inform all AlgorithmListener that the similarityMeasure has changed.
 
void reset ()
 Reset transformations to state before registration.
 
void resetOrigParams ()
 Fetch current params from m_data and set m_origParams to a copy of m_data->geometry()
 
const ConeBeamGeometryorigPars ()
 Retrieve saved copy of the original parameters.
 
std::shared_ptr< OptimizercreateDefaultOptimizer () const override
 Create suited optimizer depending on parameter mode.
 
double evaluate ()
 Directly evaluate selection without manipulating CBCT geometry.
 
double evaluate (int n, const double *x, double *dx=0) override
 Evaluate the cost function.
 
SharedImageSetdrr (int frame=-1)
 Return the rendered DRR (owned by this class).
 
int numDRRs ()
 Return the number of DRR images managed by this class.
 
SharedImageSetsimilarityImage ()
 Return the last computed local similarity map if available (owned here, LNCC mode only)
 
SharedImageSetcomputeDrr (int frame)
 Compute DRR for chosen frame and return it The image returned is owned by this class, it is using the same instance for all frames.
 
SharedImageSetcomputeDrr (int frame, const mat4 &matrix, bool invert=false)
 Compute DRR for chosen frame using the given iso matrix and return it.
 
SharedImageSetdata ()
 Return pointer to the used cone-beam data.
 
const std::vector< mat4 > & relativeMatrices () const
 Access to the relative transformation matrices after optimization.
 
SequentialMotionseqMotion ()
 Access to the sequential motion class.
 
void resetInternalSimilarityImage2 ()
 Resets the projection image of the internal similarity measure.
 
- Public Member Functions inherited from GeometryGeneratorOptimizingAlgorithm
 GeometryGeneratorOptimizingAlgorithm (SharedImageSet *data)
 Constructor.
 
- Public Member Functions inherited from OptimizingAlgorithm
void setOptimizer (std::shared_ptr< Optimizer > opt)
 Set an optimizer from outside.
 
std::shared_ptr< Optimizeroptimizer ()
 Returns the current optimizer.
 
void configure (const Properties *p) override
 Configures the optimizer from a sub-property if available.
 
void configuration (Properties *p) const override
 Stores the optimizer configuration into a sub-property.
 
- Public Member Functions inherited from Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
 
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
 
Progressprogress () const
 Returns the progress interface if set.
 
virtual int status () const
 Indicates the status of the last call to compute().
 
virtual bool survivesDataDeletion (const Data *) const
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
 
const FactoryInfofactoryInfo () const
 Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
void setFactoryInfo (const FactoryInfo &value)
 Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
Status runAction (const std::string &id)
 Run the action with name id if it exists.
 
const std::vector< Action > & actions ()
 Get a mapping from Action id to Action as registered in this algorithm.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Public Attributes

Signal< const SharedImageSet * > signalDrrDeleted
 This gets called before a stored DRR image is deleted. The argument is the DRR image.
 
Signal signalWeightsChanged
 This signal is emitted whenever the weights are changed.
 
Parameter< ParameterModep_parameterMode = {"parameterMode", ParameterMode::Detector, this}
 Mode of parameters to use.
 
Parameter< DRRModep_drrMode = {"drrMode", DRRMode::Masked, this}
 Whether to compute DRR only in masked regions.
 
Parameter< bool > p_useVolumeMatrix = {"useVolumeMatrix", false, this}
 If true, the volume transformation will be considered.
 
Parameter< bool > p_projMask = {"projMask", false, this}
 Speeds up DRR rendering by considering projection mask.
 
Parameter< bool > p_drrMask = {"drrMask", false, this}
 Flag for using a zero-intensity mask on the DRR.
 
Parameter< bool > p_halfResolution = {"halfResolution", false, this}
 Use DRR with half resolution of reference.
 
Parameter< bool > p_singleFrame = {"singleFrame", false, this}
 Only register a single frame at a time.
 
Parameter< bool > p_multipleDRRs = {"multipleDRRs", false, this}
 Whether to use individual DRRs per frame.
 
- Public Attributes inherited from GeometryGeneratorOptimizingAlgorithm
Parameter< std::stringp_generatorId = {"generatorId", "none", this}
 Id of the generator to install.
 
Parameter< bool > p_sequentialMode = {"sequentialMode", false, this}
 Whether to optimize the parameters of frames sequentially.
 
- Public Attributes inherited from Algorithm
Signal signalOutputChanged
 Signal should be emitted by Algorithms when their output/result has changed.
 
Signal signalParametersChanged
 Signal should be emitted by Algorithms when their parameter configuration has changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Protected Member Functions

 Gl2D3DRegistration (SharedImageSet *data)
 
void initDrr ()
 Creates or re-creates the DRR texture(s) if necessary.
 
- Protected Member Functions inherited from Algorithm
void loadDefaults ()
 
void registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action)
 Register an action to be run via runAction.
 
template<typename D>
void registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void))
 Template version of runAction that can be used with a pointer to a member function.
 
void registerAction (const Action &action)
 Register an action.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 

Protected Attributes

SharedImageSetm_data = nullptr
 The set of cone-beam projections.
 
SharedImageSetm_volume = nullptr
 The CT volume if explicitly available.
 
std::unique_ptr< GlConeBeamForwardm_ownFw
 Owned forward projector, set in the case none was provided at construction.
 
GlConeBeamForwardm_fw = nullptr
 Forward projector, either set to m_ownFw or a projector provided at construction.
 
ConeBeamGeometry m_origPars
 Original CBCT parameters for reset.
 
std::vector< std::unique_ptr< SimilarityMeasureWrapper > > m_sm
 Similarity measure instances.
 
std::vector< std::unique_ptr< SharedImageSet > > m_drrs
 The DRR computed during evaluation. If m_multipleDRRs is set, saves one per focus frame, otherwise only a single drr;.
 
std::unique_ptr< SharedImageSetm_simImg
 LNCC similarity image if used.
 
std::vector< SharedImage * > m_weightImgs
 Optional similarity measure weighting images.
 
bool m_dataNew = false
 Was the CBCT data newly created.
 
std::vector< mat4 > m_relMat
 Relative motion matrices for all frames.
 
std::unique_ptr< SequentialMotionm_seqMot
 Class for thresholding & analysis of sequential motion.
 
std::function< double(int n, const double *x)> m_penaltyFunc
 Optional penalty function.
 
bool m_inDestructor = false
 
- Protected Attributes inherited from GeometryGeneratorOptimizingAlgorithm
std::unique_ptr< ParameterWrapperBasem_paramWrapper
 Parameter wrapper for the optimization.
 
SharedImageSetm_data
 The set of cone-beam projections.
 
std::string m_lastGeneratorId
 The last generator id.
 
- Protected Attributes inherited from OptimizingAlgorithm
std::shared_ptr< Optimizerm_opt
 The optimizer instance.
 
- Protected Attributes inherited from Algorithm
std::string m_name
 Algorithm name.
 
Progressm_progress = nullptr
 Non-owing pointer to a progress interface. May be a nullptr.
 
FactoryInfo m_factoryInfo = {}
 Record describing how this algorithm was instantiated by the AlgorithmFactory.
 
int m_status = Status::Unknown
 Algorithm status after last call to compute()
 
std::vector< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Algorithm interface methods

void compute () override
 Execute the algorithm.
 
OwningDataList takeOutput () override
 Return any new Data that was created by the Algorithm during the last call to compute().
 
static bool createCompatible (const DataList &data, Algorithm **a=0)
 

Configurable interface methods

void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 

Additional Inherited Members

- Static Public Member Functions inherited from Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.
 

Member Enumeration Documentation

◆ ParameterMode

enum class ParameterMode
strong
Enumerator
Detector 

Detector motion.

Iso 

Iso-center motion per frame.

Global 

Global geometry.

◆ DRRMode

enum class DRRMode
strong
Enumerator
Full 

Compute the DRR everywhere (slower).

Masked 

Compute the DRR only in masked regions (faster, but worse for visualisation).

Member Function Documentation

◆ setDrrZeroMask()

void setDrrZeroMask ( bool flag,
int frame = -1 )

If true, zero intensities in the DRR will be ignored by the similarity measure.

If

Parameters
frameis not -1 and m_multipleDRRs is set, the intensity mask is only set for the specified frame.

◆ compute()

void compute ( )
overridevirtual

Execute the algorithm.

Reimplemented from GeometryGeneratorOptimizingAlgorithm.

◆ takeOutput()

OwningDataList takeOutput ( )
overridevirtual

Return any new Data that was created by the Algorithm during the last call to compute().

The default implementation will return an empty list.

Note
Since ownership of the data is transferred, you can call this method only once between calls to compute().

Reimplemented from Algorithm.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.

◆ createDefaultOptimizer()

std::shared_ptr< Optimizer > createDefaultOptimizer ( ) const
overridevirtual

Create suited optimizer depending on parameter mode.

Reimplemented from GeometryGeneratorOptimizingAlgorithm.

◆ evaluate()

double evaluate ( int n,
const double * x,
double * dx = 0 )
overridevirtual

Evaluate the cost function.

Implements CostFunction.

◆ drr()

SharedImageSet * drr ( int frame = -1)

Return the rendered DRR (owned by this class).

Warning:

Parameters
frameis ignored unless m_multipleDRRs is true.

◆ computeDrr() [1/2]

SharedImageSet * computeDrr ( int frame)

Compute DRR for chosen frame and return it The image returned is owned by this class, it is using the same instance for all frames.

*‍/

◆ computeDrr() [2/2]

SharedImageSet * computeDrr ( int frame,
const mat4 & matrix,
bool invert = false )

Compute DRR for chosen frame using the given iso matrix and return it.

The image returned is owned by this class, it is using the same instance for all frames. If the optional invert flag is enabled, a DRR is rendered with the inverse log-conversion setting than the projection data has. *‍/

◆ resetInternalSimilarityImage2()

void resetInternalSimilarityImage2 ( )

Resets the projection image of the internal similarity measure.

This should be called after masks have been added/removed to members of m_data.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close