find_trapped_regions#
- find_trapped_regions(seq, outlets=None, bins=25, return_mask=True)[source]#
Find the trapped regions given an invasion sequence image
- Parameters:
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
withTrue
indicating outlets andFalse
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 ofbins
will provide a more accurate trapping analysis, but is more time consuming. IfNone
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. IfFalse
, then a copy ofseq
is returned with the trapped voxels set to uninvaded and the invasion sequence values adjusted accordingly.
- Returns:
trapped – An image, the same size as
seq
. Ifreturn_mask
isTrue
, then the image hasTrue
values indicating the trapped voxels. Ifreturn_mask
isFalse
, then a copy ofseq
is returned with trapped voxels set to 0.- Return type:
ND-image
Examples
Click here to view online example.