megafish.tif module

save(zarr_path, group, zoom=0)[source]

Saves image data from a Zarr file as individual TIFF files for each chunk.

Parameters:
  • zarr_path (str) – Path to the Zarr file containing the image data.

  • group (str) – Group name in the Zarr file where the image data is stored.

  • zoom (int, optional) – Zoom level to select the data from; defaults to 0.

Returns:

This function saves the image chunks as TIFF files in the tif directory.

Return type:

None

save_tile_montage(zarr_path, group, tile_size, footer='_mtg')[source]

Creates a tiled montage of images from a Zarr file and saves it as a single TIFF file.

Parameters:
  • zarr_path (str) – Path to the Zarr file containing the image data.

  • group (str) – Group name in the Zarr file where the image data is stored.

  • tile_size (tuple of int) – Size of each tile in the montage (height, width).

  • footer (str, optional) – Footer string to append to the output TIFF file name; defaults to “_mtg”.

Returns:

This function saves the montage as a single TIFF file in the tif directory.

Return type:

None

save_whole_image(zarr_path, group, zoom=0, clip=False)[source]

Saves the entire image from a Zarr file as a TIFF file, with an option to clip the image.

Parameters:
  • zarr_path (str) – Path to the Zarr file containing the image data.

  • group (str) – Group name in the Zarr file where the image data is stored.

  • zoom (int, optional) – Zoom level to select the data from; defaults to 0.

  • clip (tuple or bool, optional) – If a tuple (height, width) is provided, the image will be clipped to this size. If False, the entire image is saved; defaults to False.

Returns:

This function saves the image as a single TIFF file.

Return type:

None

save_chunk(zarr_path, group, chunk, footer)[source]

Saves specific chunks of image data from a Zarr file as individual TIFF files.

Parameters:
  • zarr_path (str) – Path to the Zarr file containing the image data.

  • group (str) – Group name in the Zarr file where the image data is stored.

  • chunk (list of list of int) – List of chunk coordinates to be saved as TIFF files.

  • footer (str) – Footer to append to the output directory name.

Returns:

This function saves the specified chunks as individual TIFF files.

Return type:

None

load(zarr_path, group_load, group_template, footer_ext, dtype=None)[source]

Loads TIFF images into a Zarr dataset using the structure of a template group.

Parameters:
  • zarr_path (str) – Path to the Zarr file where the images will be stored.

  • group_load (str) – Group name in the Zarr file where the loaded images will be saved.

  • group_template (str) – Template group name in the Zarr file to match the structure of the data.

  • footer_ext (str) – Extension string to append to the file names of the TIFF images.

  • dtype (type, optional) – Data type for the loaded images; if None, uses the data type of the template group.

Returns:

This function saves the loaded images as a Zarr dataset.

Return type:

None

save_rgb(zarr_path, group_r, group_g, group_b, group_out)[source]

Combines individual red, green, and blue image groups from a Zarr file into RGB images and saves them as TIFF files.

Parameters:
  • zarr_path (str) – Path to the Zarr file containing the image data.

  • group_r (str or None) – Group name for the red channel; set to None if not available.

  • group_g (str or None) – Group name for the green channel; set to None if not available.

  • group_b (str or None) – Group name for the blue channel; set to None if not available.

  • group_out (str) – Group name for saving the combined RGB images.

Returns:

This function saves the combined RGB images as TIFF files.

Return type:

None