How to set projection matrices in XRay2D3DRegistrationAlgorithm

Hello Christian,
I get Idea for implementation with ImFusion SDK from “GitHub - ImFusionGmbH/public-demos: Example projects showcasing usage and integration of the ImFusion SDK
As I am started Implementation and have a small query that’s while I am writing here
to verify my steps code few code snippet I want from you additionally

  1. read the OpenCV Style projection matrix from text file
  2. Get the ‘Shots With Geometry’ means after the read of Projection matrix and Image data we need to
    combine the Image Shots (AP & LAT) with Projection matrix
    so the use into
    ImFusion::CT::XRay2D3DRegistrationAlgorithm* xrayRegistAlg = new ImFusion::CT::XRay2D3DRegistrationAlgorithm(shotsWithGeom, volume);

std::unique_ptrImFusion::SharedImageSet shotsWithGeom
ImFusion::SharedImageSet &volumes

Actually I read AP & LAT image data, Volume and load the projection matrix (in text file format)
but didn’t get how to set the projection matrix to AP and LAT Image data so that able to use into ImFusion::CT::XRay2D3DRegistrationAlgorithm after initialization
so I request you please provide your code snippet so that I will able to verify and proceed

Thank You

I request, your code snippet for

  1. Read the projection matrix (OpenCV Style projection matrix)

  2. get the ShotWithGeometry (Actually want AP and LAT Image data with their respective projection matrix)

  3. convert to cone beam geometry for AP and LAT

so that next apply the XRay2D3DRegistraitonAlgorithm(ShotsWithGeometry, volume)

Thank you

Hi Ravi,
Since you wanted to develop a registration application using Cpp at your side, I assume you also have access to our SDK documentation.
If you don’t have it, please get back to us directly via email so we can find a solution for the issue.
Now, if you have SDK documentation, then you can find the answers for your questions as below:

  1. To read the projection matrix (openCV style), you can use loadMatrices function in the ConeBeamGeometry class.
    In general you can find detail of how we define the geometry, what are the meaning of different matrices, and code snippet to load matrices in our SDK documentation under: Plugins >> ImFusionCT Module >> Cone Beam Geometry (for general information), and ConeBeamGeoemtry for the API.
  2. Please see Xray2D3DRegistrationAlgorithm section in our SDK for more detail of the usage.
    In general, you would need:
  • shots, stored as a SharedImageSet, and having ConeBeamGeometry as data component. You can also use CT::Utils namespace as helpers to create a SharedImageSet`` container for your data with a ConeBeamGeometry``` component.
  • volume, also stored as a SharedImageSet
  1. We have ConvertToConeBeamData algorithm to do so.

Here are the protype code as an example. But please do refer to our SDK documentation for full functionalities.

/// including necessary headers

// creating a sis container preparing for preprocessing
// ap and lat are 2 SharedImageSet storing your original AP/LAT data
auto sis = std::make_unique<SharedImageSet>();
// preprocess the data, convert sis to ConeBeamData using ConvertToConeBeamData algorithm 
// please do add some sanity check if the ```alg``` is instantiated properly and ```out``` is valid
auto alg = std::make_unique<ConvertToConeBeamData>(*sis);
auto out = alg->takeOutput().extractFirstImage();

// get geometry and load the matrices
ConeBeamGeometry& geom = CT::Utils::getConeBeamMetadata(*out).geometry();
geom.loadMatrices("path_to_matrice_file", width, height); // width, height are pixels size of your images 
geom.useMatrices = true; 

Hope this can help.