megafish.process module

projection(zarr_path, group, dim='z', method='max', footer='_mip')[source]

Creates a projection of the image data along a specified dimension using the specified method.

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

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

  • dim (str, optional) – The dimension along which to project (e.g., “z”); defaults to “z”.

  • method (str, optional) – The projection method to use, either “max” for maximum projection or “min” for minimum projection; defaults to “max”.

  • footer (str, optional) – Footer string to append to the output Zarr group name; defaults to “_mip”.

Returns:

The function saves the projection result to a new Zarr group.

Return type:

None

masking(zarr_path, group_int, group_mask, invert_mask=False, footer='_msk')[source]

Applies a mask to the image data, setting masked regions to zero.

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

  • group_int (str) – Group name in the Zarr file for the intensity data to be masked.

  • group_mask (str) – Group name in the Zarr file for the mask data.

  • invert_mask (bool, optional) – If True, inverts the mask to apply the mask where the value is zero; defaults to False.

  • footer (str, optional) – Footer string to append to the output Zarr group name; defaults to “_msk”.

Returns:

The function saves the masked result to a new Zarr group.

Return type:

None

gaussian_blur(zarr_path, group, sigma, dtype='float32', footer='_gbr')[source]

Applies a Gaussian blur to the image data.

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

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

  • sigma (float or tuple of float) – The standard deviation(s) for the Gaussian kernel.

  • dtype (str, optional) – The data type of the output image; defaults to “float32”.

  • footer (str, optional) – Footer string to append to the output Zarr group name; defaults to “_gbr”.

Returns:

The function saves the blurred result to a new Zarr group.

Return type:

None

binarization(zarr_path, group, threshold, reverse=False, dtype='uint8', footer='_bin')[source]

Applies binarization to the image data based on a threshold.

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

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

  • threshold (float) – The threshold value for binarization; values above the threshold are set to 1, others to 0.

  • reverse (bool, optional) – If True, reverses the binary values (0 becomes 1 and vice versa); defaults to False.

  • dtype (str, optional) – The data type of the output image; defaults to “uint8”.

  • footer (str, optional) – Footer string to append to the output Zarr group name; defaults to “_bin”.

Returns:

The function saves the binarized result to a new Zarr group.

Return type:

None