fill_trapped_voxels¶
- fill_trapped_voxels(seq: ndarray[Any, dtype[_ScalarType_co]], trapped: ndarray[Any, dtype[_ScalarType_co]] = None, max_size: int = 1, conn: str = 'min')[source]¶
Finds small isolated clusters of voxels which were identified as trapped and sets them to invaded.
- Parameters:
seq (ndarray) – The sequence map resulting from an invasion process where trapping has been applied, such that trapped voxels are labelled -1.
trapped (ndarray, optional) – The boolean array of the trapped voxels. If this is not available than all voxels in seq with a value < 0 are used.
min_size (int) – The maximum size of the clusters which are to be filled. Clusters larger than this size are left trapped.
conn (str) –
Controls the shape of the structuring element used to find neighboring voxels when looking for sequence values to place into un-trapped voxels. Options are:
Option
Description
’min’
This corresponds to a cross with 4 neighbors in 2D and 6 neighbors in 3D.
’max’
This corresponds to a square or cube with 8 neighbors in 2D and 26 neighbors in 3D.
- Returns:
A dataclass-like object with the following images as attributes:
Attribute
Description
’seq’
The invasion sequence image with erroneously trapped voxels set back to untrapped, and given the sequence number of their nearby voxels.
’trapped’
An updated mask of trapped voxels with the erroneously trapped voxels removed (i.e. set to False).
- Return type:
results
Notes
This function has to essentially guess which sequence value to put into each un-trapped voxel so the sequence values can differ between the output of this function and the result returned by the various invasion algorithms where the trapping is computed internally. However, the fluid configuration for a given saturation will be nearly identical.