megafish.load module
- make_dirlist(dirlist_path, image_dir)[source]
Generates a CSV file listing all cycle directories within a specified image directory. Each cycle directory must contain tiled images organized by color, z, y, and x.
- make_imagepath_cYX_from_dirlist(zarr_path, groups, channels, n_cycle, n_tile_y, n_tile_x, scan_type, dirlist_path, subfooter='', footer='_imagepath', ext='.tif')[source]
Generates a CSV file mapping image paths to cycle, tile, and channel information for spatial-omics images.
- Parameters:
zarr_path (str) – Path to the base .zarr file.
groups (list of str) – List of group names, each corresponding to a specific analysis group.
channels (list of str) – List of channels corresponding to the groups.
n_cycle (int) – Total number of cycles to process.
n_tile_y (int) – Number of tiles along the y-axis.
n_tile_x (int) – Number of tiles along the x-axis.
scan_type (str) – Type of scan, determining the tile layout.
dirlist_path (str) – Path to the CSV file with the list of cycle directories.
subfooter (str, optional) – String to append before the footer in the output CSV filename; defaults to an empty string.
footer (str, optional) – String appended to the output CSV filename; defaults to “_imagepath”.
ext (str, optional) – File extension of the image files; defaults to “.tif”.
- Returns:
The function creates a CSV file with the generated image paths and associated metadata at the modified zarr_path.
- Return type:
None
- make_imagepath_cYX(zarr_path, groups, channels, n_cycle, n_tile_y, n_tile_x, scan_type, image_dir, subfooter='', footer='_imagepath', ext='.ims')[source]
Generates a CSV file mapping image paths to cycle, tile, and channel information for spatial-omics data.
- Parameters:
zarr_path (str) – Path to the base .zarr file.
groups (list of str) – List of group names, each corresponding to a specific analysis group.
channels (list of str) – List of channels corresponding to the groups.
n_cycle (int) – Total number of cycles to process.
n_tile_y (int) – Number of tiles along the y-axis.
n_tile_x (int) – Number of tiles along the x-axis.
scan_type (str) – Type of scan, determining the tile layout.
image_dir (str) – Path to the main directory containing subfolders for each cycle, each with images organized by color, z, y, and x.
subfooter (str, optional) – String to append before the footer in the output CSV filename; defaults to an empty string.
footer (str, optional) – String appended to the output CSV filename; defaults to “_imagepath”.
- Returns:
The function creates a CSV file with image paths and associated metadata at the modified zarr_path.
- Return type:
None
- ims_cYXzyx(zarr_path, n_z, n_y, n_x, imagepath_footer='_imagepath')[source]
Creates empty Zarr arrays for image data in cycle, tile, and spatial (z, y, x) dimensions, then loads .ims images into these arrays using metadata from an image path CSV.
- Parameters:
zarr_path (str) – Path to the base .zarr file to store image data.
n_z (int) – Number of z-slices per tile.
n_y (int) – Image height (pixels) for each tile.
n_x (int) – Image width (pixels) for each tile.
imagepath_footer (str, optional) – String to append to the CSV filename; defaults to “_imagepath”.
- Returns:
The function creates Zarr arrays with image data and writes to zarr_path.
- Return type:
None
- tif_cYXzyx(zarr_path, n_z, n_y, n_x, imagepath_footer='_imagepath', ext='.tif', dtype=None, tif_dims='czyx')[source]
Creates empty Zarr arrays for image data in cycle, tile, and spatial (z, y, x) dimensions, then loads TIFF images into these arrays using metadata from an image path CSV.
- Parameters:
zarr_path (str) – Path to the base .zarr file to store image data.
n_z (int) – Number of z-slices per tile.
n_y (int) – Image height (pixels) for each tile.
n_x (int) – Image width (pixels) for each tile.
imagepath_footer (str, optional) – String to append to the CSV filename; defaults to “_imagepath”.
ext (str, optional) – File extension of the image files; defaults to “.tif”.
dtype (str, optional) – Data type to cast the image to; defaults to None.
dims (str, optional) – Order of dimensions in the image data; defaults to “czyx”.
- Returns:
The function creates Zarr arrays with image data and writes to zarr_path.
- Return type:
None
- stitched_ims(zarr_path, group, image_path, channel, n_tile_y, n_tile_x)[source]
Processes a stitched image by splitting it into tiles and saving them in a Zarr array.
- Parameters:
zarr_path (str) – Path to the Zarr file where tiled data will be saved.
group (str) – Group name in the Zarr file for storing the tiled image data.
image_path (str) – Path to the stitched image file in .ims format.
channel (int) – Channel index for selecting specific image data.
n_tile_y (int) – Number of tiles along the y-axis.
n_tile_x (int) – Number of tiles along the x-axis.
- Returns:
The function saves tiled images in the specified Zarr group without returning any value.
- Return type:
None
- stitched_tif(zarr_path, group, image_path, n_tile_y, n_tile_x, dtype='uint16')[source]
Processes a stitched TIFF image by splitting it into tiles and saving them in a Zarr array.
- Parameters:
zarr_path (str) – Path to the Zarr file where tiled data will be saved.
group (str) – Group name in the Zarr file for storing the tiled image data.
image_path (str) – Path to the stitched image file in TIFF format.
n_tile_y (int) – Number of tiles along the y-axis.
n_tile_x (int) – Number of tiles along the x-axis.
dtype (str, optional) – Data type to cast the image to; defaults to “uint16”.
- Returns:
The function saves tiled images in the specified Zarr group without returning any value.
- Return type:
None