From f62071a688e77c46e67d0be6e687d22e78dc0dfc Mon Sep 17 00:00:00 2001 From: Jeff Gostick Date: Wed, 25 Oct 2023 12:19:34 +0900 Subject: [PATCH 1/9] adding 3.11 and 3.12....maybe too ambitious --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d25e9e0dc..b13d114ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: max-parallel: 9 matrix: # Add '3.10' to the list once #611 is addressed - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-latest, windows-latest] include: - os: ubuntu-latest From 11e4fea2798b9fdd95e2db773a576e65de0621f3 Mon Sep 17 00:00:00 2001 From: Jeff Gostick Date: Wed, 25 Oct 2023 12:45:47 +0900 Subject: [PATCH 2/9] adding PyWavelets to deps --- requirements/conda.txt | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/requirements/conda.txt b/requirements/conda.txt index ab3916dc9..5a8143137 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -16,3 +16,4 @@ scikit-learn scipy tqdm trimesh +PyWavelets diff --git a/setup.py b/setup.py index 15185b4e1..70513e3e2 100644 --- a/setup.py +++ b/setup.py @@ -83,6 +83,7 @@ def get_version(rel_path): 'scikit-image', 'scipy', 'tqdm', + 'PyWavelets', ], author='PoreSpy Team', author_email='jgostick@gmail.com', From 3cd81058cb310e92e3c776b957ea33f26c0090c7 Mon Sep 17 00:00:00 2001 From: Author Date: Wed, 25 Oct 2023 03:46:11 +0000 Subject: [PATCH 3/9] Bump version number (build part) --- porespy/__version__.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/porespy/__version__.py b/porespy/__version__.py index 906d56357..ee01f3e25 100644 --- a/porespy/__version__.py +++ b/porespy/__version__.py @@ -1 +1 @@ -__version__ = '2.3.0.dev11' +__version__ = '2.3.0.dev12' diff --git a/setup.cfg b/setup.cfg index f5059fae8..cd57bc845 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.0.dev11 +current_version = 2.3.0.dev12 parse = (?P\d+)\.(?P\d+)\.(?P\d+)\.(?P\D+)(?P\d+)? serialize = {major}.{minor}.{patch}.{release}{build} From dc4107099bb1871a88def77d5af0553907299612 Mon Sep 17 00:00:00 2001 From: Jeff Gostick Date: Wed, 25 Oct 2023 17:39:10 +0900 Subject: [PATCH 4/9] updating find_disconnected_voxels to work with new python versions --- porespy/filters/_funcs.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/porespy/filters/_funcs.py b/porespy/filters/_funcs.py index 6303371c5..a9304820e 100644 --- a/porespy/filters/_funcs.py +++ b/porespy/filters/_funcs.py @@ -400,12 +400,14 @@ def find_disconnected_voxels(im, conn=None, surface=False): else: raise Exception("Received conn is not valid") labels, N = spim.label(input=im, structure=strel) - if not surface: - holes = clear_border(labels=labels) > 0 - else: - counts = np.bincount(labels.flatten())[1:] - keep = np.where(counts == counts.max())[0] + 1 - holes = (labels != keep)*im + holes = clear_border(labels=labels) > 0 + if surface: + from porespy.generators import borders + bd = borders(im.shape, mode='faces') + hits = np.unique(labels[bd]) + hits = hits[hits > 0] + face_holes = np.isin(labels, hits).reshape(im.shape) + holes += face_holes return holes From fa8a7dd1d20cc97fe5c494e9c941825456e49f55 Mon Sep 17 00:00:00 2001 From: Author Date: Wed, 25 Oct 2023 08:40:03 +0000 Subject: [PATCH 5/9] Bump version number (build part) --- porespy/__version__.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/porespy/__version__.py b/porespy/__version__.py index ee01f3e25..e2f547fd0 100644 --- a/porespy/__version__.py +++ b/porespy/__version__.py @@ -1 +1 @@ -__version__ = '2.3.0.dev12' +__version__ = '2.3.0.dev13' diff --git a/setup.cfg b/setup.cfg index cd57bc845..c2e4fdac2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.0.dev12 +current_version = 2.3.0.dev13 parse = (?P\d+)\.(?P\d+)\.(?P\d+)\.(?P\D+)(?P\d+)? serialize = {major}.{minor}.{patch}.{release}{build} From a11b86a06fb3e8fff17ac0a8c7b7994502afeeec Mon Sep 17 00:00:00 2001 From: Jeff Gostick Date: Wed, 25 Oct 2023 19:30:14 +0900 Subject: [PATCH 6/9] find_disconnected_voxels is now fully robust --- porespy/filters/_funcs.py | 18 ++++++++++-------- test/unit/test_filters.py | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/porespy/filters/_funcs.py b/porespy/filters/_funcs.py index a9304820e..ceefecd70 100644 --- a/porespy/filters/_funcs.py +++ b/porespy/filters/_funcs.py @@ -400,14 +400,16 @@ def find_disconnected_voxels(im, conn=None, surface=False): else: raise Exception("Received conn is not valid") labels, N = spim.label(input=im, structure=strel) - holes = clear_border(labels=labels) > 0 - if surface: - from porespy.generators import borders - bd = borders(im.shape, mode='faces') - hits = np.unique(labels[bd]) - hits = hits[hits > 0] - face_holes = np.isin(labels, hits).reshape(im.shape) - holes += face_holes + if not surface: + holes = clear_border(labels=labels) > 0 + else: + keep = set(np.unique(labels)) + for ax in range(labels.ndim): + labels = np.swapaxes(labels, 0, ax) + keep.intersection_update(set(np.unique(labels[0, ...]))) + keep.intersection_update(set(np.unique(labels[-1, ...]))) + labels = np.swapaxes(labels, 0, ax) + holes = np.isin(labels, list(keep), invert=True) return holes diff --git a/test/unit/test_filters.py b/test/unit/test_filters.py index 023117e59..bbc318458 100644 --- a/test/unit/test_filters.py +++ b/test/unit/test_filters.py @@ -223,6 +223,20 @@ def test_fill_blind_pores_w_surface(self): im3 = ps.filters.fill_blind_pores(im, surface=True) assert im3.sum() == 0 + def test_fill_blind_pores_surface_blobs_2D(self): + im = ps.generators.blobs([100, 100], porosity=0.6, seed=0) + im2 = ps.filters.fill_blind_pores(im) + assert im.sum() == 6021 + assert im2.sum() == 5981 + im3 = ps.filters.fill_blind_pores(im, surface=True) + assert im3.sum() == 5699 + + def test_fill_blind_pores_surface_blobs_3D(self): + im = ps.generators.blobs([100, 100, 100], porosity=0.5) + im2 = ps.filters.fill_blind_pores(im, surface=True) + labels, N = spim.label(im2, ps.tools.ps_rect(3, ndim=3)) + assert N == 1 + def test_trim_floating_solid(self): f = ps.filters.trim_floating_solid(~self.im) assert np.sum(f) > np.sum(~self.im) From b6aa77471c910b63bb9af851a8191a3dbfaf248b Mon Sep 17 00:00:00 2001 From: Author Date: Wed, 25 Oct 2023 10:30:51 +0000 Subject: [PATCH 7/9] Bump version number (build part) --- porespy/__version__.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/porespy/__version__.py b/porespy/__version__.py index e2f547fd0..786161597 100644 --- a/porespy/__version__.py +++ b/porespy/__version__.py @@ -1 +1 @@ -__version__ = '2.3.0.dev13' +__version__ = '2.3.0.dev14' diff --git a/setup.cfg b/setup.cfg index c2e4fdac2..ff11cea06 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.0.dev13 +current_version = 2.3.0.dev14 parse = (?P\d+)\.(?P\d+)\.(?P\d+)\.(?P\D+)(?P\d+)? serialize = {major}.{minor}.{patch}.{release}{build} From 8948e723fb91e97c9797b08305e4ec840ae19245 Mon Sep 17 00:00:00 2001 From: Jeff Gostick Date: Wed, 25 Oct 2023 20:01:31 +0900 Subject: [PATCH 8/9] 3.12 was too ambitions, skfmm does not install --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b13d114ec..32121f76d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: max-parallel: 9 matrix: # Add '3.10' to the list once #611 is addressed - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11'] os: [ubuntu-latest, macos-latest, windows-latest] include: - os: ubuntu-latest From 5df5dcece83a786236b10c821b95556a736183ca Mon Sep 17 00:00:00 2001 From: Author Date: Wed, 25 Oct 2023 11:56:34 +0000 Subject: [PATCH 9/9] Bump version number (build part) --- porespy/__version__.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/porespy/__version__.py b/porespy/__version__.py index 786161597..79a9ed412 100644 --- a/porespy/__version__.py +++ b/porespy/__version__.py @@ -1 +1 @@ -__version__ = '2.3.0.dev14' +__version__ = '2.3.0.dev15' diff --git a/setup.cfg b/setup.cfg index ff11cea06..527ef013f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.0.dev14 +current_version = 2.3.0.dev15 parse = (?P\d+)\.(?P\d+)\.(?P\d+)\.(?P\D+)(?P\d+)? serialize = {major}.{minor}.{patch}.{release}{build}