![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/CT/XRay2D3DRegistrationAlgorithm.h>
High-level 2D-3D registration algorithm for X-ray projections. More...
High-level 2D-3D registration algorithm for X-ray projections.
Supports cone-beam and fan-beam (linear pushbroom) projection geometries. Wraps Gl2D3DRegistrationAlgorithm with initialization and parameter management. Supports multiple initialization modes including manual, point-direction, and keypoint-based.
Public Types | |
| enum class | InitializationMode { Noop = 0 , PointDirection = 1 , KeyPoints = 2 , Custom = 3 , Last = Custom } |
| using | ComputationPhase = XRay2D3DRegistrationHistoryEntry::ComputationPhase |
| 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 | |
| XRay2D3DRegistrationAlgorithm (SharedImageSet &shotsWithGeom, SharedImageSet &volumes) | |
| Constructor, compounds volumes if there are several. | |
| XRay2D3DRegistrationAlgorithm (std::unique_ptr< SharedImageSet > shotsWithGeom, SharedImageSet &volumes) | |
| This constructor takes ownership of shotsWithGeom. | |
| ~XRay2D3DRegistrationAlgorithm () override | |
| Destructor. | |
| virtual bool | initialize () |
| Calls algorithm to use for initialization. | |
| virtual bool | canInitialize () |
| Returns true if there is sufficient data to call initialize(). | |
| bool | hasInitialized () |
| const std::optional< ConeBeamGeometry > & | lastInitializationResult () |
| Return the ConeBeamGeometry obtained after the last successful (i.e. | |
| GeometryGenerator * | lastGeomGenerator () const |
| Return last geometry generator to restore the geometry in the manual initiation mode. | |
| void | compute () override |
| Execute the algorithm. | |
| OwningDataList | takeOutput () override |
| Returns a ConeBeamData object representing the owned shots; the pose of the volume is modified in place. | |
| bool | survivesDataDeletion (const Data *data) const override |
| Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list. | |
| void | configure (const Properties *p) override |
| Properties interface. | |
| void | configuration (Properties *p) const override |
| Serialize the current object configuration into the given Properties object. | |
| void | finalizeRegistration () |
| Finalizes Registration and moves matrix from m_shotsWithGeom to m_volumes and add a TransformationStash entry. | |
| SharedImageSet & | shotsWithGeom () |
| Getter for m_shotsWithGeom. | |
| const SharedImageSet & | shotsWithGeom () const |
| ConeBeamGeometry & | shotsWithGeomGeom () |
| Getter for the geometry of m_shotsWithGeom. | |
| const ConeBeamGeometry & | shotsWithGeomGeom () const |
| SharedImageSet * | ownedShotsWithGeom (int i=0) |
| Getter for projections owned by this algorithm. | |
| SharedImageSet * | ownedVolumes () |
| Getter for m_ownedVolumes, i.e. the compounded input volumes in case multiple volumes where provided. | |
| SharedImageSet & | volumes () |
| Getter for m_volumes, i.e. either m_ownedVolumes.get() or the volume passed via the constructor if it was a single volume. | |
| const SharedImageSet & | volumes () const |
| ConeBeamGeometryAlgorithm * | coneBeamGeomAlg () |
| Getter for a ConeBeamGeometryAlgorithm used internally. | |
| Gl2D3DRegistration & | nestedRegAlg (int i=0) |
| Getter for a Gl2D3DRegistration used internally. | |
| MaskEditor & | maskAlg () |
| Getter for a MaskEditor used internally. | |
| int | numShots () const |
| Getter and setter methods, see the member variables for further documentation. | |
| SharedImageSet * | volumesIn () |
| const SharedImageSet * | volumesIn () const |
| vec3 | rotationCenter () |
| Convenience methode to get rotation center, this is derived from the ConeBeamGeometry of resolution level 0. | |
| void | setRotationCenter (vec3 rotationCenter) |
| Convenience methode to set rotation center, this is derived from the ConeBeamGeometry. | |
| XRay2D3DRegistrationInitializationPointDirection * | initPointDirection () |
| XRay2D3DRegistrationInitializationKeyPoints * | initKeyPoints () |
| XRay2D3DRegistrationInitialization * | customInitialization () |
| void | setCustomInitialization (std::unique_ptr< XRay2D3DRegistrationInitialization > &&customInit) |
| void | updateMasks (std::optional< int > index={}) |
| This function updates masks of lower-resolution representations. | |
| void | saveOptimizationResult () |
| Propagates the ConeBeamGeometry from the current resolution level to other resolution levels. | |
| std::deque< XRay2D3DRegistrationHistoryEntry > & | history () |
| int | saveCurrentConfigurationToHistory (ComputationPhase computationPhase, const std::string &comment="") |
| Save the current configuration to the history. | |
| XRay2D3DRegistrationHistoryEntry | currentConfigurationToHistoryEntry (ComputationPhase computationPhase, const std::string &comment="") const |
| bool | loadHistory (int index) |
| Revert geometry to specific history entry given by id (with petmitClearMasks=true). | |
| bool | loadHistory (const XRay2D3DRegistrationHistoryEntry &entry, bool permitClearMasks) |
| 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(). | |
| 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. | |
Static Public Member Functions | |
| static bool | createCompatible (const DataList &data, Algorithm **a=nullptr) |
| If data is compatible with algorithm return true. If a is not zero, create algorithm with input data. | |
| 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. | |
Public Attributes | |
| Parameter< std::string > | p_anatomyName = {"anatomyName", "", this} |
| Name used for storing the registration matrices in the TransformationStashDataComponent of m_volumes (the prefix "eos2d3d_" will be added). | |
| Parameter< int > | p_numResolutionLevels = {"numResolutionLevels", 3, this} |
| Support for multiple resolution levels. | |
| Parameter< int > | p_currentResolutionLevel = {"currentResolutionLevel", 1, this} |
| Current resolution level e.g. shown in the controller. | |
| Parameter< InitializationMode > | p_initializationMode = {"initializationMode", InitializationMode::Noop, this} |
| Options related to initialization. | |
| Parameter< bool > | p_initialized = {"initialized", false, this} |
| Whether or not we have initialized the registration yet. | |
| SubProperty< std::unique_ptr< GeometryAlgorithm > > | p_geomAlg = {"geomAlg", nullptr, this} |
| Nested geometry algorithm. | |
| Signal | signalGeometryChanged |
| After making a change that affects the Cone-Beam-Geometry, emit this signal. | |
| Signal< int > | signalResolutionLevelChanged |
| This signal is emitted by this algorithm whenever the resolution level has changed or the image pyramid is recomputed. | |
| Signal | signalMasksChanged |
| This signal is emitted whenever the masks are changed. | |
| Signal | signalHistoryChanged |
| This signal is emitted by this algorithm whenever the history is changed. | |
| 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 Attributes | |
| Parameter< int > | p_currentHistoryEntry = {"currentHistoryEntry", 0, this} |
| Current history entry. Warning: including this in configure/configuration will cause the history to reset to that history entry. | |
| int | m_numShots |
| How many shots we have, for most cases this is 2. | |
| std::vector< std::unique_ptr< XRay2D3DRegistrationInitialization > > | m_initializationAlgs |
| SharedImageSet * | m_volumesIn |
| Input volumes. | |
| SharedImageSet * | m_volumes |
| Input volumes, compounded if neccessary. | |
| mat4 | m_relativePose = mat4::Identity() |
| If we compound, this is the relative pose between m_volumesIn[0] and m_volumes, i.e. | |
| std::unique_ptr< SharedImageSet > | m_ownedVolumes |
| Contains compounded volumes if we need to create them. | |
| std::unique_ptr< ConeBeamGeometryAlgorithm > | m_coneBeamGeomAlg |
| Nested ConeBeamGeometryAlgorithm. | |
| std::unique_ptr< MaskEditor > | m_maskAlg |
| Nested MaskEditor algorithm to set a mask (usually a CroppingMask) to the 2D shots. | |
| std::vector< std::unique_ptr< ImagePyramid > > | m_projectionsImagePyramid |
| This holds the ImagePyramid instances used for computing representations of shots at lower resolution levels. | |
| std::vector< std::unique_ptr< ImagePyramid > > | m_weightsImagePyramid |
| This holds the ImagePyramid instances used for computing representations of weights at lower resolution levels. | |
| std::vector< std::unique_ptr< Gl2D3DRegistration > > | m_nestedRegAlgs |
| Nested 2D3D registration instances. | |
| std::vector< std::unique_ptr< SharedImageSet > > | m_ownedShotsWithGeom |
| Owned projections. | |
| SharedImageSet * | m_shotsWithGeom = nullptr |
| Input shots. | |
| std::optional< ConeBeamGeometry > | m_lastInitializationResult |
| 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. | |
Additional Inherited Members | |
| 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. | |
|
strong |
| ImFusion::CT::XRay2D3DRegistrationAlgorithm::XRay2D3DRegistrationAlgorithm | ( | SharedImageSet & | shotsWithGeom, |
| SharedImageSet & | volumes ) |
Constructor, compounds volumes if there are several.
shotsWithGeom and volumes must keep existing during the lifetime of the algorithm
|
inline |
Return the ConeBeamGeometry obtained after the last successful (i.e.
did not return std::optional()) call to initialize().
|
overridevirtual |
Execute the algorithm.
Implements ImFusion::Algorithm.
|
overridevirtual |
Returns a ConeBeamData object representing the owned shots; the pose of the volume is modified in place.
Ownership of this object is released, but this class retains a pointer to it; it should therefore not be deleted as long as the algorithm is still being used.
Reimplemented from ImFusion::Algorithm.
|
overridevirtual |
Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
Reimplemented from ImFusion::Algorithm.
|
overridevirtual |
Properties interface.
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.
| void ImFusion::CT::XRay2D3DRegistrationAlgorithm::setRotationCenter | ( | vec3 | rotationCenter | ) |
Convenience methode to set rotation center, this is derived from the ConeBeamGeometry.
Emits signalGeometryChanged
| void ImFusion::CT::XRay2D3DRegistrationAlgorithm::updateMasks | ( | std::optional< int > | index = {} | ) |
This function updates masks of lower-resolution representations.
This function emits the signalMasksChanged signal
| int ImFusion::CT::XRay2D3DRegistrationAlgorithm::saveCurrentConfigurationToHistory | ( | ComputationPhase | computationPhase, |
| const std::string & | comment = "" ) |
Save the current configuration to the history.
Returns the (nonnegative) id of the added entry on success, -1 on failure
| bool ImFusion::CT::XRay2D3DRegistrationAlgorithm::loadHistory | ( | int | index | ) |
Revert geometry to specific history entry given by id (with petmitClearMasks=true).
Returns true on success
| Parameter<std::string> ImFusion::CT::XRay2D3DRegistrationAlgorithm::p_anatomyName = {"anatomyName", "", this} |
Name used for storing the registration matrices in the TransformationStashDataComponent of m_volumes (the prefix "eos2d3d_" will be added).
For the initalization we use the name "eos2d3d_" + anatomyName + "init" and "eos2d3d_" + anatomyName + "reg" for the registration result
| Parameter<int> ImFusion::CT::XRay2D3DRegistrationAlgorithm::p_numResolutionLevels = {"numResolutionLevels", 3, this} |
Support for multiple resolution levels.
Internally, we use an ImagePyramid object with p_numResolutionLevels levels In compute(), registration is first performed on projections at the lowest resolution level, and then on the highest resolution level.
| Signal ImFusion::CT::XRay2D3DRegistrationAlgorithm::signalGeometryChanged |
After making a change that affects the Cone-Beam-Geometry, emit this signal.
The controller listens to this signal and updates the scene.
| Signal<int> ImFusion::CT::XRay2D3DRegistrationAlgorithm::signalResolutionLevelChanged |
This signal is emitted by this algorithm whenever the resolution level has changed or the image pyramid is recomputed.
The parameter is the new resolution level.
|
protected |
If we compound, this is the relative pose between m_volumesIn[0] and m_volumes, i.e.
it maps m_volumesIn->matrixToWorld(0) to m_volumes->matrixToWorld()
|
protected |
Nested 2D3D registration instances.
Correspond to levels of the resolution image pyramid, where 0 is the original resolution. First element - at the highest resolution - is created at construction and does not change, further elements are created from downsampled projections.
|
protected |
Owned projections.
First element is either nullptr (if the algorithm doesn't own the full-resolution ConeBeamGeometry object passed to it), or a suitable (owning) pointer to the full-resolution data. Further elements contain downsampled projections.