tomodrgn.utils.calc_real_space_mask#

calc_real_space_mask(vol1: ndarray, vol2: ndarray | None = None, mask: str | None = None, thresh: int | None = None, dilate: int | None = None, dist: int | None = None) ndarray[source]#

Generate a real space mask generated from up to two volumes

Parameters:
  • vol1 – array of volume 1, shape (boxsize, boxsize, boxsize)

  • vol2 – array of volume 2, shape (boxsize, boxsize, boxsize)

  • mask – mask to calculate from volumes, one of [None, ‘sphere’, ‘tight’, ‘soft’]

  • thresh – data percentile threshold at which to binarize mask when calculating ‘tight’ or initializing ‘soft’ masks

  • dilate – for soft mask, number of pixels to expand auto-determined tight mask

  • dist – for soft mask, number of pixels over which to apply soft edge

Returns:

array of mask, values in interval [0,1], shape (boxsize, boxsize, boxsize)