acia.segm.tiff_export#

Optional lazy TIFF export of a (cropped) image sequence.

save_tiff_stack() streams any ImageSequenceSource (e.g. a crop returned by acia.selection.load_selection()) to a TIFF stack one frame at a time, so peak memory stays at a single frame regardless of sequence length. Physical calibration (pixel size, frame interval) is written into the TIFF resolution + ImageJ metadata so downstream tools keep µm/px and timing.

This is the optional export leg of the curation workflow — the manifest is the primary output, not a materialized TIFF.

acia.segm.tiff_export.save_tiff_stack(source, path, *, imagej=True, ome=False, dtype=None, compression=None, channel_names=None)[source]#

Write source to a TIFF stack lazily (one frame at a time).

Parameters:
  • source – A lazy ImageSequenceSource; iterated frame-by-frame.

  • path (str | PathLike) – Output .tif path (parent dirs are created).

  • imagej (bool) – Write an ImageJ hyperstack (default) — matches how acia-workflows consumes TIFFs. Calibration goes into ImageJ metadata + TIFF resolution tags. Ignored when ome=True.

  • ome (bool) – Write an OME-TIFF instead of an ImageJ hyperstack — carries richer, standard-schema metadata (PhysicalSizeX/Y, TimeIncrement, channel names) that a cropped/registered export would otherwise lose. Takes precedence over imagej when both are set. As with the ImageJ path, missing calibration is simply omitted, never fabricated.

  • dtype – Optional numpy dtype to cast each frame to (default: keep source dtype).

  • compression (str | int | None) – Optional codec name/level forwarded to tifffile (e.g. "zlib", "lzw"); None (default) writes uncompressed, matching prior behavior.

  • channel_names (list[str] | None) – Optional per-channel names to embed (OME Channel/Name); ignored when ome=False. Crops don’t carry channel metadata themselves, so callers pass this through explicitly (e.g. from a selection manifest’s baked-in source["channels"]).

Returns:

The written path.

Return type:

str