linumpy.mosaic.quick_stitch#

Quick reconstruction and processing methods for the S-OCT data.

Attributes#

Functions#

get_largest_cc(segmentation)

Get the largest connected component in a binary image.

get_tiles_ids(directory[, z])

Analyze a directory and detect all the tiles it contains.

get_tiles_ids_from_list(tiles_list[, file_pattern])

Return tile (x, y, z) IDs parsed from a list of tile paths.

get_mosaic_info(directory, z[, overlap_fraction, ...])

Return mosaic geometry and tile metadata for a given z-slice.

quick_stitch(directory, z[, overlap_fraction, n_rot, ...])

Stitch all tiles in a directory for a given z-slice into a mosaic.

detect_mosaic(directory, z[, img, margin, display, ...])

Detect the tissue in the mosaic and compute the limits of the tissue.

save_quickstitch(img, quickstitch_file)

Save the quickstitch mosaic to a file, normalizing intensity.

Module Contents#

linumpy.mosaic.quick_stitch.get_largest_cc(segmentation)[source]#

Get the largest connected component in a binary image.

Parameters:

segmentation (np.ndarray) – The binary image to process.

Returns:

The largest connected component.

Return type:

np.ndarray

linumpy.mosaic.quick_stitch.DEFAULT_TILE_FILE_PATTERN = 'tile_x(?P<x>\\d+)_y(?P<y>\\d+)_z(?P<z>\\d+)'[source]#
linumpy.mosaic.quick_stitch.get_tiles_ids(directory, z=None)[source]#

Analyze a directory and detect all the tiles it contains.

Parameters:
Return type:

tuple

linumpy.mosaic.quick_stitch.get_tiles_ids_from_list(tiles_list, file_pattern=DEFAULT_TILE_FILE_PATTERN)[source]#

Return tile (x, y, z) IDs parsed from a list of tile paths.

Parameters:
  • tiles_list (list)

  • file_pattern (str)

Return type:

list

linumpy.mosaic.quick_stitch.get_mosaic_info(directory, z, overlap_fraction=0.2, use_stage_positions=False)[source]#

Return mosaic geometry and tile metadata for a given z-slice.

Parameters:
Return type:

dict

linumpy.mosaic.quick_stitch.quick_stitch(directory, z, overlap_fraction=0.2, n_rot=3, zmin=0, zmax=-1, use_log=False, use_stage_positions=False, flip_ud=True, flip_lr=False, galvo_shift=None, galvo_shift_first_tile=(0, 0))[source]#

Stitch all tiles in a directory for a given z-slice into a mosaic.

Parameters:
Return type:

numpy.ndarray

linumpy.mosaic.quick_stitch.detect_mosaic(directory, z, img=None, margin=0.5, display=False, image_file=None, roi_file=None, keep_largest_island=False, stitching_settings=None)[source]#

Detect the tissue in the mosaic and compute the limits of the tissue.

Parameters:
  • directory (str) – The directory containing the tiles.

  • z (int) – The z slices to process

  • img (np.ndarray or None) – Optional pre-computed mosaic image.

  • stitching_settings (dict or None) – Optional stitching settings override.

  • margin (float) – The margin to add to the tissue limits (in mm).

  • display (bool) – Display the result in a matplotlib window.

  • image_file (str) – The filename to save the quickstitch image.

  • roi_file (str) – The filename to save the ROI image.

  • keep_largest_island (bool) – Keep the largest connected component in the mask.

Return type:

tuple

linumpy.mosaic.quick_stitch.save_quickstitch(img, quickstitch_file)[source]#

Save the quickstitch mosaic to a file, normalizing intensity.

Parameters:
Return type:

None