tomobar.methodsIR#

Reconstruction class for regularised iterative methods (2D/3D).

class tomobar.methodsIR.RecToolsIR(DetectorsDimH, DetectorsDimV, CenterRotOffset, AnglesVec, ObjSize, datafidelity='LS', device_projector='gpu', cupyrun=False)[source]#

Bases: object

Iterative reconstruction algorithms (FISTA and ADMM) using ASTRA toolbox and CCPi-RGL toolkit. 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.

  • DetectorsDimV (int) – Vertical detector dimension for 3D case, 0 or None for 2D case.

  • 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) – Reconstructed object dimensions (a scalar).

  • datafidelity (str) – Data fidelity, choose from LS, KL, PWLS or SWLS.

  • device_projector (str, int) – ‘cpu’ or ‘gpu’ device OR provide a GPU index (integer) of a specific GPU device.

  • cupyrun (bool, optional) – instantiate CuPy modules.

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

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 is provided.

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

  • _regularisation_ (dict, optional) – Regularisation dictionary.

Returns:

ADMM-reconstructed numpy array

Return type:

xp.ndarray

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

Conjugate Gradient Least Squares from ASTRA toolbox.

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

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

Returns:

CGLS-reconstructed numpy array

Return type:

xp.ndarray

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

A Fast Iterative Shrinkage-Thresholding Algorithm with various types of regularisation and data fidelity terms provided in three dictionaries. See tomobar.supp.dicts for all parameters to the dictionaries bellow.

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:

FISTA-reconstructed numpy array

Return type:

np.ndarray

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

Simultaneous Iterations Reconstruction Technique from ASTRA toolbox.

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

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

Returns:

SIRT-reconstructed numpy array

Return type:

xp.ndarray

property cupyrun: int#
property datafidelity: int#
powermethod(_data_: dict) float[source]#

Power iteration algorithm to calculate the eigenvalue of the operator (projection matrix). projection_raw_data is required for PWLS fidelity, otherwise will be ignored.

Parameters:

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

Returns:

the Lipschitz constant

Return type:

float