![]() |
ImFusion C++ SDK 4.4.0
|
#include <ImFusion/CT/Gl2D3DRegistration.h>
OpenGL-accelerated 2D-3D registration for cone-beam projections. More...
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 ImFusion::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. | |
| SimilarityMeasureWrapper & | similarityMeasure () |
| 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 ConeBeamGeometry & | origPars () |
| Retrieve saved copy of the original parameters. | |
| std::shared_ptr< Optimizer > | createDefaultOptimizer () 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. | |
| SharedImageSet * | drr (int frame=-1) |
| Return the rendered DRR (owned by this class). | |
| int | numDRRs () |
| Return the number of DRR images managed by this class. | |
| SharedImageSet * | similarityImage () |
| Return the last computed local similarity map if available (owned here, LNCC mode only). | |
| 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. | |
| SharedImageSet * | computeDrr (int frame, const mat4 &matrix, bool invert=false) |
| Compute DRR for chosen frame using the given iso matrix and return it. | |
| SharedImageSet * | data () |
| Return pointer to the used cone-beam data. | |
| const std::vector< mat4 > & | relativeMatrices () const |
| Access to the relative transformation matrices after optimization. | |
| SequentialMotion & | seqMotion () |
| Access to the sequential motion class. | |
| void | resetInternalSimilarityImage2 () |
| Resets the projection image of the internal similarity measure. | |
| Public Member Functions inherited from ImFusion::CT::GeometryGeneratorOptimizingAlgorithm | |
| GeometryGeneratorOptimizingAlgorithm (SharedImageSet *data) | |
| Constructor. | |
| Public Member Functions inherited from ImFusion::OptimizingAlgorithm | |
| void | setOptimizer (std::shared_ptr< Optimizer > opt) |
| Set an optimizer from outside. | |
| std::shared_ptr< Optimizer > | optimizer () |
| 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 ImFusion::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. | |
| Progress * | progress () 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 FactoryInfo & | factoryInfo () 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 ImFusion::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 | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
| Public Member Functions inherited from ImFusion::SignalReceiver | |
| SignalReceiver ()=default | |
| Default constructor. | |
| SignalReceiver (const SignalReceiver &other) | |
| Copy constructor, does not copy any existing signal connections from other. | |
| SignalReceiver & | operator= (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< ParameterMode > | p_parameterMode = {"parameterMode", ParameterMode::Detector, this} |
| Mode of parameters to use. | |
| Parameter< DRRMode > | p_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 ImFusion::CT::GeometryGeneratorOptimizingAlgorithm | |
| Parameter< std::string > | p_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 ImFusion::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 ImFusion::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 ImFusion::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 ImFusion::SignalReceiver | |
| void | disconnectAll () |
| Disconnects all existing connections. | |
Protected Attributes | |
| SharedImageSet * | m_data = nullptr |
| The set of cone-beam projections. | |
| SharedImageSet * | m_volume = nullptr |
| The CT volume if explicitly available. | |
| std::unique_ptr< GlConeBeamForward > | m_ownFw |
| Owned forward projector, set in the case none was provided at construction. | |
| GlConeBeamForward * | m_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< SharedImageSet > | m_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< SequentialMotion > | m_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 ImFusion::CT::GeometryGeneratorOptimizingAlgorithm | |
| std::unique_ptr< ParameterWrapperBase > | m_paramWrapper |
| Parameter wrapper for the optimization. | |
| SharedImageSet * | m_data |
| The set of cone-beam projections. | |
| std::string | m_lastGeneratorId |
| The last generator id. | |
| Protected Attributes inherited from ImFusion::OptimizingAlgorithm | |
| std::shared_ptr< Optimizer > | m_opt |
| The optimizer instance. | |
| Protected Attributes inherited from ImFusion::Algorithm | |
| std::string | m_name |
| Algorithm name. | |
| Progress * | m_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< Action > | m_actions |
| Map of key given by the id of the action, of the available actions of this algorithm. | |
| Protected Attributes inherited from ImFusion::Configurable | |
| std::vector< Param > | m_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 ImFusion::Algorithm | |
| static bool | createCompatible (const DataList &data, Algorithm **a=nullptr) |
| Factory function to check algorithm compatibility with input data and optionally instantiate it. | |
|
strong |
|
strong |
| void ImFusion::CT::Gl2D3DRegistration::setDrrZeroMask | ( | bool | flag, |
| int | frame = -1 ) |
If true, zero intensities in the DRR will be ignored by the similarity measure.
If
| frame | is not -1 and m_multipleDRRs is set, the intensity mask is only set for the specified frame. |
|
overridevirtual |
Execute the algorithm.
Reimplemented from ImFusion::CT::GeometryGeneratorOptimizingAlgorithm.
|
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.
Reimplemented from ImFusion::Algorithm.
|
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.
Reimplemented from ImFusion::Configurable.
|
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.
Reimplemented from ImFusion::Configurable.
|
overridevirtual |
Create suited optimizer depending on parameter mode.
Reimplemented from ImFusion::CT::GeometryGeneratorOptimizingAlgorithm.
|
overridevirtual |
Evaluate the cost function.
Implements ImFusion::CostFunction.
| SharedImageSet * ImFusion::CT::Gl2D3DRegistration::drr | ( | int | frame = -1 | ) |
Return the rendered DRR (owned by this class).
Warning:
| frame | is ignored unless m_multipleDRRs is true. |
| SharedImageSet * ImFusion::CT::Gl2D3DRegistration::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.
*/
| SharedImageSet * ImFusion::CT::Gl2D3DRegistration::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. */
| void ImFusion::CT::Gl2D3DRegistration::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.