tomobar.astra_wrappers.astra_base#

The series of classes for wrapping of ASTRA toolbox to perform projection/backprojection and reconstruction of of 2D/3D parallel beam data.

GPLv3 license (defined by ASTRA toolbox)

class tomobar.astra_wrappers.astra_base.AstraBase(detectors_x, angles_vec, centre_of_rotation, recon_size, processing_arch, device_index, ordsub_number, detectors_y)[source]#

Bases: object

The base class for projection/backprojection operations and various reconstruction algorithms using ASTRA toolbox wrappers.

Parameters
  • detectors_x (int) – Horizontal detector dimension in pixel units.

  • angles_vec (np.ndarray) – A vector of projection angles in radians.

  • centre_of_rotation (float, np.ndarray) – The Centre of Rotation (CoR) scalar or a vector of CoRs for each angle.

  • recon_size (int) – Reconstructed object size (a slice).

  • processing_arch (str) – ‘cpu’ or ‘gpu’ - based processing.

  • device_index (int, optional) – An integer for the GPU device, -1 for CPU computing and >0 for the GPU device.

  • ordsub_number (int) – The number of ordered-subsets for iterative reconstruction.

  • detectors_y (int) – Vertical detector dimension in pixel units (3D case).

property angles_vec: numpy.ndarray#
property centre_of_rotation: Union[float, numpy.ndarray]#
property detectors_x: int#
property detectors_y: int#
property device_index: int#
property ordsub_number: int#
property processing_arch: str#
property recon_size: int#
runAstraBackproj3D(proj_data: numpy.ndarray, method: str, iterations: int, os_index: Optional[int]) numpy.ndarray[source]#

“3D ASTRA-based back-projector for parallel beam

Parameters
  • proj_data (np.ndarray) – 3D projection data

  • method (str) – A method to choose from ASTRA’s provided ones.

  • iterations (int) – The number of iterations for iterative methods.

  • os_index (Union[int, None]) – The number of ordered subsets.

Returns

The reconstructed 3D volume.

Return type

np.ndarray

runAstraBackproj3DCuPy(proj_data: <Mock name='mock.ndarray' id='140540124709696'>, method: str, os_index: typing.Optional[int]) <Mock name='mock.ndarray' id='140540124709696'>[source]#

3d back-projection using ASTRA’s GPULink functionality for CuPy arrays

Parameters
  • proj_data (xp.ndarray) – 3d projection data as a CuPy array

  • method (str) – Only BP is available so far.

  • os_index (Union[int, None]) – The number of ordered subsets.

Returns

A CuPy array containing back-projected volume.

Return type

xp.ndarray

runAstraProj3D(volume_data: numpy.ndarray, os_index: Optional[int]) numpy.ndarray[source]#

3D ASTRA-based projector for parallel beam

Parameters
  • volume_data (np.ndarray) – 3D object to project

  • os_index (Union[int, None]) – The number of ordered subsets.

Returns

3D projection data

Return type

np.ndarray

runAstraProj3DCuPy(volume_data: <Mock name='mock.ndarray' id='140540124709696'>, os_index: typing.Optional[int]) <Mock name='mock.ndarray' id='140540124709696'>[source]#

3d forward projector using ASTRA’s GPULink functionality for CuPy arrays

Parameters
  • volume_data (xp.ndarray) – the input 3d volume as a CuPy array

  • os_index (Union[int, None]) – The number of ordered subsets.

Returns

projected volume array as a cupy array

Return type

xp.ndarray