tomobar.methodsIR_CuPy#

Reconstruction class for regularised iterative methods using CuPy library.

class tomobar.methodsIR_CuPy.RecToolsIRCuPy(DetectorsDimH: int, DetectorsDimH_pad: int, DetectorsDimV: int | None, CenterRotOffset: float | <cp.ndarray>, AnglesVec: <cp.ndarray>, ObjSize: int, device_projector: int = 0, OS_number: int | None = None)[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_. See tomobar.supp.dicts function of ToMoBAR’s API reference for all parameters explained.

Parameters:
  • DetectorsDimH (int) – Horizontal detector dimension size.

  • DetectorsDimH_pad (int) – The amount of padding for the horizontal detector.

  • DetectorsDimV (int, None) – Vertical detector dimension size, ‘None’ for 2D or an integer for 3D

  • CenterRotOffset (float, np.ndarray) – 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].

  • device_projector (int, optional) – Provide a GPU index of a specific GPU device. Defaults to 0.

  • OS_number (int, optional) – The number of ordered-subset, set to None for non-OS reconstruction

ADMM(_data_: dict, _algorithm_: dict | None = None, _regularisation_: dict | None = None) <cp.ndarray>[source]#

Linearised and Relaxed Alternating Directions Method of Multipliers with various types of regularisation and data fidelity terms provided in three dictionaries, see tomobar.supp.dicts

Parameters:
  • _data_ (dict) – Data dictionary, where input data (raw counts) is provided.

  • _algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.

  • _regularisation_ (dict, optional) – Regularisation dictionary.

Returns:

ADMM-reconstructed CuPy array

Return type:

xp.ndarray

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_. See tomobar.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 to RecToolsIR.FISTA() from tomobar.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

OSEM(_data_: dict, _algorithm_: dict | None = None, _regularisation_: dict | None = None) <cp.ndarray>[source]#

Ordered Subsets Expectation Maximization (OSEM) or MLEM when OS_number=1 for emission data with various types of regularisation and data fidelity terms provided in three dictionaries, see tomobar.supp.dicts

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.

Returns:

OSEM-reconstructed CuPy array

Return type:

xp.ndarray

property OS_number: int#
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 objsize_user_given: int#
powermethod(_data_: dict) float[source]#

Power iteration algorithm to calculate the eigenvalue of the operator (projection matrix).

Parameters:

_data_ (dict) – Data dictionary, where input data is provided.

Returns:

the Lipschitz constant

Return type:

float