Skip to content

Spool

linc_convert.utils.io.spool

Reader for spool files set.

The following script is derived from https://github.com/CBI-PITT/holis_tools/blob/main/holis_tools/zyla_spool_reader.py.

Copyright (c) 2021, Alan M Watson

For more information, see the holis_tools LICENCE

SpoolSetInterpreter

SpoolSetInterpreter(spool_set_path, info_file=None)

Interpreter for a set of spool files produced by a Zyla camera.

This class loads spool files from a directory, parses acquisition parameters, and provides methods to iterate over or assemble the image data.

entries property

entries

List of all entries (filenames) in the spool set.

__getitem__

__getitem__(key)

Retrieve a spool file by name or index.

Parameters:

Name Type Description Default
key str | int

Filename (str) or index (int) in self.spool_files.

required

Returns:

Type Description
The loaded spool data as an ndarray.

__iter__

__iter__()

Iterate over all spool files in order.

Yields:

Type Description
ndarrays for each spool file.

__contains__

__contains__(item)

Check if a given filename is part of the spool files.

Parameters:

Name Type Description Default
item str

Filename to check.

required

__len__

__len__()

Return the number of spool files to be loaded.

Returns:

Type Description
Length of self.spool_files.

assemble

assemble()

Assemble all spool files into a single 3D volume.

Returns:

Type Description
A NumPy array of shape (frames_total, rows, columns),
where frames_total = images_per_file * number_of_files.

assemble_cropped

assemble_cropped()

Assemble and transpose the volume, then crop to original depth.

Returns:

Type Description
A NumPy array transposed to (height, width, frames)
and cropped to self.numDepths along the first axis.