A Python code to Remove Motion Artifacts In Dynamic Computed Tomography. This is the code used in this article.
- Piecewise Linear Interpolation (PLI) in time to augment time resolution by factor a of M and reduce motion artifact in CT.
- Use parallel CT forward and backward projectors from the ASTRA Toolbox (PyRAMID-CT currently only supports parallel beam geometries).
- Calculations on single or double precision, on GPU or CPU.
- 3D+time regularization using Total Variation (TV) from PyTV-4D.
- Two algorithms available: sub-gradient descent, and proximal algorithm from Chambolle and Pock (recommended).
- Calculations accelerated on GPU using PyTorch CUDA implementation.
The recommended setup is to use a new conda environment with python 3.7. Use the below one-line install that takes care of dependencies (if the dependency solve is slow with conda, checkout mamba):
conda install -c conda-forge -c pytorch -c astra-toolbox/label/dev -c eboigne pyramid_ct
Once installed, you can run some basic tests in python:
import pyramid_ct
pyramid_ct.run_tests()
If you're having trouble with PyTorch running on GPU: install PyTorch first manually following the guidelines on the official website. Make sure that a GPU version of PyTorch is installed. The installation of PyTorch should be similar to:
conda install -c pytorch cudatoolkit=11.3 pytorch
PyRAMID-CT can also be installed manually by cloning the repo locally and installing with (dependencies need to be set properly):
python setup.py install
import pyramid_ct
# Load an example static phantom (without any motion)
sino_static = pyramid_ct.utils.example_moving_phantom()
# Run the Chambolle-Pock algorithm for 200 iterations
case = pyramid_ct.Case()
case.set_sinogram_data(sino_static)
case.nb_it = 200
case.run()
See the getting started Jupyter notebook in the examples folder.
The reconstructed data is written in images slices written in .tif format. Fiji is recommended for post-processing the reconstructed CT datasets. These .tif stacks can be easily read in Fiji by drag and dropping the stack folder.
Please refer to the following article in your publications if you use PyRAMID-CT for your research:
@article{boigne2022towards,
author={Boign{\'e}, Emeric and Parkinson, Dilworth Y. and Ihme, Matthias},
journal={{IEEE Transactions on Computational Imaging}},
title={{Towards data-informed motion artifact reduction in quantitative CT using piecewise linear interpolation}},
year={2022},
volume={8},
pages={917-932},
doi={10.1109/TCI.2022.3215096}
}
PyRAMID-CT is open source under the GPLv3 license.