This is a python package for ML approaches for handling Micro-CT Data. Functionality will be expanded over time.
Current functionality is limited to a denoising approach for reconstructed data using an unsupervised (inference-only) model.
- First, an Ansecombe transform is applied to the noisy images with correlated noise (G+P).
- Since the inter-slice width is negligible, the change in signal between two consecutive slices is approximately 0.
- However, noise varies between the two slices. Patches from slice[i] were used as input and the corresponding slice[i+1] patch was used as target.
- Over iterated epochs, the unet learns the mean of the observations (true signal) and produces a clean image.
Two pretrained weight sets are available:
module/denoise_phase.pt
module/denoise_nophase.pt
Both samples were trained on a dataset of 4976 13568x13568 reconstruction slices. The first was trained on a dataset with phase retrieval[1] applied, the second was not.
python ctml --data-dir data/train --weights data/final.pt --cuda utraining --nb-epochs 100
For full paramter listing see
python ctml --help
python ctml utraining --help
The finalized model is applied to the input file in patches, that are merged together.
python ctml --data-dir data/train --weights data/denoise_phase.pt --cuda udenoise --output-dir=data/clean
For full paramter listing see
python ctml --help
python ctml udenoise --help
(Note that the batch-size parameter listed in python ctml --help is ignored here due to limitations of empatches).
- Data is assumed to be float32.
- Model cannot remove ring artifacts.
- While CUDA is technically not required, model is too computationally intensive for straight CPU usage.
-
Install CUDA as appropriate for your OS, if not already installed.
-
Create and activate a conda environment, which is necessary for use of CUDA GPU tools.
-
Install Pytorch. Links below as per time of writing.
- CUDA >= 11.7: Current Version
- CUDA < 11.7: Old Version
As this will limit available python versions and is hardware dependent, should be done before installing other requirements.
-
Install requirements via conda or pip:
conda env update -f ctml.yaml
pip install -r requirements.txtNote that pytorch is required but not listed in the requirements due to variance in CUDA version requirements.
[1] Paganin, David, et al. "Simultaneous phase and amplitude extraction from a single defocused image of a homogeneous object." Journal of microscopy 206.1 (2002): 33-40.