nabu.reconstruction.sinogram module

class nabu.reconstruction.sinogram.SinoBuilder(sinos_shape=None, radios_shape=None, rot_center=None, halftomo=False, angles=None, interpolate=False)[source]

Bases: object

A class to build sinograms.

Initialize a SinoBuilder instance.

Parameters:
  • sinos_shape (tuple of int) – Shape of the stack of sinograms, in the form (n_z, n_angles, n_x). If not provided, it is derived from radios_shape.

  • radios_shape (tuple of int) – Shape of the chunk of radios, in the form (n_angles, n_z, n_x). If not provided, it is derived from sinos_shape.

  • rot_center (int or array) – Rotation axis position. A scalar indicates the same rotation axis position for all the projections.

  • halftomo (bool) – Whether “half tomography” is enabled. Default is False.

  • interpolate (bool, optional) – Only used if halftomo=True. Whether to re-grid the second part of sinograms to match projection k with projection k + n_a/2. This forces each pair of projection (k, k + n_a/2) to be separated by exactly 180 degrees.

  • angles (array, optional) – Rotation angles (in radians). Used and required only when halftomo and interpolate are True.

set_rot_center(rot_center)[source]

Set the rotation axis position for the current radios/sinos stack.

rot_center: int or array

Rotation axis position. A scalar indicates the same rotation axis position for all the projections.

property output_shape

Get the output sinograms shape.

get_sino(radios, i, output=None)[source]

The the sinogram at a given index.

Parameters:
  • radios (array) – 3D array with shape (n_z, n_angles, n_x)

  • i (int) – Sinogram index

Returns:

sino – Two dimensional array with shape (n_angles2, n_x2) where the dimensions are determined by the current settings.

Return type:

array

convert_sino(sino, output=None)[source]
get_sinos(radios, output=None)[source]
radios_to_sinos(**kwargs)
class nabu.reconstruction.sinogram.SinoMult(sino_shape, rot_center)[source]

Bases: object

A class for preparing a sinogram for half-tomography reconstruction, without stitching the two parts

prepare_sino(sino)[source]
nabu.reconstruction.sinogram.convert_halftomo(sino, extended_width, transition_width=None)[source]

Converts a sinogram into a sinogram with extended FOV with the “half tomography” setting.

nabu.reconstruction.sinogram.match_half_sinos_parts(sino, angles, output=None)[source]

Modifies the lower part of the half-acquisition sinogram so that each projection pair is separated by exactly 180 degrees. This means that new_sino[k] and new_sino[k + n_angles//2] will be 180 degrees apart.

Parameters:
  • sino (numpy.ndarray) – Two dimensional array with the sinogram in the form (n_angles, n_x)

  • angles (numpy.ndarray) – One dimensional array with the rotation angles.

  • output (numpy.array, optional) – Output sinogram. By default, the array ‘sino’ is modified in-place.

Notes

This function assumes that the angles are in an increasing order.

nabu.reconstruction.sinogram.get_extended_sinogram_width(sino_width, rotation_axis_position)[source]

Compute the width (in pixels) of the extended sinogram for half-acquisition setting.

nabu.reconstruction.sinogram.prepare_half_tomo_sinogram(sino, rot_center, get_extended_sino=True)[source]
class nabu.reconstruction.sinogram.SinoNormalization(kind='chebyshev', sinos_shape=None, radios_shape=None, normalization_array=None)[source]

Bases: object

A class for sinogram normalization utilities.

Initialize a SinoNormalization class.

Parameters:
  • kind (str, optional) –

    Normalization type. They can be the following:
    • chebyshev: Each sinogram line is estimated by a Chebyshev polynomial

    of degree 2. This estimation is then subtracted from the sinogram. - subtraction: Each sinogram is subtracted with a user-provided array.

    The array can be 1D (angle-independent) and 2D (angle-dependent)

    • division: same as previously, but with a division operation.

    Default is “chebyshev”

  • sinos_shape (tuple, optional) – Shape of the sinogram or sinogram stack. Either this parameter or ‘radios_shape’ has to be provided.

  • radios_shape (tuple, optional) – Shape of the projections or projections stack. Either this parameter or ‘sinos_shape’ has to be provided.

  • normalization_array (numpy.ndarray, optional) – Normalization array when kind=’subtraction’ or kind=’division’.

kinds = ['chebyshev', 'subtraction', 'division']
operations = {'division': <ufunc 'divide'>, 'subtraction': <ufunc 'subtract'>}
normalize(sino)[source]

Normalize a sinogram or stack of sinogram. The process is done in-place, meaning that the sinogram content is overwritten.