From 5129684e4f1344a0649b5d12917c5b8bd6fa3427 Mon Sep 17 00:00:00 2001 From: Marco Barbieri Date: Fri, 26 Oct 2018 11:42:08 -0700 Subject: [PATCH] medial-lateral scanning direction is correctly taken into account --- tissues/femoral_cartilage.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tissues/femoral_cartilage.py b/tissues/femoral_cartilage.py index fdcff32..e5682d0 100644 --- a/tissues/femoral_cartilage.py +++ b/tissues/femoral_cartilage.py @@ -184,16 +184,18 @@ def split_regions(self, unrolled_quantitative_map): unrolled_mask[np.where(unrolled_mask < 1)] = self.BACKGROUND_KEY - lateral_mask = np.copy(unrolled_mask)[:, 0:np.int(np.around(center_of_mass[1]))] - medial_mask = np.copy(unrolled_mask)[:, np.int(np.around(center_of_mass[1])):] - - lateral_mask[np.where(lateral_mask < self.BACKGROUND_KEY)] = self.LATERAL_KEY - medial_mask[np.where(medial_mask < self.BACKGROUND_KEY)] = self.MEDIAL_KEY + left_side_mask = np.copy(unrolled_mask)[:, 0:np.int(np.around(center_of_mass[1]))] + right_side_mask = np.copy(unrolled_mask)[:, np.int(np.around(center_of_mass[1])):] + # take into account scanning direction if self.medial_to_lateral: - ml_mask = np.concatenate((medial_mask, lateral_mask), axis=1) + left_side_mask[np.where(left_side_mask < self.BACKGROUND_KEY)] = self.MEDIAL_KEY + right_side_mask[np.where(right_side_mask < self.BACKGROUND_KEY)] = self.LATERAL_KEY else: - ml_mask = np.concatenate((lateral_mask, medial_mask), axis=1) + left_side_mask[np.where(left_side_mask < self.BACKGROUND_KEY)] = self.LATERAL_KEY + right_side_mask[np.where(right_side_mask < self.BACKGROUND_KEY)] = self.MEDIAL_KEY + + ml_mask = np.concatenate((left_side_mask, right_side_mask), axis=1) # Split map in anterior, central and posterior regions anterior_mask = np.copy(unrolled_mask)[0:np.int(center_of_mass[0]), :]