nabu.reconstruction.reconstructor module

class nabu.reconstruction.reconstructor.Reconstructor(shape, indices_range, axis='z', vol_type='sinograms', slices_roi=None)[source]

Bases: object

Abstract base class for reconstructors.

A Reconstructor is a helper to reconstruct slices in arbitrary directions (not only usual “horizontal slices”) in parallel-beam tomography.

Current limitations:
  • Limitation to the three main axes

  • One instance of Reconstructor can only reconstruct successive slices

Typical scenarios examples:
  • “I want to reconstruct several slices along ‘z’”, where z is the vertical axis. In this case, we reconstruct “horizontal slices” in planes perpendicular to the rotation axis.

  • “I want to reconstruct slices along ‘y’”. Here y is an axis perpendicular to z, i.e we reconstruct “vertical slices”.

A Reconstructor is tied to the set of slices to reconstruct (axis and orientation). Once defined, it cannot be changed ; i.e another class has to be instantiated to reconstruct slices in other axes/indices.

The volume geometry conventions are defined below:

                 __________
                /         /|
               /         / |
z             /         /  |
^            /_________/   |
|           |          |   |
|    y      |          |   /
|   /       |          |  /
|  /        |          | /
| /         |__________|/
|/
---------- > x

The axis z parallel to the rotation axis. The usual parallel-beam tomography setting reconstructs slices along z, i.e in planes parallel to (x, y).

Initialize a reconstructor.

Parameters:
  • shape (tuple) – Shape of the stack of sinograms or projections.

  • indices_range (tuple) – Range of indices to reconstruct, in the form (start, end). As the standard Python behavior, the upper bound is not included. For example, to reconstruct 100 slices (numbered from 0 to 99), then you can provide (0, 100) or (0, None). Providing (0, 99) or (0, -1) will omit the last slice.

  • axis (str) – Axis along which the slices are reconstructed. This axis is orthogonal to the slices planes. This parameter can be either “x”, “y”, or “z”. Default is “z” (reconstruct slices perpendicular to the rotation axis).

  • vol_type (str, optional) – Whether the parameter shape describes a volume of sinograms or projections. The two are the same except that axes 0 and 1 are swapped. Can be “sinograms” (default) or “projections”.

  • slices_roi (tuple, optional) – Define a Region Of Interest to reconstruct a part of each slice. By default, the whole slice is reconstructed for each slice index. This parameter is in the form (start_u, end_u, start_v, end_v), where u and v are horizontal and vertical axes on the reconstructed slice respectively, regardless of its orientation. If one of the values is set to None, it will be replaced by the corresponding default value.

Examples

To reconstruct the first two horizontal slices, i.e along z:

R = Reconstructor(vol_shape, [0, 1])

To reconstruct vertical slices 0-100 along the y axis:

R = Reconstructor(vol_shape, (0, 100), axis=”y”)

reconstruct()[source]