![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/CT/GridBasedDistortionCorrection.h>
Grid-based distortion correction algorithm for X-ray images. More...
Grid-based distortion correction algorithm for X-ray images.
Detects regular bead grid patterns and computes displacement field for distortion correction. Optionally bakes in the image deformation(distortion) and performs bead inpainting.
Public Types | |
| enum class | BeadDetectionMode { HoughTransform , MorphologicalClosing , OpenCV , None } |
| Bead detection strategy for grid pattern recognition. More... | |
| enum class | DeformationBasis { None , Zernike , ThinPlateSpline } |
| using | BeadDetection = GridBasedDistortionCorrectionUtils::BeadDetection |
| 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 | |
| GridBasedDistortionCorrection (SharedImageSet &projections) | |
| Algorithm::Status | detectBeadsHoughTransform () |
| Algorithm::Status | getGridParams () |
| Algorithm::Status | detectBeadsBasedOnGridParams () |
| Algorithm::Status | addMissingDetections () |
| Algorithm::Status | detectGrid () |
| Algorithm::Status | inpaintBeads () |
| void | flipProjection (int index) |
| bool | isInsideCropRadius (const vec2 &positionPx, int frame) |
| 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(). | |
| SharedImageSet & | projections () |
| SharedImageSet & | resampledProjections () |
| void | setBeadsCenters (std::vector< std::vector< BeadDetection > > beadCenters) |
| const std::optional< std::vector< std::vector< BeadDetection > > > & | beadCenters () const |
| void | setLatticeToBeads (std::vector< mat3 > &latticeToBeads) |
| Linear transformation of integer lattice \(Z^2\) to the beads. | |
| const std::vector< std::optional< mat3 > > & | latticeToBeads () const |
| std::vector< Tensor< 1 > * > | tensorsForDebugPlots () |
| Returns tensors that can be plotted by the controller in debug mode Returns plot of radon transform intensity along the direction (of the radon transform image) In the algorithm, this is used to determine the grid spacing In debug mode, this is visualized in the controller. | |
| 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 | configure (const Properties *p) |
| Configure this object instance by de-serializing the given Properties. | |
| virtual void | configuration (Properties *p) const |
| Serialize the current object configuration into the given Properties object. | |
| 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 |
Static Public Member Functions | |
| static bool | createCompatible (const DataList &data, Algorithm **a) |
| static void | cleanDetectionsFrame (SharedImage &frame, std::vector< BeadDetection > &detectionsInOut, double maxBeadRadiusRel, std::optional< double > medianRadius=std::nullopt) |
| static std::unique_ptr< SharedImageSet > | createInpaintingMask (SharedImageSet &projections, const std::vector< std::vector< BeadDetection > > &beadCenters, int paddingPx=2) |
| 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< BeadDetectionMode > | p_beadDetectionMode = {"beadDetectionMode", BeadDetectionMode::MorphologicalClosing, this} |
| Method to detect beads. | |
| Parameter< bool > | p_applyDeformation = {"applyDeformation", true, this} |
| Whether or not to bake in the deformation that performs the distortion correction. | |
| Parameter< bool > | p_cleanBeads = {"cleanBeads", true, this} |
| If set to false, the median bead radius is used for all beads. | |
| Parameter< bool > | p_inpaintBeads = {"inpaintBeads", true, this} |
| Whether or not to inpaint beads. | |
| Parameter< double > | p_maxRelativeDistortion = {"maxRelativeDistortion", 0.25, this} |
| Maximum relative distortion allowed in the grid. Correspondences that deviate from the grid by more than this value are discarded. | |
| Parameter< bool > | p_debugMode = {"debugMode", false, this} |
| If true, writes point detections to DataLogger and bead image and its radon transform to the output. | |
| Parameter< bool > | p_addMissingDetections = {"addMissingDetections", false, this} |
| If true, adds interior detections to the bead centers by registering a template bead image to the image at the expected bead location. | |
| Parameter< DeformationBasis > | p_deformationBasisFunction = {"deformationBasisFunction", DeformationBasis::Zernike, this} |
| Basis function of deformation field. | |
| Parameter< bool > | p_sameGridForAllFrames = {"sameGridForAllFrames", false, this} |
| Use same grid for all frames. | |
| Parameter< int > | p_minBeadsPerFullRow = {"minBeadsPerFullRow", 3, this} |
| Minimum number of beads per row. | |
| Parameter< int > | p_maxBeadsPerFullRow = {"maxBeadsPerFullRow", 20, this} |
| Maximum number of beads per row. | |
| Signal | signalDetectionsChanged |
| Signal emitted when the set of bead detections has changed. | |
| Signal | signalLatticeChanged |
| Signal emitted when the lattice has changed. | |
| Signal | signalRadonTransformSliceChanged |
| Signal emitted when the peak image has 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. | |
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 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. | |
|
strong |
|
strong |
|
overridevirtual |
Execute the algorithm.
Implements ImFusion::Algorithm.
|
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.