Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/porespy/filters/_displacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def find_trapped_clusters(
im: npt.ArrayLike,
seq: npt.ArrayLike,
outlets: npt.ArrayLike,
min_size: int = 0,
conn: Literal["min", "max"] = "min",
method: Literal["queue", "labels"] = "labels",
):
Expand All @@ -231,6 +232,9 @@ def find_trapped_clusters(
outlets : ndarray
An image the same size as ``im`` with ``True`` indicating outlets
and ``False`` elsewhere.
min_size : scalar
The threshold size of clusters. Clusters with this many voxels or fewer
will be ignored.
conn : str
Controls the shape of the structuring element used to determine if voxels
are connected. Options are:
Expand Down Expand Up @@ -288,7 +292,12 @@ def find_trapped_clusters(
else:
raise Exception(f"{method} is not a supported method")

return (seq_temp == -1) * im
trapped = (seq_temp == -1) * im

if min_size > 0:
trapped = trim_small_clusters(im=trapped, min_size=min_size)

return trapped


def _find_trapped_clusters_labels(
Expand Down
4 changes: 2 additions & 2 deletions src/porespy/filters/_lt_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def porosimetry(
from porespy.simulations import drainage_dt
drn = drainage_dt(im=im, inlets=inlets, steps=sizes, smooth=smooth)
elif method in ['dsi', 'bf']:
from porespy.simulations import drainage_dsi
drn = drainage_dsi(im=im, inlets=inlets, steps=sizes, smooth=smooth)
from porespy.simulations import drainage_bf
drn = drainage_bf(im=im, inlets=inlets, steps=sizes, smooth=smooth)
if method in ['fft', 'conv']:
from porespy.simulations import drainage_fft
drn = drainage_fft(im=im, inlets=inlets, steps=sizes, smooth=smooth)
Expand Down
Loading
Loading