SNUV_TOMO: 2D CT using SNUV with IRCD
Project tree and description
File/folder | Description |
---|---|
Eigen | C++ template library for linear algebra |
include | Contains self-made functions to save & load Eigen sparse matrices or arrays into & from a binary file; MP.h contains the main IRCD routine. |
objects | Contains different synthetic images to test reconstruction |
settings.h | Specifies the studied object and some important quantities for the forward projection, and some algorithm details |
projection.cpp | Perform the distance-driven projection for the 2D fan-beam geometry |
mainSNUV_IRCD.cpp | Perform reconstruction using Iterative Reweighted Coordinate Descent (IRCD) Algorithm with Smoothed-NUV priors |
mainASDPOCS.cpp | Perform ASDPOCS reconstruction using TV/L1 regularization |
transformer.cpp | Transform normal images into binary files |
CMakeLists.txt | CMake file used to generate a Makefile |
Before running the applications
-
Create 4 folders build, projections, reconstructions and reconstructions/intermediate_results.
-
Open a terminal and check the version of CMake installed on your computer with the command cmake -version. If the version is below 3.0 then modify the first line of CMakeLists.txt.
-
Attention: OPENCV dependencies needed!!! Try to install opencv first.
Example
The objects folder contains different, for example, the binary file SheppLogan256_UltraGrad corresponds to a Shepp-Logan phantom with gradient of dimension 256 x 256, flattened column-wise (if a pixel has coordinates (m,n) with 0 <= m,n <= 255 then it has index m + 255*n in the flattened image).
As a first example you can project this phantom and reconstruct it from the projections using SNUV_IRCD or ASDPOCS reconstruction methods.
First you have to compile the different applications listed in the CMake file (CMakeLists.txt):
-
Open a Terminal window
-
Access the build folder: cd path/to/SNUV_TOMO/build/
-
Run the command cmake .. to create Makefile from CMakeLists.txt.
-
Run the command make to compile all the applications at once. If you want to compile just one application, say PROJECTION, then run the command make PROJECTION.
After step 4, you should have 4 applications in the build folder (the files PROJECTION, ASDPOCS, SNUV_IRCD, TRANSFORMER).
Now you can project the phantom and use the projection to reconstruct the image:
-
Open a Terminal window.
-
Access the build folder: cd path/to/SNUV_TOMO/build/.
-
If the input image is not binary, please first run ./TRANSFORMER to transform it into binary files.
-
Run the command ./PROJECTION to perform the distance-driven projection for the different angles specified in the header settings.h. The resulting projection vector and projection matrix are saved in 2 separate binary files located in the projections folder.
-
The maximal iteration number of IRCD, and whether the intermediate results should be saved, can be specified in settings.h.
-
Run the commands ./SNUV_IRCD and ./ASDPOCS to reconstruct the image from the projection vector using SNUV_IRCD and TV_ASDPOCS, respectively. The reconstructions are saved in binary & png files located in the reconstructions folder.