From 443dcd21f01bae0761bda28b08b4424a56a730d7 Mon Sep 17 00:00:00 2001 From: Nassim Bouteldja <nbouteldja@ukaachen.de> Date: Wed, 6 Jul 2022 13:34:22 +0200 Subject: [PATCH] Update computeFeatures.py --- computeFeatures.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/computeFeatures.py b/computeFeatures.py index f9164e8..040e409 100644 --- a/computeFeatures.py +++ b/computeFeatures.py @@ -35,7 +35,15 @@ import scipy.ndimage import scipy as sp from skimage.morphology import remove_small_objects -from utils import getBoundingBox + +# Takes a binary mask image and outputs its bounding box +def getBoundingBox(img): + rows = np.any(img, axis=1) + cols = np.any(img, axis=0) + rmin, rmax = np.where(rows)[0][[0, -1]] + cmin, cmax = np.where(cols)[0][[0, -1]] + + return rmin, rmax, cmin, cmax # Computes sizes, diameters, and distance_to_closest_glom features for each glom @@ -385,4 +393,4 @@ log.info('%%%% Ended regularly ! %%%%') # print('Glom: {}'.format(glomN)) # print('Tuft: {}'.format(tuftN)) # print('Artery: {}'.format(arteryN)) -# print('Lumen: {}'.format(lumenN)) \ No newline at end of file +# print('Lumen: {}'.format(lumenN)) -- GitLab