Skip to content

Commit

Permalink
DOC: add tabs to clarify the doc and move doc images
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-grc authored and Axel Garcia committed Feb 12, 2025
1 parent 57e3fab commit a2c1f3f
Show file tree
Hide file tree
Showing 41 changed files with 249 additions and 173 deletions.
3 changes: 1 addition & 2 deletions applications/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Command-line examples
========
# Command-line examples

RTK provides command line applications that can be built from the C++ code by turning `ON` the `RTK_BUILD_APPLICATIONS` CMake option. A few of these applications have also been translated to Python and integrated in the [Pypi package](https://pypi.org/project/itk-rtk/). The options of each command line application can be listed with the `--help option`.

Expand Down
4 changes: 2 additions & 2 deletions applications/rtkadmmwavelets/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Daubechies Wavelets Regularized Reconstruction

![sin](Sinogram.png){w=300px alt="sinogram"}
![img](Overlay.png){w=300px alt="image"}
![sin](../../documentation/docs/ExternalData/Sinogram.png){w=300px alt="sinogram"}
![img](../../documentation/docs/ExternalData/Overlay.png){w=300px alt="image"}

This script uses the SheppLogan phantom

Expand Down
4 changes: 2 additions & 2 deletions applications/rtkamsterdamshroud/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Amsterdam Shroud

![sin](Moving-Phantom-Sinogram.png){w=400px alt="Moving phantom sinogram"}
![img](Amsterdam.png){w=400px alt="Amsterdam image"}
![sin](../../documentation/docs/ExternalData/Moving-Phantom-Sinogram.png){w=400px alt="Moving phantom sinogram"}
![img](../../documentation/docs/ExternalData/Amsterdam.png){w=400px alt="Amsterdam image"}

Picture 1 shows the sinogram of the input and picture 2 the shroud image that was created using the command line below.

Expand Down
18 changes: 18 additions & 0 deletions applications/rtkconjugategradient/NoisyConjugateGradient.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Create a simulated geometry
rtksimulatedgeometry -n 180 -o geometry.xml
# You may add "--arc 200" to make the scan short or "--proj_iso_x 200" to offset the detector

# Create projections of the phantom file
rtkprojectshepploganphantom -g geometry.xml -o projections.mha --spacing 2 --dimension 256

# Perform least squares reconstruction
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o LeastSquares.mha -g geom.xml -n 20

# Perform weighted least squares reconstruction
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o WeightedLeastSquares.mha -g geom.xml -w weightsmap.mha -n 20

# Perform preconditioned conjugate gradient reconstruction with weighted least squares cost function
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o PreconditionedWeightedLeastSquares.mha -g geom.xml -w weightsmap.mha -n 20 --preconditioned

# Create a reference volume for comparison
rtkdrawshepploganphantom --spacing 2 --dimension 256 -o ref.mha
51 changes: 21 additions & 30 deletions applications/rtkconjugategradient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,20 @@

This example uses the Shepp–Logan phantom.

## 3D

![sin](ConjugateGradient-Sinogram.png){w=200px alt="Conjugate sinogram"}
![img](ConjugateGradient.png){w=200px alt="ConjugateGradient image"}

```shell
# Create a simulated geometry
rtksimulatedgeometry -n 180 -o geometry.xml
# You may add "--arc 200" to make the scan short or "--proj_iso_x 200" to offset the detector

# Create projections of the phantom file
rtkprojectshepploganphantom -g geometry.xml -o projections.mha --spacing 2 --dimension 256
`````{tab-set}
# Reconstruct
rtkconjugategradient -p . -r projections.mha -o 3dcg.mha -g geometry.xml --spacing 2 --dimension 256 -n 20
````{tab-item} 3D
# Create a reference volume for comparison
rtkdrawshepploganphantom --spacing 2 --dimension 256 -o ref.mha
```

In the presence of noise, all projection data may not be equally reliable. The conjugate gradient algorithm can be modified to take this into account, and each pixel of the projections can be associated with a weight. The higher the weight, the more reliable the pixel data. Download [noisy projections](https://data.kitware.com/api/v1/item/5be99cdf8d777f2179a2e63d/download) and [the associated weights](https://data.kitware.com/api/v1/item/5be99d268d777f2179a2e6f8/download), as well as [the geometry](https://data.kitware.com/api/v1/item/5be99d268d777f2179a2e700/download), and run the following to compare the regular least squares reconstruction (without weights) and the weighted least squares reconstruction.
## 3D
```shell
# Perform least squares reconstruction
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o LeastSquares.mha -g geom.xml -n 20
![sin](../../documentation/docs/ExternalData/ConjugateGradient-Sinogram.png){w=200px alt="Conjugate sinogram"}
![img](../../documentation/docs/ExternalData/ConjugateGradient.png){w=200px alt="ConjugateGradient image"}
# Perform weighted least squares reconstruction
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o WeightedLeastSquares.mha -g geom.xml -w weightsmap.mha -n 20
```{literalinclude} ConjugateGradient3D.sh
```

Taking the weights into account slows down convergence. This can be corrected by using a preconditioner in the conjugate gradient algorithm. The preconditioner is computed automatically from the weights map, you just need to activate the flag :
```shell
# Perform preconditioned conjugate gradient reconstruction with weighted least squares cost function
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o WeightedLeastSquares.mha -g geom.xml -w weightsmap.mha -n 20 --preconditioned
```
````
````{tab-item} 2D
## 2D
Expand All @@ -47,3 +25,16 @@ The following script performs the same reconstruction as above in a 2D environme
```{literalinclude} ConjugateGradient2D.sh
```
````
````{tab-item} Noisy Reconstruction
## Noisy Reconstruction
In the presence of noise, all projection data may not be equally reliable. The conjugate gradient algorithm can be modified to take this into account, and each pixel of the projections can be associated with a weight. The higher the weight, the more reliable the pixel data. Download [noisy projections](https://data.kitware.com/api/v1/item/5be99cdf8d777f2179a2e63d/download) and [the associated weights](https://data.kitware.com/api/v1/item/5be99d268d777f2179a2e6f8/download), as well as [the geometry](https://data.kitware.com/api/v1/item/5be99d268d777f2179a2e700/download), and run the following to compare the regular least squares reconstruction (without weights) and the weighted least squares reconstruction.
Taking the weights into account slows down convergence. This can be corrected by using a preconditioner in the conjugate gradient algorithm. The preconditioner is computed automatically.
```{literalinclude} NoisyConjugateGradient.sh
```
````
`````
2 changes: 1 addition & 1 deletion applications/rtkdrawgeometricphantom/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create gammex phantom

![img](GammexPhantom.png){w=400px alt="Gammex"}
![img](../../documentation/docs/ExternalData/GammexPhantom.png){w=400px alt="Gammex"}

This script uses the file [Gammex.txt](https://data.kitware.com/api/v1/file/6762da8a290777363f95c293/download) as configuration file which creates a Gammex phantom.

Expand Down
2 changes: 1 addition & 1 deletion applications/rtkelektasynergygeometry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ rtkfieldofview \

You can visualize the result using a viewer (e.g., VV). The resulting image should look like the following:

![Elekta.jpg](Elekta.png){w=400px alt="Elekta snapshot"}
![Elekta.jpg](../../documentation/docs/ExternalData/Elekta.png){w=400px alt="Elekta snapshot"}
30 changes: 21 additions & 9 deletions applications/rtkfdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@

The following exampels illustrates the command line application `rtkfdk` by reconstructing a Shepp Logan phantom with Feldkamp, David and Kress algorithm in 3D (cone-beam) and 2D (fan-beam).

`````{tab-set}
````{tab-item} 3D
## 3D
![sin_3D](SheppLogan-3D-Sinogram.png){w=200px alt="Shepp-Logan 3D sinogram"}
![img_3D](SheppLogan-3D.png){w=200px alt="Shepp-Logan 3D image"}
![sin_3D](../../documentation/docs/ExternalData/SheppLogan-3D-Sinogram.png){w=200px alt="Shepp-Logan 3D sinogram"}
![img_3D](../../documentation/docs/ExternalData/SheppLogan-3D.png){w=200px alt="Shepp-Logan 3D image"}
This script uses the file [SheppLogan.txt](https://data.kitware.com/api/v1/item/5b179c938d777f15ebe2020b/download) as input.
```{literalinclude} FDK3D.sh
```
````
````{tab-item} 2D
## 2D
![sin_2D](SheppLogan-2D-Sinogram.png){w=200px alt="Shepp-Logan 2D sinogram"}
![img_2D](SheppLogan-2D.png){w=200px alt="Shepp-Logan 2D image"}
![sin_2D](../../documentation/docs/ExternalData/SheppLogan-2D-Sinogram.png){w=200px alt="Shepp-Logan 2D sinogram"}
![img_2D](../../documentation/docs/ExternalData/SheppLogan-2D.png){w=200px alt="Shepp-Logan 2D image"}
The same reconstruction can be performed using the original 2D Shepp-Logan phantom.
RTK can perform 2D reconstructions through images wide of 1 pixel in the y direction.
The following script performs the same reconstruction as above in a 2D environment and uses the [2D Shepp-Logan](http://wiki.openrtk.org/images/7/73/SheppLogan-2d.txt) phantom as input.
```{literalinclude} FDK2D.sh
```
````
````{tab-item} Motion compensated
## Motion-compensated reconstruction
Expand Down Expand Up @@ -62,13 +72,13 @@ rtkfieldofview \
You should obtain something like that with [VV](http://vv.creatis.insa-lyon.fr/):
![Blurred](Blurred.jpg){w=600px alt="Blurred image"}
![Blurred](../../documentation/docs/ExternalData/Blurred.jpg){w=600px alt="Blurred image"}
### Deformation vector field
The next piece of data is a 4D deformation vector field that describes a respiratory cycle. Typically, it can be obtained from the 4D planning CT with deformable image registration. Here, I have used [Elastix](http://elastix.lumc.nl/) with the [sliding module](http://elastix.lumc.nl/modelzoo/par0016) developed by Vivien Delmon. The registration uses a [patient mask](https://data.kitware.com/api/v1/item/5be99a408d777f2179a2dde8/download) (red+green) and a [motion mask](https://data.kitware.com/api/v1/item/5be99a088d777f2179a2cf6f/download) (red) as described in [Jef's publication](http://www.creatis.insa-lyon.fr/site/fr/publications/VAND-12):
![Mm](MotionMask.jpg){w=400px alt="Motion mask"}
![Mm](../../documentation/docs/ExternalData/MotionMask.jpg){w=400px alt="Motion mask"}
The registration can easily be scripted, here with bash, where each phase image of the POPI 4D CT has been stored in files 00.mhd to 50.mhd:
Expand Down Expand Up @@ -131,7 +141,7 @@ done
This is a bit complicated and there are probably other ways of doing this. For example, Vivien has resampled the planning CT frames on the CBCT coordinate system before doing the registrations, in which case you do not need to do all this. Just pick one of your choice but motion-compensated CBCT reconstruction requires a 4D vector field that is nicely displayed on top of a CBCT image, for example the fdk.mha that has been produced in the first step (the vector field is downsampled and displayed with VV):
![Vf](VectorField.gif){w=400px alt="Vector field"}
![Vf](../../documentation/docs/ExternalData/VectorField.gif){w=400px alt="Vector field"}
The elastix output files and the transformed 4D DVF are available [here](https://data.kitware.com/api/v1/item/5be99a058d777f2179a2cf42/download).
Expand All @@ -150,7 +160,7 @@ rtkextractshroudsignal --input shroud.mha \
Post-process with Matlab to obtain the phase signal, ensuring the phase ranges from 0 to 1 (e.g., 0.3 corresponds to 30% of the respiratory cycle). The resulting phase is visualized [here](https://data.kitware.com/api/v1/item/5be99af98d777f2179a2e160/download):
![Signal](Signal.jpg){w=800px alt="Phase signal"}
![Signal](../../documentation/docs/ExternalData/Signal.jpg){w=800px alt="Phase signal"}
---
Expand Down Expand Up @@ -183,6 +193,8 @@ rtkfieldofview \
Toggle between uncorrected and motion-compensated reconstruction to appreciate the improvement:
![Blurred vs mc.gif](Blurred_vs_mc.gif){w=400 alt="blurred vs motion compensation image"}
![Blurred vs mc.gif](../../documentation/docs/ExternalData/Blurred_vs_mc.gif){w=400 alt="blurred vs motion compensation image"}
The 4D vector field is constructed with phase 50% as a reference. Modify the reference image to reconstruct other phases, such as the time-average position.
````
`````
4 changes: 2 additions & 2 deletions applications/rtkforwardprojections/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Forward Projection

![sin](POPI-Sinogram.png){w=400px alt="POPI sinogram"}
![img](POPI-Reconstruction.png){w=400px alt="POPI reconstruction"}
![sin](../../documentation/docs/ExternalData/POPI-Sinogram.png){w=400px alt="POPI sinogram"}
![img](../../documentation/docs/ExternalData/POPI-Reconstruction.png){w=400px alt="POPI reconstruction"}

This script uses the files [00.mhd](http://www.creatis.insa-lyon.fr/~srit/POPI/MedPhys11/bl/mhd/00.mhd) and [00.raw](http://www.creatis.insa-lyon.fr/~srit/POPI/MedPhys11/bl/mhd/00.raw) of the [POPI](http://www.creatis.insa-lyon.fr/rio/popi-model/) as input.

Expand Down
1 change: 0 additions & 1 deletion applications/rtkfourdrooster/Blurred.jpg.sha512

This file was deleted.

1 change: 0 additions & 1 deletion applications/rtkfourdrooster/MotionMask.jpg.sha512

This file was deleted.

Loading

0 comments on commit a2c1f3f

Please sign in to comment.