diff --git a/applications/README.md b/applications/README.md index 943896278..2454425b6 100644 --- a/applications/README.md +++ b/applications/README.md @@ -2,28 +2,16 @@ RTK provides command line applications which 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`. -The following are examples using RTK applications: +The following groups collect the applications by purpose: ```{toctree} :maxdepth: 1 - -./rtkfdk/README.md -./rtkconjugategradient/README.md -./rtkforwardprojections/README.md -./rtkdrawgeometricphantom/README.md -./rtkamsterdamshroud/README.md -./rtkelektasynergygeometry/README.md -./rtkvarianobigeometry/README.md -./rtkadmmtotalvariation/README.md -./rtkadmmwavelets/README.md -./rtkfourdfdk/README.md -./rtkfourdconjugategradient/README.md -./rtkfourdsart/README.md -./rtkfourdrooster/README.md -./rtkshowgeometry/README.md -./rtkosem/README.md -./rtksart/README.md -./rtksubselect/README.md +../documentation/docs/applications/Geometry.md +../documentation/docs/applications/Phantoms_and_Forward_Models.md +../documentation/docs/applications/Projection_Processing.md +../documentation/docs/applications/Reconstruction.md +../documentation/docs/applications/Motion_and_Phase_Analysis.md +../documentation/docs/applications/Utilities.md ``` In [applications/rtktutorialapplication/](https://github.com/RTKConsortium/RTK/blob/main/applications/rtktutorialapplication), you will find a very basic RTK application that can be used as a starting point for building your own new application. diff --git a/applications/rtkadmmtotalvariation/README.md b/applications/rtkadmmtotalvariation/README.md index 572324356..9312e10ac 100644 --- a/applications/rtkadmmtotalvariation/README.md +++ b/applications/rtkadmmtotalvariation/README.md @@ -7,3 +7,15 @@ This script uses the SheppLogan phantom ```{literalinclude} TotalVariationRegularizedReconstruction.sh ``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkadmmtotalvariation/rtkadmmtotalvariation.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkadmmwavelets/README.md b/applications/rtkadmmwavelets/README.md index aa8b0bf9a..33344b568 100644 --- a/applications/rtkadmmwavelets/README.md +++ b/applications/rtkadmmwavelets/README.md @@ -7,3 +7,15 @@ This script uses the SheppLogan phantom ```{literalinclude} DaubechiesWavelets.sh ``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkadmmwavelets/rtkadmmwavelets.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkamsterdamshroud/README.md b/applications/rtkamsterdamshroud/README.md index 5d2c93225..46917add8 100644 --- a/applications/rtkamsterdamshroud/README.md +++ b/applications/rtkamsterdamshroud/README.md @@ -26,3 +26,16 @@ rtkextractshroudsignal --input shroud.mha \ Phase is commonly measured in radians, with values in $[0,2\pi[$, but in RTK it is normalized to $[0,1[$, where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [resulting phase](https://data.kitware.com/api/v1/item/5be99af98d777f2179a2e160/download) is in green on top of the blue respiratory signal and the detected end-exhale peaks: ![Signal](../../documentation/docs/ExternalData/Signal.jpg){w=800px alt="Phase signal"} + + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkamsterdamshroud/rtkamsterdamshroud.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkamsterdamshroud/rtkamsterdamshroud.py b/applications/rtkamsterdamshroud/rtkamsterdamshroud.py index 3f01007b9..f5836a961 100644 --- a/applications/rtkamsterdamshroud/rtkamsterdamshroud.py +++ b/applications/rtkamsterdamshroud/rtkamsterdamshroud.py @@ -47,9 +47,7 @@ def process(args_info: argparse.Namespace): rtk.SetProjectionsReaderFromArgParse(reader, args_info) # Amsterdam Shroud - shroudFilter = rtk.AmsterdamShroudImageFilter[ - OutputImageType, OutputImageType - ].New() + shroudFilter = rtk.AmsterdamShroudImageFilter[OutputImageType].New() shroudFilter.SetInput(reader.GetOutput()) shroudFilter.SetUnsharpMaskSize(args_info.unsharp) diff --git a/applications/rtkbackprojections/BackProjections.sh b/applications/rtkbackprojections/BackProjections.sh new file mode 100644 index 000000000..4fe677bca --- /dev/null +++ b/applications/rtkbackprojections/BackProjections.sh @@ -0,0 +1,9 @@ +# 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 --size 200 + +# Backproject the generated projections +rtkbackprojections -p . -r projections.mha -g geometry.xml -o backproj.mha --bp Joseph --spacing 2 --size 128 diff --git a/applications/rtkbackprojections/README.md b/applications/rtkbackprojections/README.md new file mode 100644 index 000000000..1310f0674 --- /dev/null +++ b/applications/rtkbackprojections/README.md @@ -0,0 +1,22 @@ +# Back projections + +![sin](../../documentation/docs/ExternalData/SheppLogan-Sinogram-3D.png){w=300px alt="SheppLogan sinogram 3D"} +![img](../../documentation/docs/ExternalData/BackProjection.png){w=300px alt="Backprojection example"} + +Backprojects a volume according to a geometry file. See available projectors [here](../../documentation/docs/Projectors.md) + +```{literalinclude} BackProjections.sh +``` + + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkbackprojections/rtkbackprojections.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkbioscangeometry/README.md b/applications/rtkbioscangeometry/README.md new file mode 100644 index 000000000..56fb8622b --- /dev/null +++ b/applications/rtkbioscangeometry/README.md @@ -0,0 +1,27 @@ +# Bioscan geometry + +Reader for Bioscan-format detector geometries. Generates an ITK-compatible geometry XML file from Bioscan header exports and associated projection image stacks. + +The command below uses this public RTK projection file: [bioscan.dcm](https://data.kitware.com/api/v1/item/5b179c728d777f15ebe201e2/download) + +The Bioscan geometry is stored in the DICOM projection headers, so `rtkbioscangeometry` reads the projection files directly. + +```bash +rtkbioscangeometry \ + --output bioscan_geometry.xml \ + --path . \ + --regexp 'bioscan.dcm' \ + --verbose +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkbioscangeometry/rtkbioscangeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkcheckimagequality/README.md b/applications/rtkcheckimagequality/README.md new file mode 100644 index 000000000..6c33aae9f --- /dev/null +++ b/applications/rtkcheckimagequality/README.md @@ -0,0 +1,29 @@ +# Quality Checker + +Checks the MSE of reconstructed volume(s) against reference volume(s). + +This utility compares one or more reconstructed images to reference image(s) and fails if the computed error exceeds the provided threshold(s). + +```bash +# Single comparison +rtkcheckimagequality -i reference.mha -j reconstruction.mha -t 1e-3 + +# Multiple one-to-one comparisons (per-file thresholds) +rtkcheckimagequality -i ref1.mha ref2.mha -j rec1.mha rec2.mha -t 1e-3 2e-3 + +# Broadcast a single threshold to multiple comparisons +rtkcheckimagequality -i ref1.mha ref2.mha -j rec1.mha rec2.mha -t 2e-3 +``` + + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkcheckimagequality/rtkcheckimagequality.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkconjugategradient/README.md b/applications/rtkconjugategradient/README.md index 78501aea0..41955f827 100644 --- a/applications/rtkconjugategradient/README.md +++ b/applications/rtkconjugategradient/README.md @@ -39,3 +39,16 @@ In the presence of noise, all projection data may not be equally reliable. The c ``` ```` ````` + + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkconjugategradient/rtkconjugategradient.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkdigisensgeometry/README.md b/applications/rtkdigisensgeometry/README.md new file mode 100644 index 000000000..2fdc0349b --- /dev/null +++ b/applications/rtkdigisensgeometry/README.md @@ -0,0 +1,23 @@ +# Digisens geometry + +Reader for DigiSens-format detector geometries. Generates an ITK-compatible geometry XML file from DigiSens calibration files + +The command below uses this public RTK file: [calibration.cal](https://data.kitware.com/api/v1/item/5b179c768d777f15ebe201e6/download) + +```bash +rtkdigisensgeometry \ + --xml_file calibration.cal \ + -o geometry.xml +``` + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkdigisensgeometry/rtkdigisensgeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkdrawgeometricphantom/README.md b/applications/rtkdrawgeometricphantom/README.md index 86dfa5b1f..5cfeaec21 100644 --- a/applications/rtkdrawgeometricphantom/README.md +++ b/applications/rtkdrawgeometricphantom/README.md @@ -1,4 +1,4 @@ -# Create gammex phantom +# Draw geometric phantom ![img](../../documentation/docs/ExternalData/GammexPhantom.png){w=400px alt="Gammex"} @@ -8,3 +8,16 @@ This script uses the file [Gammex.txt](https://data.kitware.com/api/v1/file/6762 # Create a 3D Gammex phantom rtkdrawgeometricphantom --phantomfile Gammex.txt -o gammex.mha ``` + + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkdrawgeometricphantom/rtkdrawgeometricphantom.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkdrawshepploganphantom/README.md b/applications/rtkdrawshepploganphantom/README.md new file mode 100644 index 000000000..14c6fca57 --- /dev/null +++ b/applications/rtkdrawshepploganphantom/README.md @@ -0,0 +1,22 @@ +# Draw shepp-logan phantom + +Computes a 3D voxelized Shepp & Logan phantom with noise according to [https://www.slaney.org/pct/pct-errata.html] + +See rtkfdk example: + +```{literalinclude} ../rtkfdk/FDK3D.sh + + ``` + + +## Command line options + + + ::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkdrawshepploganphantom/rtkdrawshepploganphantom.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkelektasynergygeometry/README.md b/applications/rtkelektasynergygeometry/README.md index d223ffcce..9a259aceb 100644 --- a/applications/rtkelektasynergygeometry/README.md +++ b/applications/rtkelektasynergygeometry/README.md @@ -70,3 +70,15 @@ rtkfieldofview \ You can visualize the result using a viewer (e.g., VV). The resulting image should look like the following: ![Elekta.jpg](../../documentation/docs/ExternalData/Elekta.png){w=400px alt="Elekta snapshot"} + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkelektasynergygeometry/rtkelektasynergygeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkelektasynergygeometry/rtkelektasynergygeometry.py b/applications/rtkelektasynergygeometry/rtkelektasynergygeometry.py index 83422d9f7..e1a3784fb 100755 --- a/applications/rtkelektasynergygeometry/rtkelektasynergygeometry.py +++ b/applications/rtkelektasynergygeometry/rtkelektasynergygeometry.py @@ -34,9 +34,9 @@ def process(args_info: argparse.Namespace): reader.UpdateOutputData() geometry = reader.GetGeometry() elif ( - args_info.image_db - and args_info.frame_db - and args_info.dicom_uid + args_info.image_db is None + and args_info.frame_db is None + and args_info.dicom_uid is None and args_info.xml is not None ): if args_info.verbose: diff --git a/applications/rtkextractphasesignal/README.md b/applications/rtkextractphasesignal/README.md new file mode 100644 index 000000000..e98a7876c --- /dev/null +++ b/applications/rtkextractphasesignal/README.md @@ -0,0 +1,27 @@ +# Extract Phase Signal + +This small utility reads a 1‑D signal image (e.g. a shroud-derived signal), applies optional preprocessing (moving average and unsharp masking), extracts the phase according to a chosen model, and writes the resulting phase as a plain-text file. + + +```bash +# Basic extraction (default model: LINEAR_BETWEEN_MINIMA) +rtkextractphasesignal -i signal.mha -o phase.txt + +# Tune preprocessing parameters +rtkextractphasesignal -i signal.mha -o phase.txt --movavg 3 --unsharp 53 + +# Use LOCAL_PHASE model +rtkextractphasesignal -i signal.mha -o phase.txt --model LOCAL_PHASE +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkextractphasesignal/rtkextractphasesignal.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkextractshroudsignal/README.md b/applications/rtkextractshroudsignal/README.md new file mode 100644 index 000000000..aa8d9c117 --- /dev/null +++ b/applications/rtkextractshroudsignal/README.md @@ -0,0 +1,18 @@ +# Extract shroud signal + +Extracts the breathing signal from a shroud image. + +This application reads a shroud image and extracts a respiratory signal using either a regularised 1D method (`Reg1D`) or dynamic programming (`DynamicProgramming`). It can also write an estimated Hilbert phase image. + +```bash +# Basic extraction (default method: Reg1D) +rtkextractshroudsignal -i shroud.mha -o breathing.txt + +# Use Dynamic Programming method (requires a maximum amplitude) +rtkextractshroudsignal -i shroud.mha -o breathing.txt -m DynamicProgramming -a 30 + +# Also write Hilbert phase text file and tune preprocessing +rtkextractshroudsignal -i shroud.mha -o breathing.txt -p phase.txt --movavg 5 --unsharp 65 --model LOCAL_PHASE +``` + +See the [rtkamsterdamshroud documentation](../rtkamsterdamshroud/README.md) for a shroud-extraction workflow diff --git a/applications/rtkfdk/README.md b/applications/rtkfdk/README.md index 177f44a1b..192a0f055 100644 --- a/applications/rtkfdk/README.md +++ b/applications/rtkfdk/README.md @@ -162,7 +162,6 @@ Post-process with Matlab to obtain the phase signal, ensuring the phase ranges f ![Signal](../../documentation/docs/ExternalData/Signal.jpg){w=800px alt="Phase signal"} ---- ### Motion-compensated cone-beam CT reconstruction @@ -198,3 +197,14 @@ Toggle between uncorrected and motion-compensated reconstruction to appreciate t 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. ```` ````` + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkfdk/rtkfdk.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkfieldofview/README.md b/applications/rtkfieldofview/README.md new file mode 100644 index 000000000..85e7ff7ee --- /dev/null +++ b/applications/rtkfieldofview/README.md @@ -0,0 +1,24 @@ +# Field of view + +Computes the field of view of a reconstruction using the acquisition geometry and the projections stack. + +By default this uses RTK's fast `FieldOfViewImageFilter` (suitable for standard circular/cylindrical scans). For non‑cylindrical or irregular acquisition geometries you can force a more robust (but slower) backprojection-based method with `--bp`, the program backprojects a stack of projections filled with ones and thresholds the result to derive the FOV footprint. + +```bash +# Basic FOV mask (fast, preferred) +rtkfieldofview -g geometry.xml -p /projections -r '.*.mha' --reconstruction recon.mha -o fov_mask.mha --mask + +# Backprojection-based FOV (non-cylindrical geometry) +rtkfieldofview -g geometry.xml -p /projections -r '.*.mha' --reconstruction recon.mha -o fov_bp.mha --bp --mask --hardware cuda +``` + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkfieldofview/rtkfieldofview.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkforwardprojections/README.md b/applications/rtkforwardprojections/README.md index dbc0cfec0..b61c24395 100644 --- a/applications/rtkforwardprojections/README.md +++ b/applications/rtkforwardprojections/README.md @@ -11,3 +11,15 @@ This script uses the files [00.mhd](http://www.creatis.insa-lyon.fr/~srit/POPI/M Note that the original file is in Hounsfield units which explains the negative values in the projection images since, e.g., the attenuation of air is -1000 HU. It is also worth of note that the file is oriented in the DICOM coordinate system although RTK uses the IEC 61217 which results in a rotation around the antero-posterior axis of the patient. This can be easily changed by modifying the TransformMatrix in the 00.mhd file. + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkforwardprojections/rtkforwardprojections.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkfourdconjugategradient/README.md b/applications/rtkfourdconjugategradient/README.md index f28fe74c5..a06ae9b99 100644 --- a/applications/rtkfourdconjugategradient/README.md +++ b/applications/rtkfourdconjugategradient/README.md @@ -51,3 +51,16 @@ rtkfourdconjugategradient \ ``` Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts at the borders of the result. To avoid these artifacts, reconstructing a larger volume with `--size 256` should help. + + +## Command line options + + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkfourdconjugategradient/rtkfourdconjugategradient.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkfourdfdk/README.md b/applications/rtkfourdfdk/README.md index 8a3f04e4a..66e41fa1e 100644 --- a/applications/rtkfourdfdk/README.md +++ b/applications/rtkfourdfdk/README.md @@ -48,3 +48,14 @@ rtkfourdfdk \ ``` Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts at the borders of the result. + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkfourdfdk/rtkfourdfdk.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkfourdrooster/README.md b/applications/rtkfourdrooster/README.md index cee031e7d..7d0daa516 100644 --- a/applications/rtkfourdrooster/README.md +++ b/applications/rtkfourdrooster/README.md @@ -196,3 +196,14 @@ You do not need the 4D planning CT data to perform the MA-ROOSTER reconstruction * 4D planning CT * [Patient 1](https://data.kitware.com/api/v1/item/5be98bd28d777f2179a2a279/download) * [Patient 2](https://data.kitware.com/api/v1/item/5be9a1918d777f2179a2f568/download) + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkfourdrooster/rtkfourdrooster.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkfourdsart/README.md b/applications/rtkfourdsart/README.md index 2510a05e0..82b7180e3 100644 --- a/applications/rtkfourdsart/README.md +++ b/applications/rtkfourdsart/README.md @@ -53,3 +53,14 @@ rtkfourdsart \ ``` Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts at the borders of the result. To avoid these artifacts, reconstructing a larger volume with `--size 256` should help. + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkfourdsart/rtkfourdsart.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkgaincorrection/README.md b/applications/rtkgaincorrection/README.md new file mode 100644 index 000000000..584942938 --- /dev/null +++ b/applications/rtkgaincorrection/README.md @@ -0,0 +1,18 @@ +# Gain correction + +Polynomial gain correction for projection images. Reads a set of projections, applies dark/gain calibration, and writes corrected projections. + +```bash +rtkgaincorrection --calibDir Calibration/ --Gain gain.mha --Dark dark.mha -p . -r '.*.mha' -o corrected.mha +``` + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkgaincorrection/rtkgaincorrection.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtki0estimation/README.md b/applications/rtki0estimation/README.md new file mode 100644 index 000000000..4a06c55fc --- /dev/null +++ b/applications/rtki0estimation/README.md @@ -0,0 +1,19 @@ +# I0 estimation + +Estimate I0 from projection images using an RLS-based estimator. + +```bash +rtki0estimation -p . -r '.*.mha' -l 0.85 -e 10000 --debug i0_estimates.csv +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtki0estimation/rtki0estimation.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkimagxgeometry/README.md b/applications/rtkimagxgeometry/README.md new file mode 100644 index 000000000..cd6bdc901 --- /dev/null +++ b/applications/rtkimagxgeometry/README.md @@ -0,0 +1,33 @@ +# Imagx geometry + +Reader for ImagX-style detector geometries. Produces an ITK-compatible `geometry.xml` from ImagX exports (headers + images). + +The command below uses these public RTK files: + +- [calibration.xml](https://data.kitware.com/api/v1/item/5b179c998d777f15ebe20212/download) +- [room.xml](https://data.kitware.com/api/v1/item/5b179ca08d777f15ebe2021b/download) +- [1.dcm](https://data.kitware.com/api/v1/item/5b179c968d777f15ebe2020f/download) + +`rtkimagxgeometry` needs a calibration file, a room setup file, and a stack of projections. + + +```bash +rtkimagxgeometry \ + --calibration calibration.xml \ + --room_setup room.xml \ + -p . \ + -r '1\\.dcm' \ + -o geometry.xml +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkimagxgeometry/rtkimagxgeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkiterativefdk/IterativeFDK2D.sh b/applications/rtkiterativefdk/IterativeFDK2D.sh new file mode 100644 index 000000000..4528a9672 --- /dev/null +++ b/applications/rtkiterativefdk/IterativeFDK2D.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Create a simulated geometry +rtksimulatedgeometry -n 180 -o geometry.xml + +# Create projections of the phantom file +# Note the sinogram being 3 pixels wide in the y direction to allow back-projection interpolation in a 2D image +rtkprojectgeometricphantom -g geometry.xml -o projections.mha --spacing 2 --size=512,3,512 --phantomfile SheppLogan-2d.txt --phantomscale=256,1,256 + +# Iterative reconstruction +rtkiterativefdk -p . -r projections.mha -o iterfdk.mha -g geometry.xml --spacing 2 --size 256,1,256 -n 3 --lambda 0.3 + +# Create a reference volume for comparison +rtkdrawgeometricphantom --spacing 2 --size=256,1,256 --phantomfile SheppLogan-2d.txt -o ref.mha --phantomscale=256,1,256 diff --git a/applications/rtkiterativefdk/IterativeFDK3D.sh b/applications/rtkiterativefdk/IterativeFDK3D.sh new file mode 100644 index 000000000..11faa4bbc --- /dev/null +++ b/applications/rtkiterativefdk/IterativeFDK3D.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# 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 --size 200 + +# Iterative reconstruction +rtkiterativefdk -p . -r projections.mha -o iterfdk.mha -g geometry.xml --spacing 2 --size 128 -n 5 --lambda 0.3 --positivity + +# Create a reference volume for comparison +rtkdrawshepploganphantom --like iterfdk.mha -o ref.mha diff --git a/applications/rtkiterativefdk/README.md b/applications/rtkiterativefdk/README.md new file mode 100644 index 000000000..35669e580 --- /dev/null +++ b/applications/rtkiterativefdk/README.md @@ -0,0 +1,44 @@ +# Iterative FDK + +Iterative Feldkamp-Davis-Kress reconstruction (Iterative FDK). This application performs an iterative correction of an FDK reconstruction using projection-subset based updates. It supports CPU and CUDA backends and common projector options. + +`````{tab-set} + +````{tab-item} 3D + +## 3D + +![sin_3D](../../documentation/docs/ExternalData/SheppLogan-Sinogram-3D.png){w=200px alt="SheppLogan sinogram 3D "} +![img_3D](../../documentation/docs/ExternalData/IterativeFdk-3D.png){w=200px alt="Iterative FDK reconstruction 3D"} + +This script uses the SheppLogan phantom. + +```{literalinclude} IterativeFDK3D.sh +``` + +```` +````{tab-item} 2D + +## 2D + +![sin_2D](../../documentation/docs/ExternalData/SheppLogan-Sinogram-2D.png){w=200px alt="SheppLogan sinogram 2D"} +![img_2D](../../documentation/docs/ExternalData/IterativeFdk-2D.png){w=200px alt="Iterative FDK reconstruction 2D"} + +The same reconstruction can be performed using the original 2D Shepp-Logan phantom. + +```{literalinclude} IterativeFDK2D.sh +``` + +```` +````` + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkiterativefdk/rtkiterativefdk.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtklagcorrection/README.md b/applications/rtklagcorrection/README.md new file mode 100644 index 000000000..5507861b0 --- /dev/null +++ b/applications/rtklagcorrection/README.md @@ -0,0 +1,22 @@ +# Lag correction + +Fourth-order LTI lag correction for projection stacks. + +```bash +# Replace the -a (rates) and -c (coefficients) values with calibrated detector parameters +rtklagcorrection -p . -r projections.mha -o corrected_projections.mha \ + -a 0.0 0.1 0.05 0.01 \ + -c 1.0 0.5 0.2 0.1 +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtklagcorrection/rtklagcorrection.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkmaskcollimation/README.md b/applications/rtkmaskcollimation/README.md new file mode 100644 index 000000000..11016fe84 --- /dev/null +++ b/applications/rtkmaskcollimation/README.md @@ -0,0 +1,19 @@ +# Mask collimation + +Masks out the collimator from projection images using the acquisition geometry. Useful to remove detector edges and collimator shadows before downstream processing. + +```bash +rtkmaskcollimation -g geometry.xml -p . -r '.*.mha' -o corrected_projections.mha +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkmaskcollimation/rtkmaskcollimation.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkorageometry/README.md b/applications/rtkorageometry/README.md new file mode 100644 index 000000000..cc7b8f27d --- /dev/null +++ b/applications/rtkorageometry/README.md @@ -0,0 +1,48 @@ +# Ora geometry + +Reader for ORA-format geometries. Converts ORA export files into a `geometry.xml` used by RTK reconstruction tools. + +This example dataset contains an `.xml` (metadata), an `.mhd` (header) and a `.raw` (raw data) file: +- [0_afterLog.ora.xml (metadata)](https://data.kitware.com/api/v1/item/5b179ca58d777f15ebe20222/download) +- [0_afterLog.mhd (header)](https://data.kitware.com/api/v1/item/5b179ca38d777f15ebe2021f/download) +- [0_afterLog.raw (raw data)](https://data.kitware.com/api/v1/item/5b179ca68d777f15ebe20225/download) + +The `.xml` metadata references the corresponding `.mhd` and `.raw` filenames, so `rtkorageometry` only requires the `.xml` files as input. + +## Generate geometry XML from an ORA XML file + +Create a geometry XML from ORA-format projection files: + +```bash +rtkorageometry \ + -p . \ + -r "0_afterLog.ora.xml" \ + -o geometry.xml +``` + +## Reconstruct Using RTK Applications + +Use the generated geometry with FDK for a simple reconstruction: + +```bash +rtkfdk \ + --geometry geometry.xml \ + --regexp ".*ORA_proj_.*\.img" \ + --path /path/to/ora_projections \ + --output recon_slice.mha \ + --verbose \ + --spacing 0.25,0.25,0.25 \ + --size 1024,1,1024 \ + --origin -127.875,30,-127.875 +``` + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkorageometry/rtkorageometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkorageometry/rtkorageometry.py b/applications/rtkorageometry/rtkorageometry.py index af851e603..1f450d091 100644 --- a/applications/rtkorageometry/rtkorageometry.py +++ b/applications/rtkorageometry/rtkorageometry.py @@ -7,51 +7,67 @@ def build_parser(): # Argument parsing parser = rtk.RTKArgumentParser( - description="Creates an RTK geometry file from a Varian OBI acquisition." - ) - - parser.add_argument( - "--xml_file", "-x", help="Varian OBI XML information file on projections" + description="Creates an RTK geometry file from a sequence of ora.xml files (radART / medPhoton file format)." ) parser.add_argument("--output", "-o", help="Output file name", required=True) - parser.add_argument( - "--path", "-p", help="Path containing projections", required=True - ) - parser.add_argument( - "--regexp", "-r", help="Regular expression to select projection files in path" - ) parser.add_argument( "--margin", "-m", help="Collimation margin (uinf, usup, vinf, vsup)", type=float, nargs="+", - default=0.0, + default=[0.0], + ) + parser.add_argument( + "--optitrack", + help="OptiTrack object ID (unused by default)", + type=int, + default=-1, + ) + parser.add_argument( + "--nsort", + help="Numeric sort for regular expression matches", + action="store_true", + ) + parser.add_argument( + "--submatch", + help="Index of the submatch that will be used to sort matches", + type=int, + default=0, + ) + + projection_group = parser.add_argument_group("Projections") + projection_group.add_argument( + "--path", "-p", help="Path containing projections", required=True + ) + projection_group.add_argument( + "--regexp", + "-r", + help="Regular expression to select projection files in path", + required=True, ) - # Parse the command line arguments return parser def process(args: argparse.Namespace): - margin = args.margin - if type(margin) is float: - margin = [margin] - for i in range(len(margin), 4, 1): - margin.append(margin[0]) - print(margin) + margin = itk.Vector[itk.D, 4]() + + margin.Fill(args.margin[0]) + for i in range(min(len(args.margin), 4)): + margin[i] = float(args.margin[i]) - names = itk.RegularExpressionSeriesFileNames.New() - names.SetDirectory(args.path) - names.SetRegularExpression(args.regexp) + # Create geometry reader + fileNames = rtk.GetProjectionsFileNamesFromArgParse(args) - reader = rtk.OraGeometryReader.New() - reader.SetProjectionsFileNames(names.GetFileNames()) - reader.SetCollimationMargin(margin) - reader.UpdateOutputData() + oraReader = rtk.OraGeometryReader.New() + oraReader.SetProjectionsFileNames(fileNames) + oraReader.SetCollimationMargin(margin) + oraReader.SetOptiTrackObjectID(getattr(args, "optitrack", -1)) + oraReader.UpdateOutputData() - rtk.write_geometry(reader.GetGeometry(), args.output) + rtk.write_geometry(oraReader.GetGeometry(), args.output) def main(argv=None): diff --git a/applications/rtkosem/README.md b/applications/rtkosem/README.md index 5081576c5..b8aabde2a 100644 --- a/applications/rtkosem/README.md +++ b/applications/rtkosem/README.md @@ -10,3 +10,15 @@ The following example illustrates the command line application `rtkosem` by reco ``` For details about available forward/back projectors and their options, see the Projectors documentation: [documentation/docs/Projectors.md](../../documentation/docs/Projectors.md). + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkosem/rtkosem.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkoverlayphaseandshroud/OverlayPhaseAndShroud.sh b/applications/rtkoverlayphaseandshroud/OverlayPhaseAndShroud.sh new file mode 100644 index 000000000..5d7f288fd --- /dev/null +++ b/applications/rtkoverlayphaseandshroud/OverlayPhaseAndShroud.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Create Amsterdam shroud from projections +rtkamsterdamshroud --path projections --regexp '.*.his' --output shroud.mha --unsharp 650 + +# Extract phase signal +rtkextractshroudsignal --input shroud.mha --output signal.txt + +# Overlay phase minima on the shroud and write an RGB image +rtkoverlayphaseandshroud -i shroud.mha -o overlay.png --signal signal.txt diff --git a/applications/rtkoverlayphaseandshroud/README.md b/applications/rtkoverlayphaseandshroud/README.md new file mode 100644 index 000000000..3acde3e2f --- /dev/null +++ b/applications/rtkoverlayphaseandshroud/README.md @@ -0,0 +1,20 @@ +# Overlay phase and shroud + +Generates an RGB image showing phase peaks (minima in the phase signal) overlaid on an Amsterdam shroud image. The output is a standard RGB image (PNG/JPG) that highlights detected phase minima in red. + +This example is illustrated with a set of [projection](https://data.kitware.com/api/v1/item/5be99af88d777f2179a2e144/download) of the POPI patient used in the [amsterdamshroud example](../rtkamsterdamshroud/README.md) + +```{literalinclude} OverlayPhaseAndShroud.sh +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkoverlayphaseandshroud/rtkoverlayphaseandshroud.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkprojectgeometricphantom/README.md b/applications/rtkprojectgeometricphantom/README.md new file mode 100644 index 000000000..90f764993 --- /dev/null +++ b/applications/rtkprojectgeometricphantom/README.md @@ -0,0 +1,23 @@ +# Project geometric phantom + +Computes projections through a user-defined geometric phantom according to a given acquisition geometry. See the [Phantom documentation](../../documentation/docs/Phantom.md) + +```bash +# Create a simulated geometry +rtksimulatedgeometry -n 180 -o geometry.xml + +# Create projections of the phantom file +rtkprojectgeometricphantom -g geometry.xml -o projections.mha --spacing 2 --size=512,512,512 --phantomfile phantom.txt --phantomscale=256,256,256 +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkprojectgeometricphantom/rtkprojectgeometricphantom.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkprojections/README.md b/applications/rtkprojections/README.md new file mode 100644 index 000000000..a15c9fab9 --- /dev/null +++ b/applications/rtkprojections/README.md @@ -0,0 +1,27 @@ +# Projections + +Reads raw projection images, converts them to attenuation and stacks them into a single output image file. +This application is primarily used to apply preprocessing to input projections (attenuation conversion, adding noise, cropping, filtering, etc.). + +```bash +# Stack projections from the current folder into a single file +rtkprojections -o projections.mha -p . -r '.*.his' + +# Add additive Gaussian noise while stacking (standard deviation) +rtkprojections -o projections_noisy.mha -p . -r '.*.his' --gaussian 0.01 + +# Simulate pre-log Poisson noise (I0) and then additive Gaussian (optional) +rtkprojections -o projections_noisy2.mha -p . -r '.*.his' --poisson 1e5 0.01879 --gaussian 0.01 +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkprojections/rtkprojections.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkprojectshepploganphantom/README.md b/applications/rtkprojectshepploganphantom/README.md new file mode 100644 index 000000000..78ab115e1 --- /dev/null +++ b/applications/rtkprojectshepploganphantom/README.md @@ -0,0 +1,27 @@ +# Project Shepp-Logan Phantom + +![sin](../../documentation/docs/ExternalData/SheppLogan-Sinogram-3D.png){w=200px alt="SheppLogan sinogram 3D"} + +Computes projections through a 3D Shepp & Logan phantom according to a geometry file. + +```bash +# Create a simulated geometry +rtksimulatedgeometry -n 180 -o geometry.xml + +# Create projections with a 3D geometry +rtkprojectshepploganphantom -g geometry.xml -o projections.mha --spacing 2 --size 200 + +# Use the reconstruction filter of your choice like rtkfdk or rtkconjugategradient +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkprojectshepploganphantom/rtkprojectshepploganphantom.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkregularizedconjugategradient/README.md b/applications/rtkregularizedconjugategradient/README.md new file mode 100644 index 000000000..5c3531bd6 --- /dev/null +++ b/applications/rtkregularizedconjugategradient/README.md @@ -0,0 +1,19 @@ +# Regularized Conjugate Gradient + +Alternates between conjugate gradient reconstruction and spatial/spectral regularization to produce constrained reconstructions. + +```{literalinclude} RegularizedConjugateGradient.sh + +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkregularizedconjugategradient/rtkregularizedconjugategradient.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkregularizedconjugategradient/RegularizedConjugateGradient.sh b/applications/rtkregularizedconjugategradient/RegularizedConjugateGradient.sh new file mode 100644 index 000000000..dcf065de8 --- /dev/null +++ b/applications/rtkregularizedconjugategradient/RegularizedConjugateGradient.sh @@ -0,0 +1,12 @@ + # 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 --size 256 + + # Reconstruct + rtkregularizedconjugategradient -p . -r projections.mha -o regularizedcg.mha -g geometry.xml --spacing 2 --size 256 -n 10 + + # Create a reference volume for comparison + rtkdrawshepploganphantom --spacing 2 --size 256 -o ref.mha diff --git a/applications/rtksart/README.md b/applications/rtksart/README.md index 51e8b3c8a..175ad2b9d 100644 --- a/applications/rtksart/README.md +++ b/applications/rtksart/README.md @@ -11,3 +11,15 @@ This script uses the SheppLogan phantom. ``` For projector choices and options, see the Projectors documentation: [documentation/docs/Projectors.md](../../documentation/docs/Projectors.md). + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtksart/rtksart.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkscatterglarecorrection/README.md b/applications/rtkscatterglarecorrection/README.md new file mode 100644 index 000000000..38d718854 --- /dev/null +++ b/applications/rtkscatterglarecorrection/README.md @@ -0,0 +1,23 @@ +# Scatter Glare Correction + +Corrects projection images for scatter glare using a deconvolution kernel. + +```bash +# Apply glare correction using two kernel coefficients +rtkscatterglarecorrection -p . -r '.*.his' -c 0.8 0.2 -o projections_corrected.mha --verbose + +# Output the difference image +rtkscatterglarecorrection -p . -r '.*.his' -c 0.8 0.2 -d -o diff.mha +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkscatterglarecorrection/rtkscatterglarecorrection.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkshowgeometry/README.md b/applications/rtkshowgeometry/README.md index 7eeac271e..d34c95db8 100644 --- a/applications/rtkshowgeometry/README.md +++ b/applications/rtkshowgeometry/README.md @@ -18,3 +18,15 @@ All geometries described in the [documentation](../../documentation/docs/Geometr ```{literalinclude} showgeometry.sh ``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkshowgeometry/rtkshowgeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkspectraldenoiseprojections/README.md b/applications/rtkspectraldenoiseprojections/README.md new file mode 100644 index 000000000..18a51309f --- /dev/null +++ b/applications/rtkspectraldenoiseprojections/README.md @@ -0,0 +1,5 @@ +# rtkspectraldenoiseprojections + +Spectral projection denoising utilities. + +Denoises multi-energy projection data prior to reconstruction. diff --git a/applications/rtkspectralforwardmodel/README.md b/applications/rtkspectralforwardmodel/README.md new file mode 100644 index 000000000..4844fcf5f --- /dev/null +++ b/applications/rtkspectralforwardmodel/README.md @@ -0,0 +1,5 @@ +# rtkspectralforwardmodel + +Spectral forward projection model utilities. + +Provides forward model filters for spectral projection simulation. diff --git a/applications/rtkspectralonestep/README.md b/applications/rtkspectralonestep/README.md new file mode 100644 index 000000000..e8c591bb1 --- /dev/null +++ b/applications/rtkspectralonestep/README.md @@ -0,0 +1,5 @@ +# rtkspectralonestep + +Spectral one-step reconstruction application. + +Use this application to perform spectral (multi-energy) one-step reconstruction from projection data. diff --git a/applications/rtkspectralrooster/README.md b/applications/rtkspectralrooster/README.md new file mode 100644 index 000000000..5a509f87b --- /dev/null +++ b/applications/rtkspectralrooster/README.md @@ -0,0 +1,5 @@ +# rtkspectralrooster + +Spectral Rooster reconstruction application (spectral extension of Rooster). + +Use for spectral iterative reconstruction with Rooster-based algorithms. diff --git a/applications/rtkspectralsimplexdecomposition/README.md b/applications/rtkspectralsimplexdecomposition/README.md new file mode 100644 index 000000000..b2a48cb59 --- /dev/null +++ b/applications/rtkspectralsimplexdecomposition/README.md @@ -0,0 +1,5 @@ +# rtkspectralsimplexdecomposition + +Simple spectral decomposition utilities and example application. + +Performs basic spectral decomposition on multi-energy projection data. diff --git a/applications/rtksubselect/README.md b/applications/rtksubselect/README.md index 248be648d..f385679c5 100644 --- a/applications/rtksubselect/README.md +++ b/applications/rtksubselect/README.md @@ -1,6 +1,6 @@ # Projection selection -This example illustrates the `rtksubselect` application, which extracts a subset of projections from an input stack and geometry and writes a reduced stack and matching geometry. +This example illustrates how to extracts a subset of projections from an input stack and a geometry file, then writes a reduced stack and the matching geometry. ![sin](../../documentation/docs/ExternalData/SheppLogan-Sinogram-3D.png){w=200px alt="SheppLogan sinogram"} ![img](../../documentation/docs/ExternalData/SubSelect-Sinogram.png){w=200px alt="SubSelect sinogram"} @@ -9,3 +9,15 @@ This script uses the SheppLogan phantom. ```{literalinclude} SubSelect.sh ``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtksubselect/rtksubselect.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtktotalvariationdenoising/README.md b/applications/rtktotalvariationdenoising/README.md new file mode 100644 index 000000000..5931dc504 --- /dev/null +++ b/applications/rtktotalvariationdenoising/README.md @@ -0,0 +1,21 @@ +# Total Variation Denoising + +![noisy-fdk](../../documentation/docs/ExternalData/Noisy-fdk.png){w=200px alt="Noisy fdk reconstruction"} +![denoised-fdk](../../documentation/docs/ExternalData/Denoised-fdk.png){w=200px alt="Denoised fdk reconstruction"} + +Performs total variation denoising on a 3D image using Bregman iterations. + +```{literalinclude} TotalVariationDenoising.sh +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtktotalvariationdenoising/rtktotalvariationdenoising.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtktotalvariationdenoising/TotalVariationDenoising.sh b/applications/rtktotalvariationdenoising/TotalVariationDenoising.sh new file mode 100644 index 000000000..e23c82873 --- /dev/null +++ b/applications/rtktotalvariationdenoising/TotalVariationDenoising.sh @@ -0,0 +1,12 @@ +# Create a simulated geometry + rtksimulatedgeometry -n 180 -o geometry.xml + +# simulate noisy projections +rtkprojectshepploganphantom -o projections.mha -g geometry.xml --spacing 2 \ + --size 200 --gaussian 0.01 --poisson 1e6,0.01879 + +# reconstruct +rtkfdk -p . -r projections.mha -o noisy-fdk.mha -g geometry.xml --spacing 2 --size 128 + +# post‑process with TV denoising +rtktotalvariationdenoising -i noisy-fdk.mha -o denoised.mha --gamma 0.5 --niter 10 --verbose diff --git a/applications/rtkvarianobigeometry/README.md b/applications/rtkvarianobigeometry/README.md index 05357d02d..88bf28620 100644 --- a/applications/rtkvarianobigeometry/README.md +++ b/applications/rtkvarianobigeometry/README.md @@ -31,7 +31,7 @@ Reconstruct a slice (e.g., slice 30) of the volume using the `rtkfdk` algorithm: ```bash rtkfdk \ --geometry geometry.xml \ - --regexp .*\.hnd \ + --regexp .*\\.hnd \ --path Scan0 \ --output slice30.mha \ --verbose \ @@ -47,7 +47,7 @@ Apply the field-of-view (FOV) filter to discard everything outside the FOV: ```bash rtkfieldofview \ --geometry geometry.xml \ - --regexp .*\.hnd \ + --regexp .*\\.hnd \ --path Scan0 \ --reconstruction slice30.mha \ --output slice30.mha \ @@ -90,7 +90,7 @@ Reconstruct a slice (e.g., slice 58) of the volume using the `rtkfdk` algorithm: ```bash rtkfdk \ --geometry geometry.xml \ - --regexp .*\.xim \ + --regexp .*\\.xim \ --path Acquisitions/733061622 \ --output slice58.mha \ --verbose \ @@ -106,7 +106,7 @@ Apply the field-of-view (FOV) filter to discard everything outside the FOV: ```bash rtkfieldofview \ --geometry geometry.xml \ - --regexp .*\.xim \ + --regexp .*\\.xim \ --path Acquisitions/733061622 \ --reconstruction slice58.mha \ --output slice58.mha \ @@ -118,5 +118,17 @@ rtkfieldofview \ You can visualize the result using a viewer (e.g., VV). The resulting image should look like this: ![../../documentation/docs/ExternalData/VarianProBeam](../../documentation/docs/ExternalData/VarianProBeam.png){w=400px alt="VarianProBeam snapshot"} -````` ```` +````` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkvarianobigeometry/rtkvarianobigeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkvectorconjugategradient/README.md b/applications/rtkvectorconjugategradient/README.md new file mode 100644 index 000000000..ddf81a3aa --- /dev/null +++ b/applications/rtkvectorconjugategradient/README.md @@ -0,0 +1,19 @@ +# Vector Conjugate Gradient + +Reconstructs a multi-material 3D volume from projections using a conjugate gradient method producing vector-valued voxels. + +```bash +rtkvectorconjugategradient -g geometry.xml -o recon.mha --projections projections.mha --niterations 20 --verbose +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkvectorconjugategradient/rtkvectorconjugategradient.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkwaveletsdenoising/README.md b/applications/rtkwaveletsdenoising/README.md new file mode 100644 index 000000000..bf39e2534 --- /dev/null +++ b/applications/rtkwaveletsdenoising/README.md @@ -0,0 +1,19 @@ +# Wavelets Denoising + +Denoises a volume using Daubechies wavelets soft-thresholding. + +```bash +rtkwaveletsdenoising -i noisy.mha -o denoised.mha --order 5 --level 3 --threshold 0.02 --verbose +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkwaveletsdenoising/rtkwaveletsdenoising.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/applications/rtkxradgeometry/README.md b/applications/rtkxradgeometry/README.md new file mode 100644 index 000000000..dced5e41a --- /dev/null +++ b/applications/rtkxradgeometry/README.md @@ -0,0 +1,27 @@ +# XRad Geometry + +Creates an RTK geometry XML file from an acquisition exported by the XRad system. + +The public RTK test data for XRad includes these sample files: + +- [SolidWater_HiGain1x1.header](https://data.kitware.com/api/v1/item/5b179cd68d777f15ebe20266/download) + +`rtkxradgeometry` reads the geometry from the acquisition header. + +```bash +rtkxradgeometry \ + -i SolidWater_HiGain1x1.header \ + -o geometry.xml +``` + + +## Command line options + +::::{container} argparse-no-usage +```{eval-rst} +.. argparse:: + :filename: applications/rtkxradgeometry/rtkxradgeometry.py + :func: build_parser + :nodescription: +``` +:::: diff --git a/conf.py b/conf.py index 4d3495724..627c24517 100644 --- a/conf.py +++ b/conf.py @@ -35,6 +35,7 @@ def setup(app): extensions = [ "myst_parser", "sphinx.ext.autodoc", + "sphinxarg.ext", "sphinx_copybutton", "sphinx_design", "sphinx.ext.graphviz", @@ -74,7 +75,8 @@ def setup(app): # Add any paths that contain custom static files (such as style sheets or icons) # here, relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = [] +html_static_path = ["documentation/docs/_static"] +html_css_files = ["custom.css"] html_logo = "https://www.openrtk.org/opensourcelogos/rtk75.png" html_title = f"{project}'s documentation" html_favicon = "https://www.openrtk.org/RTK/img/rtk_favicon.ico" diff --git a/documentation/docs/ExternalData/Denoised-fdk.png.sha512 b/documentation/docs/ExternalData/Denoised-fdk.png.sha512 new file mode 100644 index 000000000..86ea7ffa3 --- /dev/null +++ b/documentation/docs/ExternalData/Denoised-fdk.png.sha512 @@ -0,0 +1 @@ +61489291b9f84b816a44790a58960357a6cc1067004dcff96985a076e582eddd89fab5d001e66d742ef87dcd03a17768acc27ba694a1b0b241293d45218ff117 diff --git a/documentation/docs/ExternalData/Noisy-fdk.png.sha512 b/documentation/docs/ExternalData/Noisy-fdk.png.sha512 new file mode 100644 index 000000000..7ac14f462 --- /dev/null +++ b/documentation/docs/ExternalData/Noisy-fdk.png.sha512 @@ -0,0 +1 @@ +12747297c26cd37d42d5fe073fbcf1db5f853319a61fcc165572ab3c5d20e8f45e0bbf02e4aa27ae56f148cc68563fdc191c73cd23fcdf3bf9501b5a752af1a2 diff --git a/documentation/docs/_static/custom.css b/documentation/docs/_static/custom.css new file mode 100644 index 000000000..8074e8498 --- /dev/null +++ b/documentation/docs/_static/custom.css @@ -0,0 +1,5 @@ +.argparse-no-usage > div.highlight-default.notranslate, +.argparse-no-usage > div.highlight-none.notranslate, +.argparse-no-usage > div.highlight { + display: none; +} diff --git a/documentation/docs/applications/Geometry.md b/documentation/docs/applications/Geometry.md new file mode 100644 index 000000000..1aee8b370 --- /dev/null +++ b/documentation/docs/applications/Geometry.md @@ -0,0 +1,17 @@ +# Geometry + +RTK provides utilities to convert vendor and model specific acquisition geometry formats into RTK's geometry. +`rtkshowgeometry`allow to see the resulting geometry interactively. + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkshowgeometry/README.md +../../../applications/rtkvarianobigeometry/README.md +../../../applications/rtkelektasynergygeometry/README.md +../../../applications/rtkdigisensgeometry/README.md +../../../applications/rtkimagxgeometry/README.md +../../../applications/rtkorageometry/README.md +../../../applications/rtkxradgeometry/README.md +../../../applications/rtkbioscangeometry/README.md +``` diff --git a/documentation/docs/applications/Motion_and_Phase_Analysis.md b/documentation/docs/applications/Motion_and_Phase_Analysis.md new file mode 100644 index 000000000..d2358b471 --- /dev/null +++ b/documentation/docs/applications/Motion_and_Phase_Analysis.md @@ -0,0 +1,12 @@ +# Motion & Phase Analysis + +Applications for extracting respiratory signal, estimating phase, and visualizing motion-related signals from projection data. + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkamsterdamshroud/README.md +../../../applications/rtkextractshroudsignal/README.md +../../../applications/rtkextractphasesignal/README.md +../../../applications/rtkoverlayphaseandshroud/README.md +``` diff --git a/documentation/docs/applications/Phantoms_and_Forward_Models.md b/documentation/docs/applications/Phantoms_and_Forward_Models.md new file mode 100644 index 000000000..10b881320 --- /dev/null +++ b/documentation/docs/applications/Phantoms_and_Forward_Models.md @@ -0,0 +1,15 @@ +# Simulation & Forward Models + +Utilities to create synthetic phantoms, simulate projection data, and document +forward/backprojection models and related simulation tools. + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkprojectgeometricphantom/README.md +../../../applications/rtkprojectshepploganphantom/README.md +../../../applications/rtkdrawgeometricphantom/README.md +../../../applications/rtkdrawshepploganphantom/README.md +../../../applications/rtkforwardprojections/README.md +../../../applications/rtkspectralforwardmodel/README.md +``` diff --git a/documentation/docs/applications/Projection_Processing.md b/documentation/docs/applications/Projection_Processing.md new file mode 100644 index 000000000..1b09891b0 --- /dev/null +++ b/documentation/docs/applications/Projection_Processing.md @@ -0,0 +1,16 @@ +# Projection Processing + +Processing tools for projection stacks: gain and offset correction, normalization, masking, and related preparation steps before reconstruction. + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkscatterglarecorrection/README.md +../../../applications/rtkgaincorrection/README.md +../../../applications/rtklagcorrection/README.md +../../../applications/rtkmaskcollimation/README.md +../../../applications/rtki0estimation/README.md +../../../applications/rtkprojections/README.md +../../../applications/rtksubselect/README.md +../../../applications/rtkfieldofview/README.md +``` diff --git a/documentation/docs/applications/Reconstruction.md b/documentation/docs/applications/Reconstruction.md new file mode 100644 index 000000000..74a330acf --- /dev/null +++ b/documentation/docs/applications/Reconstruction.md @@ -0,0 +1,56 @@ +# Reconstruction + +Core reconstruction algorithms and related post-processing methods used to produce volumes from projections. + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkfdk/README.md +../../../applications/rtkbackprojections/README.md +``` + +## Iterative reconstruction + +```{toctree} +:maxdepth: 1 + +../../../applications/rtksart/README.md +../../../applications/rtkosem/README.md +../../../applications/rtkconjugategradient/README.md +../../../applications/rtkregularizedconjugategradient/README.md +../../../applications/rtkiterativefdk/README.md +../../../applications/rtkvectorconjugategradient/README.md +../../../applications/rtkadmmtotalvariation/README.md +../../../applications/rtkadmmwavelets/README.md +``` + +## 4D reconstruction + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkfourdfdk/README.md +../../../applications/rtkfourdconjugategradient/README.md +../../../applications/rtkfourdsart/README.md +../../../applications/rtkfourdrooster/README.md +``` + +## Spectral reconstruction + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkspectralonestep/README.md +../../../applications/rtkspectralsimplexdecomposition/README.md +../../../applications/rtkspectralrooster/README.md +../../../applications/rtkspectraldenoiseprojections/README.md +``` + +## Reconstruction post-processing + +```{toctree} +:maxdepth: 1 + +../../../applications/rtktotalvariationdenoising/README.md +../../../applications/rtkwaveletsdenoising/README.md +``` diff --git a/documentation/docs/applications/Utilities.md b/documentation/docs/applications/Utilities.md new file mode 100644 index 000000000..e19bb4a3c --- /dev/null +++ b/documentation/docs/applications/Utilities.md @@ -0,0 +1,9 @@ +# Utilities + +RTK utilities applications + +```{toctree} +:maxdepth: 1 + +../../../applications/rtkcheckimagequality/README.md +``` diff --git a/documentation/docs/requirements.txt b/documentation/docs/requirements.txt index 3ef79bcc8..bbd0e2994 100644 --- a/documentation/docs/requirements.txt +++ b/documentation/docs/requirements.txt @@ -4,3 +4,5 @@ myst-parser[linkify] sphinx>=7.2.6 sphinx-copybutton sphinx-design +sphinx-argparse +itk-rtk \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d7b397b61..f4d5901e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,6 +177,7 @@ doc = [ "furo", "myst-parser[linkify]", "sphinx>=7.2.6", + "sphinx-argparse", "sphinx-copybutton", "sphinx-design", ]