microcorrelate.stitching#
This module contains functions for stitching together microscopy images
Classes#
A physical length with lossless unit conversion. |
|
Physical size of a single pixel. |
|
Global stage coordinates of the top-left corner of a stitched tileset. |
|
Physical metadata of a Maps stitched tileset. |
Functions#
|
Stitch together tiled images from a tileset acquired via the Thermo Fisher Maps |
Module Contents#
- class microcorrelate.stitching.Length(meters: float)#
A physical length with lossless unit conversion.
Stores a length in metres as the canonical representation and exposes read-only properties for common unit conversions. Intended to eliminate scattered unit conversion factors across the stitching pipeline.
- Parameters:
meters (float) – Length in metres.
Examples
l = Length(1.5e-7) l.m # 1.5e-07 l.um # 0.15 l.nm # 150.0
- property cm: float#
- property m: float#
- property mm: float#
- property nm: float#
- property um: float#
- class microcorrelate.stitching.PixelSize#
Physical size of a single pixel.
Examples
pixel_size = PixelSize(y=Length(1.5e-7), x=Length(1.5e-7)) pixel_size.y.nm # 150.0 pixel_size.x.um # 0.15
- class microcorrelate.stitching.StagePosition#
Global stage coordinates of the top-left corner of a stitched tileset.
Coordinates are extracted from
MapsProject.xmland converted from the center-based convention used by Maps to top-left, so that pixel-to-physical coordinate mapping is a direct offset from index[0, 0]. Units in theMapsProject.xmlare assumed to be meters.- Parameters:
Examples
stage = StagePosition(y=Length(-0.020), x=Length(-0.011)) stage.x.um # -11000.0 stage.y.nm # -20000000.0
- class microcorrelate.stitching.TilesetMetadata#
Physical metadata of a Maps stitched tileset.
Aggregates pixel size and optional stage position into a single object returned by
_get_metadata. Stage position isNonewhenMapsProject.xmlis unavailable or the tileset cannot be matched.- Parameters:
pixel_size (PixelSize) – Physical size of a single pixel.
stage_position (StagePosition or None) – Global stage coordinates of the top-left corner, or
Noneif unavailable.
- microcorrelate.stitching.stitch_images(tileset_path: pathlib.Path | str, dest_path: pathlib.Path | str, compression: bool = True, group_path: str | None = None, pyramid_levels: int = 1, crop_borders: bool = True, verbose: bool = False) None#
Stitch together tiled images from a tileset acquired via the Thermo Fisher Maps software and save the stitched image as a single TIFF file or Zarr file. The tileset is expected to be in the directory structure produced by Maps, and have been already stitched by the acquisition software (that is, there’s no overlap or gaps between tiles).
- Parameters:
tileset_path (Path | str) – Path to the tileset directory.
dest_path (Path | str) – Path to save the stitched image. It can be either a .tif file or a .zarr store.
compression (bool) – Save Tiff image with compression (zlib). This parameter is only used when output is TIff. Zarr files are always compressed. (default = True).
group_path (str | None) – Path to the group in the Zarr array where images should be saved. If None, save in root. This parameter is only used if output is Zarr. (default = None).
pyramid_levels (int) – Number or pyramid levels used when saving to Zarr multiscales. If 1, no downscaled levels are calculated. (default = 1).
crop_borders (bool) – Crop black borders in the stitched dataset, which normally arise from a mismatch in the tile size and image size used by Maps. Note that this will briefly cause two copies of the image array to be held in memory, it should be used with caution when operating close to memory limits. (default = True).
verbose (bool) – Enable verbose output (default = False).
- Return type:
None