RTK/Meetings/TrainingNov15: Difference between revisions

From Openrtk
Jump to navigation Jump to search
 
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Geometry =
== Real ==
Edit and analyze the [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file] obtained from a real Elekta Synergy acquisition. Compare to the [http://midas3.kitware.com/midas/download/item/208648/projections.tgz projection files] using the command
<source lang="bash" enclose="div">
vv --sequence *his
</source>
(VV help: F1).
== Simulated ==
Use the command line application rtksimulatedgeometry to generate simulated geometries and analyze the outputs. (Help: rtksimulatedgeometry -h).
= Basic operators =
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.
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 [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].
Line 6: Line 22:
To forward project the CT volume, following the geometry described in geometry.xml, run
To forward project the CT volume, following the geometry described in geometry.xml, run


  rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml
<source lang="bash" enclose="div">
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml --verbose --dimension 128 --spacing 2
</source>


Look at the result using vv
Look at the result using vv


  vv projections.mha
<source lang="bash" enclose="div">
vv projections.mha
</source>


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 [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line
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 [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line


  rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml
<source lang="bash" enclose="div">
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml --verbose --dimension 256 --spacing 1
</source>


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


  vv singleProjection.mha
<source lang="bash" enclose="div">
vv singleProjection.mha
</source>


== Back projection ==
== Back projection ==
Line 24: Line 48:
Start by back projecting a single projection. Run
Start by back projecting a single projection. Run


  rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml
<source lang="bash" enclose="div">
rtkbackprojections -v -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml --dimension 128 --spacing 2
</source>


Observe the result with vv
Observe the result with vv


  vv singleBackProjection.mha
<source lang="bash" enclose="div">
vv singleBackProjection.mha
</source>


As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running
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
<source lang="bash" enclose="div">
rtkbackprojections -v -p . -r projections.mha -o backProjection.mha -g geometry.xml --dimension 128 --spacing 2
</source>


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


  vv backProjection.mha muCT.mha --linkall
<source lang="bash" enclose="div">
vv backProjection.mha muCT.mha --linkall
</source>


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.
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.
Line 44: Line 76:
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
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
<source lang="bash" enclose="div">
  rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph --dimension 128 --spacing 2
</source>
<source lang="bash" enclose="div">
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator --dimension 128 --spacing 2
</source>


And for back projection
And for back projection


  rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection
<source lang="bash" enclose="div">
  rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection --dimension 128 --spacing 2
  rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph
</source>
<source lang="bash" enclose="div">
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph --dimension 128 --spacing 2
</source>
<source lang="bash" enclose="div">
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph --dimension 128 --spacing 2
</source>


If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following
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
<source lang="bash" enclose="div">
  rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast
  rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection
</source>
<source lang="bash" enclose="div">
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast
</source>
<source lang="bash" enclose="div">
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection
</source>
 
= Pre-processing =
 
Pre-process the sequence of real .his projections                           
* Crop
* Bin
* Median
 
= 3D FBP reconstruction =
 
== Real ==
 
Reconstruct the sequence of (pre-processed) real projections with and without width-truncated correction.
 
<source lang="bash" enclose="div">
rtkfdk -p projections -r '.*.his' -o fdk.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4
rtkfdk -p projections -r '.*.his' -o fdk_pad.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4 --pad 0.5
</source>
 
== Simulated ==
 
Simulate Shepp Logan projections (rtkprojectshepplogan) for a short scan  and reconstruct them:
 
<source lang="bash" enclose="div">
rtksimulatedgeometry -a 220 -n 110 -o parker.xml
rtkprojectshepploganphantom -g parker.xml --dimension 128 --spacing 2 -o parker.mha --phantomscale 64
rtkfdk -p . -r parker.mha -o fdk_park.mha -g parker.xml --dimension 128
</source>
 
Idem for width-truncated projections:


== Iterative reconstruction algorithms ==
<source lang="bash" enclose="div">
rtksimulatedgeometry -n 110 -o widthtrunc.xml --proj_iso_x 80
rtkprojectshepploganphantom -g widthtrunc.xml --dimension 128 --spacing 2 -o widthtrunc.mha --phantomscale 64
rtkfdk -p . -r widthtrunc.mha -o fdk_wt.mha -g widthtrunc.xml --dimension 128
</source>


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 [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing
= 3D iterative reconstruction =


  vv --sequence *.his
== Creating a very small dataset ==


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
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. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.


  rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"
Convert and preprocess the real projections by running
 
<source lang="bash" enclose="div">
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"
</source>


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  
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
<source lang="bash" enclose="div">
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5
</source>
 
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.


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.
== Unregularized 3D iterative reconstruction algorithms ==


The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running
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
<source lang="bash" enclose="div">
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3
</source>


Another popular technique uses the conjugate gradient algorithm
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
<source lang="bash" enclose="div">
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10
</source>


You can compare the results by running
You can compare the results by running


  vv SART.mha CG.mha --linkall
<source lang="bash" enclose="div">
vv SART.mha CG.mha --linkall
</source>


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"
<source lang="bash" enclose="div">
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojpersubset 10
</source>
 
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.
 
== Regularized 3D iterative reconstruction algorithms ==
 
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example
 
<source lang="bash" enclose="div">
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1
</source>
 
and
 
<source lang="bash" enclose="div">
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1
</source>
 
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.
 
= 4D iterative reconstruction =
 
The 4D reconstruction applications may take a long time to compute. If you do not have a CUDA-capable GPU, you may want to skip them and take the reconstruction results directly from the USB key you received at the beginning of the training. If you do have a CUDA-capable GPU and have compiled RTK with RTK_USE_CUDA=ON, you can add
 
<source lang="bash" enclose="div">
--fp CudaRayCast --bp CudaVoxelBased
</source>
 
to the reconstruction command lines in order to use it.
 
== Extracting respiratory phase ==
 
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run
 
<source lang="bash" enclose="div">
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd
</source>
 
and open the shroud image with vv:
 
<source lang="bash" enclose="div">
vv shroud.mhd
</source>
 
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try
 
<source lang="bash" enclose="div">
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"
</source>
 
The cropped shroud can be viewed with vv:
 
<source lang="bash" enclose="div">
vv cshroud.mhd
</source>
 
This cropped shroud will be used to extract a phase signal, with another RTK command. Run
 
<source lang="bash" enclose="div">
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt
</source>
 
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.
 
== Unregularized iterative 4D reconstruction ==
 
RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands
 
<source lang="bash" enclose="div">
rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3
</source>
<source lang="bash" enclose="div">
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3
</source>
 
== Regularized iterative 4D reconstruction ==
 
Just like in 3D reconstruction, regularity conditions can be added in 4D reconstruction. Actually, 4D reconstruction even allows more regularization: since the whole respiratory cycle is reconstructed at once, regularization along time can be applied. RTK includes an application to perform regularized 4D reconstruction, called ROOSTER.
It requires a motion mask, which you can download [http://midas3.kitware.com/midas/download/bitstream/457407/mm_50_in_cbct_coordinates.mha here].
You can try ROOSTER by running
 
<source lang="bash" enclose="div">
rtkfourdrooster -p . -r downsampledProjections.mha -g geometry.xml -o 4DROOSTER.mha --signal cphase.txt --dimension 128 --spacing 3 --gamma_time 0.0005 --gamma_space 0.0001 --motionmask mm_50_in_cbct_coordinates.mha
</source>

Latest revision as of 10:02, 17 November 2015

Geometry

Real

Edit and analyze the geometry file obtained from a real Elekta Synergy acquisition. Compare to the projection files using the command

vv --sequence *his

(VV help: F1).

Simulated

Use the command line application rtksimulatedgeometry to generate simulated geometries and analyze the outputs. (Help: rtksimulatedgeometry -h).

Basic operators

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 --verbose --dimension 128 --spacing 2

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 --verbose --dimension 256 --spacing 1

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 -v -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml --dimension 128 --spacing 2

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 -v -p . -r projections.mha -o backProjection.mha -g geometry.xml --dimension 128 --spacing 2

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 --dimension 128 --spacing 2
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator --dimension 128 --spacing 2

And for back projection

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

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

Pre-processing

Pre-process the sequence of real .his projections

  • Crop
  • Bin
  • Median

3D FBP reconstruction

Real

Reconstruct the sequence of (pre-processed) real projections with and without width-truncated correction.

rtkfdk -p projections -r '.*.his' -o fdk.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4
rtkfdk -p projections -r '.*.his' -o fdk_pad.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4 --pad 0.5

Simulated

Simulate Shepp Logan projections (rtkprojectshepplogan) for a short scan and reconstruct them:

rtksimulatedgeometry -a 220 -n 110 -o parker.xml
rtkprojectshepploganphantom -g parker.xml --dimension 128 --spacing 2 -o parker.mha --phantomscale 64
rtkfdk -p . -r parker.mha -o fdk_park.mha -g parker.xml --dimension 128

Idem for width-truncated projections:

rtksimulatedgeometry -n 110 -o widthtrunc.xml --proj_iso_x 80
rtkprojectshepploganphantom -g widthtrunc.xml --dimension 128 --spacing 2 -o widthtrunc.mha --phantomscale 64
rtkfdk -p . -r widthtrunc.mha -o fdk_wt.mha -g widthtrunc.xml --dimension 128


3D iterative reconstruction

Creating a very small dataset

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. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.

Convert and preprocess the real projections by running

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.

Unregularized 3D iterative reconstruction algorithms

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 OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojpersubset 10

The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.

Regularized 3D iterative reconstruction algorithms

RTK also includes algorithms that perform regularization during the reconstruction. You can try for example

rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1

and

rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1

Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.

4D iterative reconstruction

The 4D reconstruction applications may take a long time to compute. If you do not have a CUDA-capable GPU, you may want to skip them and take the reconstruction results directly from the USB key you received at the beginning of the training. If you do have a CUDA-capable GPU and have compiled RTK with RTK_USE_CUDA=ON, you can add

--fp CudaRayCast --bp CudaVoxelBased

to the reconstruction command lines in order to use it.

Extracting respiratory phase

RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run

rtkamsterdamshroud -p . -r .*.his -o shroud.mhd

and open the shroud image with vv:

vv shroud.mhd

You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try

rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"

The cropped shroud can be viewed with vv:

vv cshroud.mhd

This cropped shroud will be used to extract a phase signal, with another RTK command. Run

rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt

If you have Python installed, you can download this script and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.

Unregularized iterative 4D reconstruction

RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands

rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3

Regularized iterative 4D reconstruction

Just like in 3D reconstruction, regularity conditions can be added in 4D reconstruction. Actually, 4D reconstruction even allows more regularization: since the whole respiratory cycle is reconstructed at once, regularization along time can be applied. RTK includes an application to perform regularized 4D reconstruction, called ROOSTER. It requires a motion mask, which you can download here. You can try ROOSTER by running

rtkfourdrooster -p . -r downsampledProjections.mha -g geometry.xml -o 4DROOSTER.mha --signal cphase.txt --dimension 128 --spacing 3 --gamma_time 0.0005 --gamma_space 0.0001 --motionmask mm_50_in_cbct_coordinates.mha