tomobar.methodsIR_CuPy
#
Reconstruction class for regularised iterative methods using CuPy library.
- Regularised FISTA algorithm (A. Beck and M. Teboulle, A fast iterative
shrinkage-thresholding algorithm for linear inverse problems, SIAM Journal on Imaging Sciences, vol. 2, no. 1, pp. 183–202, 2009.)
- class tomobar.methodsIR_CuPy.RecToolsIRCuPy(DetectorsDimH, DetectorsDimV, CenterRotOffset, AnglesVec, ObjSize, datafidelity='LS', device_projector=0, cupyrun=True)[source]#
Bases:
tomobar.methodsIR.RecToolsIR
CuPy-enabled iterative reconstruction algorithms using ASTRA toolbox, CCPi-RGL toolkit. Parameters for reconstruction algorithms are extracted from three dictionaries: _data_, _algorithm_ and _regularisation_. See API for tomobar.supp.dicts function for all parameters that are accepted.
If FISTA is used it will require CuPy-enabled routines of the CCPi-regularisation toolkit. This implementation is typically >3 times faster than one in RecToolsIR, however please note that the functionality of FISTA is limited compared to the version of FISTA in RecToolsIR. The work is in progress and the current FISTA version is experimental.
- 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 (int) – Provide a GPU index (integer) of a specific GPU device.
cupyrun (bool, optional) – instantiate CuPy modules.
- CGLS(_data_: dict, _algorithm_: Optional[dict] = None) <Mock name='mock.ndarray' id='140540124709696'> [source]#
- Conjugate Gradients Least Squares iterative technique to reconstruct projection data
given as a CuPy array. We aim to solve the system of normal equations A.T*A*x = A.T*b.
- Parameters
_data_ (dict) – Data dictionary, where projection data is provided.
_algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.
- Returns
The CGLS-reconstructed volume as a CuPy array.
- Return type
cp.ndarray
- FISTA(_data_: dict, _algorithm_: Optional[dict] = None, _regularisation_: Optional[dict] = None) <Mock name='mock.ndarray' id='140540124709696'> [source]#
- A Fast Iterative Shrinkage-Thresholding Algorithm with various types regularisations.
The parameters for the algorithm should be provided in three dictionaries: _data_, _algorithm_ and _regularisation_. See API for tomobar.supp.dicts function for all parameters that are accepted. Please note that not all of the functionality supported compared to FISTA from 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.
- Returns
FISTA-reconstructed 3D cupy array
- Return type
cp.ndarray
- Landweber(_data_: dict, _algorithm_: Optional[dict] = None) <Mock name='mock.ndarray' id='140540124709696'> [source]#
- Using Landweber iterative technique to reconstruct projection data given as a CuPy array.
We perform the following iterations: x_k+1 = x_k - tau*A.T(A(x_k) - b)
- 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_: Optional[dict] = None) <Mock name='mock.ndarray' id='140540124709696'> [source]#
- Using Simultaneous Iterations Reconstruction Technique (SIRT) iterative technique to
reconstruct projection data given as a CuPy array. We perform the following iterations:: x_k+1 = C*A.T*R(b - A(x_k))
- Parameters
_data_ (dict) – Data dictionary, where projection data is provided.
_algorithm_ (dict, optional) – Algorithm dictionary where algorithm parameters are provided.
- Returns
The SIRT-reconstructed volume as a CuPy array.
- Return type
cp.ndarray
- 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 (self.datafidelity = PWLS), otherwise will be ignored.
- Parameters
_data_ (dict) – Data dictionary, where input data as a cupy array is provided.
- Returns
the Lipschitz constant
- Return type
float