Source Code

A project log for X-Ray CT Scanner

Tomographic scanner using my X-Ray machine, a simple motor to rotate the object and a reconstruction software

francisco-piernasFrancisco Piernas 02/14/2019 at 17:513 Comments

Here is the version 1.0 of the code:

Read the instructions, although I have done my best to make the code very simple to use. It's possible to reconstruct a sinogram image in just 5 lines of code: 

Mat sinogram=imread("sinogram.jpg",IMREAD_COLOR); //load the sinogram image "sinogram.jpg"
Mat filtered_sinogram=filter_sinogram(sinogram); //filter the sinogram
Mat reconstruction=iradon(filtered_sinogram,false); //perform back projection. Change false to true if sinogram is a full turn
renormalize255_frame(reconstruction); //normalize to 255
imwrite("Reconstruction.jpg",reconstruction); //save reconstruction

You can also download the videos I've posted to try the code to perform a 3D reconstruction.

I strongly recommend to use Cloud Compare to open the saves point cloud "" that the code creates.


Ted Yapo wrote 02/16/2019 at 15:28 point

Awesome job on this! I cloned the code from GitHub, and yes, I did get it working in 5 minutes. However, the selectROI() function has been removed from the latest OpenCV versions, and I ended up replacing the returned Rect2d with the full image extents to test on 2D reconstructions.

EDIT: my mistake: 3.x is not the latest; the function is back in 4.0.

  Are you sure? yes | no

Francisco Piernas wrote 02/16/2019 at 16:06 point

Well that's strange, I was using openCV V4.0.0, isn't it the latest version? Also thank you so much for trying the code, any opinion and advice is highly appreciated!

  Are you sure? yes | no

Ted Yapo wrote 02/16/2019 at 16:46 point

Yep, you're absolutely right, it is in 4.0. It used to be in the tracker module in early versions, then it looks like it got removed in the middle of 3.x, and didn't re-appear in the high-level GUI module (where it really belongs) until 4.0 or so.

I'm used to thinking of 3.x as the latest. I've been wrong since November :-)

  Are you sure? yes | no