Skip to content

Commit

Permalink
medial-lateral scanning direction is correctly taken into account
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Barbieri committed Oct 26, 2018
1 parent 0f8eae4 commit 5129684
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tissues/femoral_cartilage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]), :]
Expand Down

0 comments on commit 5129684

Please sign in to comment.