nabu.reconstruction.sinogram
source module nabu.reconstruction.sinogram
Classes
-
SinoBuilder — A class to build sinograms.
-
SinoMult — A class for preparing a sinogram for half-tomography reconstruction, without stitching the two parts
-
SinoNormalization — A class for sinogram normalization utilities.
Functions
-
convert_halftomo — Converts a sinogram into a sinogram with extended FOV with the "half tomography" setting.
-
match_half_sinos_parts — 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]andnew_sino[k + n_angles//2]will be 180 degrees apart. -
get_extended_sinogram_width — Compute the width (in pixels) of the extended sinogram for half-acquisition setting.
source class SinoBuilder(sinos_shape=None, radios_shape=None, rot_center=None, halftomo=False, angles=None, interpolate=False)
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 fromradios_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 fromsinos_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.
Attributes
-
output_shape — Get the output sinograms shape.
Methods
-
set_rot_center — Set the rotation axis position for the current radios/sinos stack.
-
get_sino — The the sinogram at a given index.
-
radios_to_sinos — DEPRECATED. Use get_sinos() or get_sino() instead.
source method SinoBuilder.set_rot_center(rot_center)
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.
Raises
-
ValueError
source property SinoBuilder.output_shape
Get the output sinograms shape.
source method SinoBuilder.get_sino(radios, i, output=None)
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 : array — Two dimensional array with shape (n_angles2, n_x2) where the dimensions are determined by the current settings.
source method SinoBuilder.convert_sino(sino, output=None)
source method SinoBuilder.get_sinos(radios, output=None)
source method SinoBuilder.radios_to_sinos(radios, output=None, copy=False)
DEPRECATED. Use get_sinos() or get_sino() instead.
source class SinoMult(sino_shape, rot_center)
A class for preparing a sinogram for half-tomography reconstruction, without stitching the two parts
Methods
source method SinoMult.prepare_sino(sino)
source convert_halftomo(sino, extended_width, transition_width=None)
Converts a sinogram into a sinogram with extended FOV with the "half tomography" setting.
source match_half_sinos_parts(sino, angles, output=None)
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.
source get_extended_sinogram_width(sino_width, rotation_axis_position)
Compute the width (in pixels) of the extended sinogram for half-acquisition setting.
source prepare_half_tomo_sinogram(sino, rot_center, get_extended_sino=True)
source class SinoNormalization(kind='chebyshev', sinos_shape=None, radios_shape=None, normalization_array=None)
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'.
Methods
-
normalize — Normalize a sinogram or stack of sinogram. The process is done in-place, meaning that the sinogram content is overwritten.
source method SinoNormalization.normalize(sino)
Normalize a sinogram or stack of sinogram. The process is done in-place, meaning that the sinogram content is overwritten.