athena.utils.tools.image module

Created on Sat Nov 28 14:50:24 2020

@author: art

Summary

Functions:

extract_mask_expr_feat

Extracts the pixel values of the mask objects in the mask_file given the pixel intensities in the image for each channel.

extract_mask_morph_feat

Extracts morphological features form cell mask files.

get_shape_outline

param mask

Array in which objects are marked with labels > 0. Background is 0.

Reference

get_shape_outline(mask)[source]
Parameters

mask (2d array) – Array in which objects are marked with labels > 0. Background is 0.

Returns

Return type

The same as mask but with only the border of the masks, i.e. outline.

extract_mask_expr_feat(mask_file, img_file, norm=None, channels=None, reducer=<function mean>, mask_bg=0)[source]

Extracts the pixel values of the mask objects in the mask_file given the pixel intensities in the image for each channel.

Parameters
  • mask_file (str) – path to cell mask file

  • img_file (str) – path to image file, usually this would be the tiff stack

  • norm – a instance that normalises the pixel values

  • channels (list-like) – indicates for which channels in the image the pixel values of the mask should be extracted, defaults to all channels

  • reducer – function to summarise the pixel values of a object in the mask, default np.mean

  • mask_bg (int) – value which indicates background in the mask_file, defaults to 0

Returns

Return type

dataframe of shape n_objects x n_channels.

extract_mask_morph_feat(mask_file, properties=['label', 'area', 'extent', 'eccentricity'], as_dict=True)[source]

Extracts morphological features form cell mask files.

Parameters
  • mask_file (str) – path to cell mask file

  • properties (list of properties, see [1]) –

  • as_dict

References