napari_prism.im.mask_tma

Contents

napari_prism.im.mask_tma#

napari_prism.im.mask_tma(spatialdata, image_name, channel, scale, output_mask_name, sigma_um, expansion_um, li_threshold=False, edge_filter=False, adapt_hist=False, gamma_correct=False, fill_holes=False, remove_small_spots_size=0, estimated_core_diameter_um=700, core_fraction=0.2, rasterize=True, reference_coordinate_system='global', inplace=True)#

Masks a channel or channels of the raw multiscale image stored in the .image attribute of the provided SpatialData object.

Parameters:
  • spatialdata (SpatialData) – The spatialdata object to mask.

  • image_name (str) – The name of the image to mask.

  • channel (str | list[str]) – The channel or channels to mask.

  • scale (str) – The scale to mask.

  • output_mask_name (str) – The name of the output mask.

  • sigma_um (float) – The sigma in microns for the Gaussian filter.

  • expansion_um (float) – The expansion in microns for the mask.

  • li_threshold (bool (default: False)) – If True, uses the Li thresholding method the image before masking.

  • edge_filter (bool (default: False)) – If True, applies an edge filter to the image before masking.

  • adapt_hist (bool (default: False)) – If True, applies adaptive histogram equalization to the image before masking.

  • gamma_correct (bool (default: False)) – If True, applies gamma correction to the image before masking.

  • fill_holes (bool (default: False)) – If True, fills holes in the mask.

  • remove_small_spots_size (int | float (default: 0)) – The size in pixels to remove small spots from the mask.

  • estimated_core_diameter_um (float | int (default: 700)) – The estimated core diameter in microns.

  • core_fraction (float | int (default: 0.2)) – The core fraction to use for masking.

  • rasterize (bool (default: True)) – If True, rasterizes the mask.

  • reference_coordinate_system (str (default: 'global')) – The reference coordinate system to use.

  • inplace (bool (default: True)) – If True, modifies the spatialdata object in place. If False, returns the mask and transformation sequence.

Return type:

SpatialData

Returns:

If inplace is True, returns the modified spatialdata object. If False, returns a tuple of the masks, transformation sequence, and masks_gdf.