ewokstomo.tasks.online.reconstruct_slice.OnlineReconstructSlice#

class ewokstomo.tasks.online.reconstruct_slice.OnlineReconstructSlice(inputs=None, varinfo=None, node_id=None, node_attrs=None, execinfo=None, profile_directory=None)[source]#

Bases: Task

(ESRF-only) Perform real-time tomography reconstruction on streaming data.

This task connects to a live scan stream and performs incremental reconstruction by processing projections in batches. It includes flat field correction, phase retrieval, and FBP reconstruction.

The reconstruction is performed on a single slice (middle by default) to minimize computational cost while providing real-time feedback.

Required Inputs#

scan_keystr

Blissdata scan key for accessing the live stream

output_pathstr

Directory path where reconstructed slice files will be saved. Individual batch results are saved as reconstructed_slice_{start}_{end}.h5

rotation_motorstr

Name of the rotation axis motor in the scan

total_nb_projectionint

Total expected number of projections in the scan

center_of_rotationfloat

Center of rotation position

batch_sizeint

Number of projections to process in each batch, default is 100

reduced_dark_pathstr

Path to HDF5 file containing reduced dark frames

reduced_flat_pathstr

Path to HDF5 file containing reduced flat frames

distance_m:

Effective propagation distance (m)

energy_keV:

Energy (keV)

pixel_size_m:

detector pixel size (m)

Optional Inputs#

delta_betafloat

Delta/beta ratio for Paganin phase retrieval. Default is 100.

halftomobool

Whether the scan is a half-tomography (180°). Default is False.

padding_modestr

Sinogram padding mode. Default is ‘edges’.

extra_optionsdict

Additional backprojector options. Default is {‘centered_axis’: True}.

slice_indexint or str

Slice index to reconstruct. Can be an integer index or ‘middle’, ‘first’, ‘last’. Default is ‘middle’.

Outputs#

reconstructed_slices_directorystr

Path to the saved reconstructed slice files

type inputs:

Optional[Mapping]

param inputs:

type varinfo:

Optional[dict]

param varinfo:

type node_id:

Union[str, int, tuple, None]

param node_id:

type node_attrs:

Optional[dict]

param node_attrs:

type execinfo:

Optional[dict]

param execinfo:

type profile_directory:

Optional[dict]

param profile_directory:

reconstruct_batch(scan, output_path, center_of_rotation, projections_indices, distance_m, energy_keV, pixel_size_m, rotation_motor, slice_index='middle', delta_beta=100.0, halftomo=False, padding_mode='edges', extra_options=None)[source]#

Reconstruct a batch of projections and accumulate the result.

Return type:

None

Parameters#

scanScan

Blissdata scan object

output_pathstr

Path to save the reconstructed slice

center_of_rotationfloat

Center of rotation

projections_indiceslist of int

Indices of projections to process in this batch

distance_mfloat

Effective propagation distance (m)

energy_keVfloat

Energy (keV)

pixel_size_mfloat

Detector pixel size (m)

rotation_motorstr

Name of the rotation motor

slice_indexint or str, optional

Slice index to reconstruct. Default is ‘middle’.

delta_betafloat, optional

Phase retrieval parameter. Default is 100.

halftomobool, optional

Half-tomography flag. Default is False.

padding_modestr, optional

Sinogram padding mode. Default is ‘edges’.

extra_optionsdict, optional

Additional backprojector options

type output_path:

str

param output_path:

type center_of_rotation:

float

param center_of_rotation:

type projections_indices:

list[int]

param projections_indices:

type distance_m:

float

param distance_m:

type energy_keV:

float

param energy_keV:

type pixel_size_m:

float

param pixel_size_m:

type rotation_motor:

str

param rotation_motor:

type slice_index:

int | str

param slice_index:

type delta_beta:

float

param delta_beta:

type halftomo:

bool

param halftomo:

type padding_mode:

str

param padding_mode:

type extra_options:

dict[str, Any] | None

param extra_options:

run()[source]#

Execute the online reconstruction pipeline.

save_reconstructed_slice(output_path, reconstructed_slice)[source]#

Save the reconstructed slice to an HDF5 file.

Parameters#

output_pathstr

Path to save the reconstructed slice

reconstructed_slicenp.ndarray

The reconstructed slice data

type output_path:

str

param output_path:

type reconstructed_slice:

ndarray

param reconstructed_slice: