Awesome
Numerical Solver Library
The Numerical Solver Library (NSoL) is a Python-based open-source toolkit for research developed within the GIFT-Surg project and contains several implementations of denoising and deconvolution algorithms.
The algorithm and software were developed by Michael Ebner at the Wellcome/EPSRC Centre for Interventional and Surgical Sciences, University College London (UCL) (2015 -- 2019), and the Department of Surgical and Interventional Sciences, King's College London (KCL) (since 2019).
If you have any questions or comments, please drop an email to michael.ebner@kcl.ac.uk
.
Features
Implemented solvers include
- Primal-Dual Methods as described in [Chambolle and Pock, 2010]
- Alternating Direction Method of Multipliers (ADMM) as described in, e.g., [Diamond and Boyd, 2015]
to solve
- L1- and L2-denoising problems, i.e.
- robust L2-deconvolution problems, i.e.
in 1D, 2D or 3D for a variety of regularizers and data loss functions .
The available regularizers, depending on the minimization problem, include
<!-- * Zeroth-order Tikhonov (TK0): $`\text{Reg}(\vec{x}) = \frac{1}{2}\Vert \vec{x} \Vert_{\ell^2}^2`$ --> <!-- * First-order Tikhonov (TK1): $`\text{Reg}(\vec{x}) = \frac{1}{2}\Vert \nabla \vec{x} \Vert_{\ell^2}^2`$ --> <!-- * Isotropic Total Variation (TV): $`\text{Reg}(\vec{x}) = \text{TV}_\text{iso}(\vec{x}) = \big\Vert |\nabla \vec{x}| \big\Vert_{\ell^1}`$ --> <!-- * Huber Function: $`\text{Reg}(\vec{x}) = \frac{1}{2\gamma} \big| |\nabla \vec{x}| \big|_{\gamma}`$ -->- Zeroth-order Tikhonov (TK0): <img src="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x})&space;=&space;\frac{1}{2}\Vert&space;\vec{x}&space;\Vert_{\ell^2}^2" title="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x}) = \frac{1}{2}\Vert \vec{x} \Vert_{\ell^2}^2" />
- First-order Tikhonov (TK1): <img src="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x})&space;=&space;\frac{1}{2}\Vert&space;\nabla&space;\vec{x}&space;\Vert_{\ell^2}^2" title="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x}) = \frac{1}{2}\Vert \nabla \vec{x} \Vert_{\ell^2}^2" />
- Isotropic Total Variation (TV): <img src="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x})&space;=&space;\text{TV}_\text{iso}(\vec{x})&space;=&space;\big\Vert&space;|\nabla&space;\vec{x}|&space;\big\Vert_{\ell^1}" title="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x}) = \text{TV}_\text{iso}(\vec{x}) = \big\Vert |\nabla \vec{x}| \big\Vert_{\ell^1}" />
- Huber Function: <img src="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x})&space;=&space;\frac{1}{2\gamma}&space;\big|&space;|\nabla&space;\vec{x}|&space;\big|_{\gamma}" title="http://latex.codecogs.com/svg.latex?\text{Reg}(\vec{x}) = \frac{1}{2\gamma} \big| |\nabla \vec{x}| \big|_{\gamma}" />
Data loss functions are motivated by SciPy and allow for robust outlier rejection. Implemented data loss functions are:
<!--$`\varrho(e)=e`$--> <!--$`\varrho(e)=2(\sqrt{1+e}-1)`$ --> <!--$`\varrho(e)=|e|_\gamma=\begin{cases}e,&e<\gamma^2\\2\gamma\sqrt{e}-\gamma^2,&e\ge\gamma^2\end{cases}`$--> <!--$`\varrho(e)=\arctan(e)`$--> <!--$`\varrho(e)=\ln(1 + e)`$-->linear
: <img src="http://latex.codecogs.com/svg.latex?\varrho(e)=e" title="http://latex.codecogs.com/svg.latex?\varrho(e)=e" />soft_l1
: <img src="http://latex.codecogs.com/svg.latex?\varrho(e)=2(\sqrt{1+e}-1)" title="http://latex.codecogs.com/svg.latex?\varrho(e)=2(\sqrt{1+e}-1)" />huber
: <img src="http://latex.codecogs.com/svg.latex?\varrho(e)=|e|_\gamma=\begin{cases}e,&e<\gamma^2\\2\gamma\sqrt{e}-\gamma^2,&e\ge\gamma^2\end{cases}" title="http://latex.codecogs.com/svg.latex?\varrho(e)=|e|_\gamma=\begin{cases}e,&e<\gamma^2\\2\gamma\sqrt{e}-\gamma^2,&e\ge\gamma^2\end{cases}" />arctan
: <img src="http://latex.codecogs.com/svg.latex?\varrho(e)=\arctan(e)" title="http://latex.codecogs.com/svg.latex?\varrho(e)=\arctan(e)" />cauchy
: <img src="http://latex.codecogs.com/svg.latex?\varrho(e)=\ln(1&space;+&space;e)" title="http://latex.codecogs.com/svg.latex?\varrho(e)=\ln(1 + e)" />
Additionally, the choice of finding optimal reconstruction parameters is facilitated by providing several evaluation methods including
- L-curve studies, and
- the evaluation of similarity measures (in case a reference image is available)
in the course of parameter studies. Implemented similarity measures are
- Sum of Squared Differences (SSD)
- Mean Absolute Error (MAE)
- Mean Square Error (MSE)
- Root Mean Square Error (RMSE)
- Peak-Signal-to-Noise Ratio (PSNR)
- Mutual Information (MI)
- Normalized Mutual Information (NMI)
- Structural Similarity (SSIM)
- Normalized Cross Correlation (NCC)
Installation
NSoL was developed in
- Mac OS X 10.10 and 10.12
- Ubuntu 14.04 and 16.04
and tested for Python 2.7.12 and 3.5.2.
In case NSoL is used in conjuction with any of the toolkits of NiftyMIC, Volumetric Reconstruction From Printed Films or SimpleReg, please
- install ITK_NiftyMIC
If NSoL is used standalone, please run instead
pip install itk
Afterwards, clone this repository via
git clone git@github.com:gift-surg/NSoL.git
where all remaining dependencies can be installed using pip
:
pip install -e .
Usage
Denoising
TVL1/TVL2/HuberL2/HuberL1 Denoising can be run via
nsol_run_denoising \
--observation path-to-observation-png-nii-mat \
--result path-to-denoised-result-png-nii-mat \
--reconstruction-type TVL1 \
--alpha 0.05 \
--iterations 50
nsol_run_denoising \
--observation path-to-observation-png-nii-mat \
--reference path-to-reference-png-nii-mat \
--result path-to-denoised-result-png-nii-mat \
--reconstruction-type TVL1 \
--alpha 0.05 \
--iterations 50
Deconvolution
Examples for TK0L2/TK1L2/TVL2/HuberL2 deconvolution calls are
nsol_run_deconvolution \
--observation path-to-observation-png-nii-mat \
--result path-to-denoised-result-png-nii-mat \
--reconstruction-type HuberL2 \
--blur 1.2 \
--alpha 0.05 \
--iterations 50
nsol_run_deconvolution \
--observation path-to-observation-png-nii-mat \
--reference path-to-reference-png-nii-mat \
--result path-to-denoised-result-png-nii-mat \
--reconstruction-type HuberL2 \
--alpha 0.05 \
--blur 1.2 \
--iterations 50 \
--data-loss soft_l1 \
--minimizer L-BFGS-B
Parameter Studies
Parameter studies for the denoising problem (and, similarly, for deconvolution problem) can be performed by, e.g.,
nsol_run_denoising_study \
--observation path-to-observation-png-nii-mat \
--dir-output path-to-parameter-study \
--reference path-to-reference-png-nii-mat \
--reconstruction-type TVL2 \
--study-name TVL2-Denoising \
--measures RMSE PSNR NCC NMI SSIM \
--alpha-range 0.001 0.05 20
The results can be visualized by
nsol_show_parameter_study \
--dir-input path-to-parameter-study \
--study-name TVL2-Denoising \
--dir-output-figures dir-to-figures
Licensing and Copyright
Copyright (c) 2020 Michael Ebner and contributors. This framework is made available as free open-source software under the BSD-3-Clause License. Other licenses may apply for dependencies.
Funding
This work is partially funded by the UCL Engineering and Physical Sciences Research Council (EPSRC) Centre for Doctoral Training in Medical Imaging (EP/L016478/1), the Innovative Engineering for Health award (Wellcome Trust [WT101957] and EPSRC [NS/A000027/1]), and supported by researchers at the National Institute for Health Research University College London Hospitals (UCLH) Biomedical Research Centre.
References
Associated publications are
- [Ebner2019] Ebner, M., Patel, P. A., Atkinson, D., Caselton, C., Firmin, F., Amin, Z., Bainbridge, A., De Coppi, P., Taylor, S. A., Ourselin, S., Chouhan, M. D., & Vercauteren, T. (2019). Super‐resolution for upper abdominal MRI: Acquisition and post‐processing protocol optimization using brain MRI control data and expert reader validation. Magnetic Resonance in Medicine.
- [EbnerWang2018] Ebner, M., Wang, G., Li, W., Aertsen, M., Patel, P. A., Melbourne, A., Doel, T., David, A. L., Deprest, J., Ourselin, S., & Vercauteren, T. (2018). An Automated Localization, Segmentation and Reconstruction Framework for Fetal Brain MRI. In Medical Image Computing and Computer-Assisted Intervention -- MICCAI 2018 (pp. 313–320). Springer
- [Ebner2018] Ebner, M., Chung, K. K., Prados, F., Cardoso, M. J., Chard, D. T., Vercauteren, T., & Ourselin, S. (2018). Volumetric reconstruction from printed films: Enabling 30 year longitudinal analysis in MR neuroimaging. NeuroImage, 165, 238–250.
- [Xie2017] Xie, Y., Thom, M., Ebner, M., Wykes, V., Desjardins, A., Miserocchi, A., Ourselin, S., McEvoy, A. W., and Vercauteren, T. (2017). Wide-field spectrally resolved quantitative fluorescence imaging system: toward neurosurgical guidance in glioma resection. Journal of Biomedical Optics, 22(11).
- [Ranzini2017] Ranzini, M. B., Ebner, M., Cardoso, M. J., Fotiadou, A., Vercauteren, T., Henckel, J., Hart, A., Ourselin, S., and Modat, M. (2017). Joint Multimodal Segmentation of Clinical CT and MR from Hip Arthroplasty Patients. MICCAI Workshop on Computational Methods and Clinical Applications in Musculoskeletal Imaging (MSKI) 2017.
- [Ebner2017] Ebner, M., Chouhan, M., Patel, P. A., Atkinson, D., Amin, Z., Read, S., Punwani, S., Taylor, S., Vercauteren, T., and Ourselin, S. (2017). Point-Spread-Function-Aware Slice-to-Volume Registration: Application to Upper Abdominal MRI Super-Resolution. In Zuluaga, M. A., Bhatia, K., Kainz, B., Moghari, M. H., and Pace, D. F., editors, Reconstruction, Segmentation, and Analysis of Medical Images. RAMBO 2016, volume 10129 of Lecture Notes in Computer Science, pages 3–13. Springer International Publishing.