httomolibgpu.recon.algorithm#

Module for tomographic reconstruction. For more detailed information, see Image reconstruction methods

httomolibgpu.recon.algorithm.ADMM3d_tomobar(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, recon_size: int | None = None, recon_mask_radius: float = 0.95, iterations: int = 3, subsets_number: int = 24, initialisation: str | None = 'FBP', ADMM_rho_const: float = 1.0, ADMM_relax_par: float = 1.7, regularisation_type: str = 'PD_TV', regularisation_parameter: float = 0.0025, regularisation_iterations: int = 40, regularisation_half_precision: bool = True, nonnegativity: bool = False, gpu_id: int = 0) <cp.ndarray>[source]#

An Alternating Direction Method of Multipliers method with various types of regularisation or denoising operations [6] (currently accepts ROF_TV and PD_TV regularisations only). For more information see _method_ADMM3d_tomobar.

Parameters:
  • data (cp.ndarray) – Projection data as a CuPy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

  • iterations (int) – The number of ADMM algorithm iterations. The recommended range is between 3 to 5 with initialisation and more than 10 without. Assuming that the subsets_number is reasonably large (>12).

  • subsets_number (int) – The number of the ordered subsets to accelerate convergence. The recommended range is between 12 to 24.

  • initialisation (str, optional) – Initialise ADMM with the reconstructed image to reduce the number of iterations and accelerate. Choose between ‘CGLS’ when data is noisy and undersampled, ‘FBP’ when data is of better quality (default) or None.

  • ADMM_rho_const (float) – Convergence related parameter for ADMM, higher values lead to slower convergence, but too small values can destabilise the iterations. Recommended range is between 0.9 and 2.0.

  • ADMM_relax_par (Relaxation parameter which can lead to acceleration of the algorithm, keep it in the range between 1.5 and 1.8 to avoid divergence. regularisation_type: str) – A method to use for regularisation. Currently PD_TV and ROF_TV are available.

  • regularisation_parameter (float) – The main regularisation parameter to control the amount of smoothing/noise removal. Larger values lead to stronger smoothing.

  • regularisation_iterations (int) – The number of iterations for regularisers (aka INNER iterations).

  • regularisation_half_precision (bool) – Perform faster regularisation computation in half-precision with a very minimal sacrifice in quality.

  • nonnegativity (bool) – Impose nonnegativity constraint (set to True) on the reconstructed image. Default False.

  • gpu_id (int) – A GPU device index to perform operation on.

Returns:

The ADMM reconstructed volume as a CuPy array.

Return type:

cp.ndarray

httomolibgpu.recon.algorithm.CGLS3d_tomobar(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, recon_size: int | None = None, recon_mask_radius: float = 0.95, iterations: int = 20, nonnegativity: bool = True, gpu_id: int = 0) <cp.ndarray>[source]#

Perform Conjugate Gradient Least Squares (CGLS) using ASTRA toolbox [14] and ToMoBAR [7] wrappers. For more information see CGLS 3D (ToMoBAR).

Parameters:
  • data (cp.ndarray) – Projection data as a CuPy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

  • iterations (int) – The number of CGLS iterations.

  • nonnegativity (bool) – Impose nonnegativity constraint on reconstructed image.

  • gpu_id (int, optional) – A GPU device index to perform operation on.

Returns:

The CGLS reconstructed volume as a CuPy array.

Return type:

cp.ndarray

httomolibgpu.recon.algorithm.FBP2d_astra(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, filter_type: str = 'ram-lak', filter_parameter: float | None = None, filter_d: float | None = None, recon_size: int | None = None, recon_mask_radius: float = 0.95, gpu_id: int = 0) <cp.ndarray>[source]#

Perform Filtered Backprojection (FBP) reconstruction slice-by-slice (2d) using ASTRA toolbox [14] and ToMoBAR [7] wrappers. This is a 2D recon using ASTRA’s API for the FBP_CUDA method, see more in FBP2D (ASTRA-Toolbox).

Parameters:
  • data (np.ndarray) – Projection data as a 3d numpy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • filter_type (str) – Type of projection filter, see ASTRA’s API for all available options for filters.

  • filter_parameter (float, optional) – Parameter value for the ‘tukey’, ‘gaussian’, ‘blackman’ and ‘kaiser’ filter types.

  • filter_d (float, optional) – D parameter value for ‘shepp-logan’, ‘cosine’, ‘hamming’ and ‘hann’ filter types.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

  • gpu_id (int) – A GPU device index to perform operation on.

Returns:

The FBP reconstructed volume as a numpy array.

Return type:

np.ndarray

httomolibgpu.recon.algorithm.FBP3d_tomobar(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, filter_freq_cutoff: float = 0.35, recon_size: int | None = None, recon_mask_radius: float | None = 0.95, gpu_id: int = 0) <cp.ndarray>[source]#

Perform Filtered Backprojection (FBP) reconstruction using ASTRA toolbox [14] and ToMoBAR [7] wrappers. This is a 3D recon from the CuPy array directly and using a custom built SINC filter for filtration in Fourier space, see more in FBP3D (ToMoBAR).

Parameters:
  • data (cp.ndarray) – Projection data as a 3d CuPy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • filter_freq_cutoff (float) – Cutoff frequency parameter for the SINC filter, the lower values may produce better contrast but noisy reconstruction. The filter change will also affect the dynamic range of the reconstructed image.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float, optional) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

  • gpu_id (int) – A GPU device index to perform operation on.

Returns:

FBP reconstructed volume as a CuPy array.

Return type:

cp.ndarray

httomolibgpu.recon.algorithm.FISTA3d_tomobar(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, recon_size: int | None = None, recon_mask_radius: float = 0.95, iterations: int = 20, subsets_number: int = 6, regularisation_type: str = 'PD_TV', regularisation_parameter: float = 1e-06, regularisation_iterations: int = 50, regularisation_half_precision: bool = True, nonnegativity: bool = True, gpu_id: int = 0) <cp.ndarray>[source]#

A Fast Iterative Shrinkage-Thresholding Algorithm [2] with various types of regularisation or denoising operations [6] (currently accepts ROF_TV and PD_TV regularisations only). For more information see FISTA 3D (ToMoBAR).

Parameters:
  • data (cp.ndarray) – Projection data as a CuPy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

  • iterations (int) – The number of FISTA algorithm iterations.

  • subsets_number (int) – The number of the ordered subsets to accelerate convergence. Keep the value bellow 10 to avoid divergence.

  • regularisation_type (str) – A method to use for regularisation. Currently PD_TV and ROF_TV are available.

  • regularisation_parameter (float) – The main regularisation parameter to control the amount of smoothing/noise removal. Larger values lead to stronger smoothing.

  • regularisation_iterations (int) – The number of iterations for regularisers (aka INNER iterations).

  • regularisation_half_precision (bool) – Perform faster regularisation computation in half-precision with a very minimal sacrifice in quality.

  • nonnegativity (bool) – Impose nonnegativity constraint on the reconstructed image.

  • gpu_id (int) – A GPU device index to perform operation on.

Returns:

The FISTA reconstructed volume as a CuPy array.

Return type:

cp.ndarray

httomolibgpu.recon.algorithm.LPRec3d_tomobar(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, filter_type: str = 'shepp', filter_freq_cutoff: float = 1.0, recon_size: int | None = None, recon_mask_radius: float = 0.95, power_of_2_oversampling: bool | None = True, power_of_2_cropping: bool | None = False, min_mem_usage_filter: bool | None = True, min_mem_usage_ifft2: bool | None = True) <cp.ndarray>[source]#

Fourier direct inversion in 3D on unequally spaced (also called as Log-Polar) grids using CuPy array as an input. This implementation follows V. Nikitin’s CUDA-C implementation and TomoCuPy package. [1], see more in Log-Polar 3D (ToMoBAR).

Parameters:
  • data (cp.ndarray) – Projection data as a 3d CuPy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • filter_type (str) – Filter type, the accepted strings are: none, ramp, shepp, cosine, cosine2, hamming, hann, parzen.

  • filter_freq_cutoff (float) – Cutoff frequency parameter for a filter.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

Returns:

The Log-polar Fourier reconstructed volume as a CuPy array.

Return type:

cp.ndarray

httomolibgpu.recon.algorithm.SIRT3d_tomobar(data: <cp.ndarray>, angles: <cp.ndarray>, center: float | None = None, detector_pad: bool | int = False, recon_size: int | None = None, recon_mask_radius: float = 0.95, iterations: int = 300, nonnegativity: bool = True, gpu_id: int = 0) <cp.ndarray>[source]#

Perform Simultaneous Iterative Recostruction Technique (SIRT) using ASTRA toolbox [14] and ToMoBAR [7] wrappers. For more information see SIRT 3D (ToMoBAR).

Parameters:
  • data (cp.ndarray) – Projection data as a CuPy array.

  • angles (np.ndarray) – An array of angles given in radians.

  • center (float, optional) – The center of rotation (CoR).

  • detector_pad (bool, int) – Detector width padding with edge values to remove circle/arc type artifacts in the reconstruction. Set to True to perform an automated padding or specify a certain value as an integer.

  • recon_size (int, optional) – The [recon_size, recon_size] shape of the reconstructed slice in pixels. By default (None), the reconstructed size will be the dimension of the horizontal detector.

  • recon_mask_radius (float) – The radius of the circular mask that applies to the reconstructed slice in order to crop out some undesirable artifacts. The values outside the given diameter will be set to zero. To implement the cropping one can use the range [0.7-1.0] or set to 2.0 when no cropping required.

  • iterations (int) – The number of SIRT iterations.

  • nonnegativity (bool) – Impose nonnegativity constraint on the reconstructed image.

  • gpu_id (int) – A GPU device index to perform operation on.

Returns:

The SIRT reconstructed volume as a CuPy array.

Return type:

cp.ndarray