From 6d366b7313e7faa50a09fd03a49c8501b508d798 Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 27 Oct 2023 08:21:46 -0700 Subject: [PATCH] Update mapss logic to handle masks --- dosma/scan_sequences/mri/mapss.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dosma/scan_sequences/mri/mapss.py b/dosma/scan_sequences/mri/mapss.py index df2c02b..d50f32f 100644 --- a/dosma/scan_sequences/mri/mapss.py +++ b/dosma/scan_sequences/mri/mapss.py @@ -223,13 +223,20 @@ def __fitting_helper( ys = [vol for _, vol in echo_info] # only calculate for focused region if a mask is available, this speeds up computation - mask = tissue.get_mask() - if mask_path is not None: + if tissue is not None: + mask = tissue.get_mask() + elif mask_path is not None: mask = ( fio_utils.generic_load(mask_path, expected_num_volumes=1) if isinstance(mask_path, (str, os.PathLike)) else mask_path ) + else: + mask = MedicalVolume( + volume=np.zeros_like(self.volumes[0].volume), + affine=volumes[0].affine, + headers=deepcopy(volumes[0].headers()) + ) mef = MonoExponentialFit( bounds=bounds,