tomobar.methodsDIR_CuPy#

Reconstruction class for 3D direct methods using CuPy-library.

  • Forward/Backward projection (ASTRA with DirectLink and CuPy).

  • Filtered Back Projection (ASTRA, Filter implemented in CuPy).

  • Fourier direct reconstruction with classical polar to cartesian interpolation.

  • Fourier direct reconstruction on unequally spaced grids (interpolation in image space).

class tomobar.methodsDIR_CuPy.RecToolsDIRCuPy(DetectorsDimH, DetectorsDimV, CenterRotOffset, AnglesVec, ObjSize, device_projector=0)[source]#

Bases: tomobar.methodsDIR.RecToolsDIR

Reconstruction class using DIRect methods with CuPy API.

Parameters
  • DetectorsDimH (int) – Horizontal detector dimension.

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

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

  • device_projector (int) – An index (integer) of a specific GPU device.

BACKPROJ(projdata: numpy.ndarray, **kwargs) numpy.ndarray[source]#

Module to perform back-projection of 2d/3d data as a cupy array

Parameters

projdata (xp.ndarray) – 2D/3D projection data as a cupy array

Keyword Arguments

data_axes_labels_order (Union[list, None], optional) – The order of the axes labels for the input data. When “None” we assume [“angles”, “detX”] for 2D and [“detY”, “angles”, “detX”] for 3D.

Returns

Backprojected 2D/3D object

Return type

xp.ndarray

FBP(data: numpy.ndarray, **kwargs) numpy.ndarray[source]#

Filtered backprojection reconstruction on a CuPy array using a custom built SINC filter.

Parameters

data (xp.ndarray) – projection data as a CuPy array

Keyword Arguments
  • data_axes_labels_order (Union[list, None], optional) – The order of the axes labels for the input data. When “None” we assume [“angles”, “detX”] for 2D and [“angles”, “detY”, “detX”] for 3D.

  • recon_mask_radius (float) – zero values outside the circular mask of a certain radius. To see the effect of the cropping, set the value in the range [0.7-1.0].

  • cutoff_freq (float) – Cutoff frequency parameter for the sinc filter.

Returns

The FBP reconstructed volume as a CuPy array.

Return type

xp.ndarray

FORWPROJ(data: numpy.ndarray, **kwargs) numpy.ndarray[source]#

Module to perform forward projection of 2d/3d data as a cupy array

Parameters

data (xp.ndarray) – 2D or 3D object as a cupy array

Keyword Arguments

data_axes_labels_order (Union[list, None], optional) – The order of the axes labels for the OUTPUT data. When “None” we assume [“angles”, “detX”] for 2D and [“detY”, “angles”, “detX”] for 3D.

Returns

Forward projected cupy array (projection data)

Return type

xp.ndarray

FOURIER_INV(data: numpy.ndarray, **kwargs) numpy.ndarray[source]#
Fourier direct inversion in 3D on unequally spaced (also called as NonUniform FFT/NUFFT) grids using CuPy array as an input.

This implementation follows V. Nikitin’s CUDA-C implementation: nikitinvv/radonusfft and TomoCuPy package.

Parameters

data (xp.ndarray) – projection data as a CuPy array

Keyword Arguments
  • data_axes_labels_order (Union[list, None], optional) – The order of the axes labels for the input data. When “None” we assume [“angles”, “detX”] for 2D and [“angles”, “detY”, “detX”] for 3D.

  • recon_mask_radius (float) – zero values outside the circular mask of a certain radius. To see the effect of the cropping, set the value in the range [0.7-1.0].

Returns

The NUFFT reconstructed volume as a CuPy array.

Return type

xp.ndarray