find_trapped_regions(seq, outlets=None, bins: int = 25, return_mask: bool = True)[source]

Find the trapped regions given an invasion sequence image

  • seq (ndarray) – An image with invasion sequence values in each voxel. Regions labelled -1 are considered uninvaded, and regions labelled 0 are considered solid.

  • outlets (ndarray, optional) – An image the same size as seq with True indicating outlets and False elsewhere. If not given then all image boundaries are considered outlets.

  • bins (int) – The resolution to use when thresholding the seq image. By default the invasion sequence will be broken into 25 discrete steps and trapping will be identified at each step. A higher value of bins will provide a more accurate trapping analysis, but is more time consuming. If None is specified, then all the steps will analyzed, providing the highest accuracy.

  • return_mask (bool) – If True (default) then the returned image is a boolean mask indicating which voxels are trapped. If False, then a copy of seq is returned with the trapped voxels set to uninvaded and the invasion sequence values adjusted accordingly.


trapped – An image, the same size as seq. If return_mask is True, then the image has True values indicating the trapped voxels. If return_mask is False, then a copy of seq is returned with trapped voxels set to 0.

Return type:



Click here to view online example.