Skip to content

Commit

Permalink
fixed bug in split_regions when assessing if two arrays with NaN elem…
Browse files Browse the repository at this point in the history
…ents where equal
  • Loading branch information
Marco Barbieri committed Oct 25, 2018
1 parent 4a0fa6b commit 0f8eae4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tissues/femoral_cartilage.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,17 @@ def split_regions(self, unrolled_quantitative_map):

assert ml_mask.shape == acp_mask.shape

# convert backgorund label to NaN
ml_mask[ml_mask == self.BACKGROUND_KEY] = np.nan
acp_mask[acp_mask == self.BACKGROUND_KEY] = np.nan

ml_mask = ml_mask[..., np.newaxis]
acp_mask = acp_mask[..., np.newaxis]

self.regions_mask = np.concatenate((ml_mask, acp_mask), axis=2)

# convert backgorund label to NaN
self.regions_mask[self.regions_mask == self.BACKGROUND_KEY] = np.nan

assert (self.regions_mask[..., 0] == ml_mask[..., 0]).all()
assert (self.regions_mask[..., 1] == acp_mask[..., 0]).all()
assert np.allclose(self.regions_mask[..., 0], ml_mask[..., 0], equal_nan=True)
assert np.allclose(self.regions_mask[..., 1], acp_mask[..., 0], equal_nan=True)

def calc_quant_vals(self, quant_map, map_type):
"""
Expand Down

0 comments on commit 0f8eae4

Please sign in to comment.