RTK/Meetings/TrainingNov15: Difference between revisions

From Openrtk
Jump to navigation Jump to search
Line 91: Line 91:
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running  
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running  


   rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10
   'rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10'

Revision as of 08:37, 26 October 2015

Here is a list of the RTK command lines you will have to run during the training, along with the data you will need. To start, download the following CT data and a relevant Cone-Beam CT geometry file.

Forward projection

To forward project the CT volume, following the geometry described in geometry.xml, run

 rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml

Look at the result using vv

 vv projections.mha

There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available here. Run the following command line

 rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml

You can check with vv that the file contains only one projection

 vv singleProjection.mha

Back projection

Start by back projecting a single projection. Run

 rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml

Observe the result with vv

 vv singleBackProjection.mha

As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running

 rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml

Look at the result with vv. In order to compare it with the original image, run

 vv backProjection.mha muCT.mha --linkall

Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.

Using different forward and back projection algorithms

Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines

 rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph
 rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator

And for back projection

 rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection
 rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph
 rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph

If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following

 rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast
 rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast
 rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection

Iterative reconstruction algorithms

Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.

Start by downloading the cone beam CT projection data here, and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing

 vv --sequence *.his

RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run

 rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"

The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running

 rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5

This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.

The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running

 rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3

Another popular technique uses the conjugate gradient algorithm

 rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10

You can compare the results by running

 vv SART.mha CG.mha --linkall

The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running

 'rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10'