From b2c9fa5d8b27d754c942194709cd6a510fbac7fa Mon Sep 17 00:00:00 2001 From: AlainKadar Date: Tue, 23 Jan 2024 10:40:34 -0500 Subject: [PATCH] Relax constraints on names of 2d images --- StructuralGT/networks.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/StructuralGT/networks.py b/StructuralGT/networks.py index 5f7b0f2..64f82b7 100644 --- a/StructuralGT/networks.py +++ b/StructuralGT/networks.py @@ -49,7 +49,7 @@ class Network: """ def __init__(self, directory, child_dir="Binarized", depth=None, - prefix="slice"): + prefix="slice", dim=2): self.dir = directory self.child_dir = '/' + child_dir @@ -62,11 +62,13 @@ def __init__(self, directory, child_dir="Binarized", depth=None, for slice_name in sorted(os.listdir(self.dir)): fname = _fname(self.dir + '/' + slice_name, domain=_domain(depth)) + if (dim==2 and fname.isimg): + _slice = plt.imread(self.dir + "/" + slice_name) + image_stack.append(_slice, slice_name) + break if (fname.isinrange and fname.isimg and self.prefix in fname.prefix): - #_slice = cv.imread(self.dir + "/" + slice_name) - _slice = plt.imread(self.dir + "/" + slice_name) image_stack.append(_slice, slice_name) self.image_stack = image_stack