Basic iterative reconstruction

Basic iterative reconstruction#

Note

Installing HTTomolibGPU provides access to a wide range of GPU-accelerated processing tools, in addition to reconstruction wrappers that leverage ToMoBAR’s modules, see point 6 in Dependencies.

We start by defining a 3D projection data Numpy array of unsigned integer 16-bit data type (optional) and with axes labels given as ["detY", "angles", "detX"]. We also provide the corresponding flats and darks fields (also 3D arrays of the same axes order).

from tomobar.supp.suppTools import normaliser

data_norm = normaliser(dataRaw, flats, darks, log=True, method="mean", axis=1)
import cupy as cp
from tomobar.methodsIR_CuPy import RecToolsIRCuPy

detectorVert, angles_number, detectorHoriz = np.shape(data_norm)

Rectools = RecToolsIRCuPy(
    DetectorsDimH=detectorHoriz,  # Horizontal detector dimension
    DetectorsDimH_pad=0,  # Padding size of horizontal detector
    DetectorsDimV=detectorVert,  # Vertical detector dimension
    CenterRotOffset=0.0,  # Center of Rotation (needs to be found)
    AnglesVec=angles_rad,  # A vector of projection angles in radians
    ObjSize=detectorHoriz,  # The reconstructed object dimensions
    device_projector=0,  # Device to perform reconstruction on
)
  • Now we have an access to all methods of this particular reconstructor. Let us use SIRT and CGLS reconstruction algorithms.

    Please note that the dictionaries needed for all iterative methods with exact keyword arguments defined in tomobar.supp.dicts.

_data_ = {
    "projection_data": cp.asarray(data_norm),
    "data_axes_labels_order": ["detY", "angles", "detX"],
}  # data dictionary

_algorithm_ = {"iterations": 300, "nonnegativity": True}  # algorithm dict

SIRT_Rec = Rectools.SIRT(_data_, _algorithm_)

_algorithm_ = {"iterations": 20, "nonnegativity": True}  # algorithm dict

CGLS_Rec = Rectools.CGLS(_data_, _algorithm_)