tomobar.methodsIR_CuPy
#
Reconstruction class for regularised iterative methods using CuPy library.
RecToolsIRCuPy.FISTA()
iterative regularised algorithm [BT2009], [Xu2016]. Implemented with the help of ASTRA’s DirectLink experimental feature.RecToolsIRCuPy.Landweber()
algorithm.RecToolsIRCuPy.SIRT()
algorithm.RecToolsIRCuPy.CGLS()
algorithm.
- class tomobar.methodsIR_CuPy.RecToolsIRCuPy(DetectorsDimH, DetectorsDimH_pad, DetectorsDimV, CenterRotOffset, AnglesVec, ObjSize, datafidelity='LS', device_projector=0, cupyrun=True)[source]#
Bases:
object
CuPy-enabled iterative reconstruction algorithms using ASTRA toolbox for forward/back projection. Parameters for reconstruction algorithms should be provided in three dictionaries:
_data_
,_algorithm_
, and_regularisation_
. Seetomobar.supp.dicts
function of ToMoBAR’s API reference for all parameters explained.This implementation is typically several times faster than the one in
RecToolsIR.FISTA()
oftomobar.methodsIR
, but not all functionality is supported yet.- Parameters:
DetectorsDimH (int) – Horizontal detector dimension size.
DetectorsDimH_pad (int) – The amount of padding for the horizontal detector.
DetectorsDimV (int) – Vertical detector dimension size.
CenterRotOffset (float) – The Centre of Rotation (CoR) scalar or a vector for each angle.
AnglesVec (np.ndarray) – Vector of projection angles in radians.
ObjSize (int) – The size of the reconstructed object (a slice) defined as [recon_size, recon_size].
datafidelity (str, optional) – Data fidelity, choose from LS and PWLS. Defaults to LS.
device_projector (int, optional) – Provide a GPU index of a specific GPU device. Defaults to 0.
cupyrun (bool, optional) – instantiate CuPy modules.
- CGLS(_data_: dict, _algorithm_: dict | None = None) <cp.ndarray> [source]#
Conjugate Gradients Least Squares iterative technique to reconstruct projection data given as a CuPy array. See more about the method here.
- Parameters:
_data_ (dict) – Data dictionary, where projection data is provided.
_algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.
- Returns:
CGLS-reconstructed volume as a CuPy array.
- Return type:
cp.ndarray
- FISTA(_data_: dict, _algorithm_: dict | None = None, _regularisation_: dict | None = None) <cp.ndarray> [source]#
A Fast Iterative Shrinkage-Thresholding Algorithm [BT2009] with various types of regularisation from the regularisation toolkit [KAZ2019] (currently accepts ROF_TV and PD_TV only). See more about the method here.
All parameters for the algorithm should be provided in three dictionaries:
_data_
,_algorithm_
, and_regularisation_
. Seetomobar.supp.dicts
function of ToMoBAR’s API reference for all parameters explained. Please note that not all of the functionality supported in this CuPy implementation compared toRecToolsIR.FISTA()
fromtomobar.methodsIR
.- Parameters:
_data_ (dict) – Data dictionary, where input data is provided.
_algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.
_regularisation_ (dict, optional) – Regularisation dictionary, currently accepts ROF_TV and PD_TV only.
- Returns:
FISTA-reconstructed 3D CuPy array
- Return type:
cp.ndarray
- Landweber(_data_: dict, _algorithm_: dict | None = None) <cp.ndarray> [source]#
Using Landweber iterative technique to reconstruct projection data given as a CuPy array.
- Parameters:
_data_ (dict) – Data dictionary, where projection data is provided.
_algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.
- Returns:
The Landweber-reconstructed volume as a CuPy array.
- Return type:
cp.ndarray
- SIRT(_data_: dict, _algorithm_: dict | None = None) <cp.ndarray> [source]#
Using Simultaneous Iterations Reconstruction Technique (SIRT) iterative technique to reconstruct projection data given as a CuPy array. See more about the method here.
- Parameters:
_data_ (dict) – Data dictionary, where projection data is provided.
_algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.
- Returns:
SIRT-reconstructed volume as a CuPy array.
- Return type:
cp.ndarray
- property cupyrun: int#
- property datafidelity: int#
- property objsize_user_given: int#
- powermethod(_data_: dict) float [source]#
Power iteration algorithm to calculate the eigenvalue of the operator (projection matrix). projection_raw_data is required for the PWLS fidelity, otherwise will be ignored.
- Parameters:
_data_ (dict) – Data dictionary, where input data is provided.
- Returns:
the Lipschitz constant
- Return type:
float