Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors:
orcid: "https://orcid.org/0000-0002-3343-1005"
title: "py-micp: An Open-Source Simulation Workflow for Field-Scale Application of
Microbially Induced Calcite Precipitation Technology for Leakage Remediation"
version: 2025.10
version: "2025.10"
year: 2025
doi: 10.5281/zenodo.8430988
url: "https://github.com/cssr-tools/pymm"
25 changes: 17 additions & 8 deletions src/pymm/core/pymm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: 2022-2025 NORCE Research AS
# SPDX-License-Identifier: GPL-3.0
# pylint: disable=R0912,R0915,E1102
# pylint: disable=R0912,R0915,E1102,E1123

"""Main script for pymm"""

Expand Down Expand Up @@ -173,16 +173,25 @@ def process_image(dic, in_image):
axis.set_yticks([])
fig.savefig(f"{dic['fol']}/binary_image.png", dpi=600)
# Extract the contour of the grains on the image border and interior
dic["border"] = ps.filters.trim_small_clusters(
dic["im"], size=(dic["imH"] + 2 * dic["imL"]) * dic["ad_bord"]
)
if int(ps.__version__.split(".", maxsplit=1)[0]) > 2:
dic["border"] = ps.filters.trim_small_clusters(
dic["im"], min_size=(dic["imH"] + 2 * dic["imL"]) * dic["ad_bord"]
)
grains = ps.filters.trim_small_clusters(
np.logical_and(np.bitwise_not(dic["border"]), dic["im"]),
min_size=dic["grainsSize"],
)
else:
dic["border"] = ps.filters.trim_small_clusters(
dic["im"], size=(dic["imH"] + 2 * dic["imL"]) * dic["ad_bord"]
)
grains = ps.filters.trim_small_clusters(
np.logical_and(np.bitwise_not(dic["border"]), dic["im"]),
size=dic["grainsSize"],
)
dic["cn_border"] = measure.find_contours(
dic["border"], 0.5, fully_connected="high", positive_orientation="high"
)
grains = ps.filters.trim_small_clusters(
np.logical_and(np.bitwise_not(dic["border"]), dic["im"]),
size=dic["grainsSize"],
)
grains = grains[dic["ad_bord"] : -dic["ad_bord"], dic["ad_bord"] : -dic["ad_bord"]]
dic["cn_grains"] = measure.find_contours(
grains, 0.5, fully_connected="high", positive_orientation="high"
Expand Down