how to perform CBCT 3D reconstruction given a squence of 2D .raw X-ray images and corresponding projection matrices

I want to do this work in The Reconstruction Toolkit, and I know how to use a .mha file to reconstruction. But i do not know how to store .raw image sequence into a .mha file(or multiple if possible) with correct origin and direction.
In RTK 3D circular projection geometry (http://www.openrtk.org/Doxygen/DocGeo3D.html), the v-axis of the physical coordinate system is opposite to the v-axis of the image.
The size of X-ray image is 1408×1408, the pixelsize is 0.308. I want to set the origin of the physical coordinates at the center of the image.

How to set origin,direction? OR to recommend a tool that is better than RTK.

1 Like

In RTK, the stack of projection images is read as a 3D image (itk::Image<float, 3>). If you want to set the origin of the coordinate system at the center of the projection image, you need to set itk::Image<float, 3>::m_Origin (with itk::Image<float, 3>::SetOrigin) to -0.5*(number of pixels -1)* spacing, i.e. -0.5 * 1407 * 0.308=-216.678 for the first and second coordinates. The third coordinate is not used by RTK. The direction can be set to identity.

I don’t see why you think that “the v-axis of the physical coordinate system is opposite to the v-axis of the image”? This is not what the documentation drawing indicate at least.

I can try to help if you share your projection matrices and a set of data.

Thanks for your answer.
In the RTK WIKI, RTK: RTK 3D circular projection geometry. 9 geometric parameters can determine a camera. In 2D image, u→,v↓ . But in this 3D circular geometry, u→, v↑. why?
I can get projection matrice by using DLT and optimization. But in pinhole model, u→, v↓. can i input this kinds of projection matrice?

I really need your help. My email is zx694040645@outlook.com

Thanks for your answer.
In the RTK WIKI, RTK: RTK 3D circular projection geometry. 9 geometric parameters can determine a camera. In 2D image, u→,v↓ . But in this 3D circular geometry, u→, v↑. why?
I can get projection matrice by using DLT and optimization. But in pinhole model, u→, v↓. can i input this kinds of projection matrice?

I really need your help. My email is zx694040645@outlook.com

I believe you can describe any projection geometry, possibly with negative SourceToDetectorDistance and SourceToIsocenterDistance. If the only problem is the orientation of v, you can use a 180° OutOfPlaneAngle.

First of all, we set the origin at the center of X-ray image for convenience.

In 3D CIRCULAR PROJECTION GEOMETRY of RTK, the directions of u v is u→, v↑, seen in the picture.

The direction of uv of a 2D image in ITK is u→v↓ , like this:
image

For a pinhole model and Direct linear transform, the model is like this :

.

The world coordinate system of pinhole model is different from 3DCIRCULARPROJECTIONGEOMETRY but this difference doesnt matter in this problem because I pre-process 3D points.

I got a Master’s degree in Pure Mathematics so that donot worry about my knowledge about 3D geometry. I can transform these parameter from two models (pinhole and RTK) and verified through simulation experiments.

According to my understanding, there are two methods using rtkfdk.exe:

  1. input projection matrice from DLT, do not set --newdirection. (In this case, I always get a negative SID in XML.)
    70a4c818fcdf50cb0ae37ef3d8c53c7f
    |-245.552456178466|-1.32595721624889|-1519.50095868829|8164.02834122301|
    |—|—|—|—|
    |-11.6382782563406|-1539.16490184778|3.25659871589372|4847.29978914652|
    |-0.986422424313713|0.00336677752224844|0.164193378734263|1031.67061077634|

  2. get projection matrice by DLT, transform DLT results to get 9 geometric parameters or M_p in RTK: RTK 3D circular projection geometry, input 9 parameters or M_p, set - newdirection 1 0 0, 0 -1 0, 0 0 1.

(tips: If the Y-axis of the world coordinates coincides with the rotation axis of CBCT system, the i-th gantry angle can be set 360°/imagenum*(i-1), the other 8 parameters are the same for all images.)

I think the projection matrice of M_p is different from the projection matrice obtained by DLT because the direction of v in these 2 models are different.

First of all, we set the origin at the center of X-ray image for convenience.

In 3D CIRCULAR PROJECTION GEOMETRY of RTK, the directions of u v is u→, v↑, seen in the picture.

The direction of uv of a 2D image in ITK is u→v↓ , like this:
image

For a pinhole model and Direct linear transform, the model is like this :

.

The world coordinate system of pinhole model is different from 3DCIRCULARPROJECTIONGEOMETRY but this difference doesnt matter in this problem because I pre-process 3D points.

I got a Master’s degree in Pure Mathematics so that donot worry about my knowledge about 3D geometry. I can transform these parameter from two models (pinhole and RTK) and verified through simulation experiments.

According to my understanding, there are two methods using rtkfdk.exe:

  1. input projection matrice from DLT, do not set --newdirection. (In this case, I always get a negative SID in XML.)
    70a4c818fcdf50cb0ae37ef3d8c53c7f
    |-245.552456178466|-1.32595721624889|-1519.50095868829|8164.02834122301|
    |—|—|—|—|
    |-11.6382782563406|-1539.16490184778|3.25659871589372|4847.29978914652|
    |-0.986422424313713|0.00336677752224844|0.164193378734263|1031.67061077634|
  2. get projection matrice by DLT, transform DLT results to get 9 geometric parameters or M_p in RTK: RTK 3D circular projection geometry, input 9 parameters or M_p, set - newdirection 1 0 0, 0 -1 0, 0 0 1.

(tips: If the Y-axis of the world coordinates coincides with the rotation axis of CBCT system, the i-th gantry angle can be set 360°/imagenum*(i-1), the other 8 parameters are the same for all images.)

I think the projection matrice of M_p is different from the projection matrice obtained by DLT because the direction of v in these 2 models are different.
[/quote]

1 Like

Thanks for the report. Are you actually able to achieve what you want now?

I cannot input .raw image on my computer, I now search for a method to transform .raw into .dcm or .mha. IMAGEJ and XMEDCON cannot work.

You simply have to write a .mhd header file. There are several solutions to do this, one is in Python, read in the raw file with numpy and convert it with the itk.image_from_array function.

1 Like

You can also write .mhd header file by hand. Instructions are in MetaImage documentation.