diff --git a/SIRF_data_preparation/dataset_settings.py b/SIRF_data_preparation/dataset_settings.py index 25b6ab8..a59d52e 100644 --- a/SIRF_data_preparation/dataset_settings.py +++ b/SIRF_data_preparation/dataset_settings.py @@ -1,7 +1,12 @@ """Settings for recon and display used in the data preparation""" - from dataclasses import dataclass +from petric import DATA_SLICES + +DATA_SUBSETS = { + 'Siemens_mMR_NEMA_IQ': 7, 'Siemens_mMR_ACR': 7, 'NeuroLF_Hoffman_Dataset': 16, 'Mediso_NEMA_IQ': 12, + 'Siemens_Vision600_thorax': 5} + @dataclass class DatasetSettings: @@ -10,19 +15,4 @@ class DatasetSettings: def get_settings(scanID: str): - if scanID == 'Siemens_mMR_NEMA_IQ': - slices = {'transverse_slice': 72, 'coronal_slice': 109} # , 'sagittal_slice': 89} - num_subsets = 7 - elif scanID == 'Siemens_mMR_ACR': - slices = {'transverse_slice': 99} - num_subsets = 7 - elif scanID == 'NeuroLF_Hoffman_Dataset': - slices = {'transverse_slice': 72} - num_subsets = 16 - elif scanID == 'Mediso_NEMA_IQ': - slices = {'transverse_slice': 22, 'coronal_slice': 89, 'sagittal_slice': 66} - num_subsets = 12 - else: # Vision - slices = {} - num_subsets = 5 - return DatasetSettings(num_subsets, slices) + return DatasetSettings(DATA_SUBSETS[scanID], DATA_SLICES[scanID]) diff --git a/petric.py b/petric.py index eaa45cd..e1b886a 100755 --- a/petric.py +++ b/petric.py @@ -246,15 +246,23 @@ def get_image(fname): whole_object_mask, background_mask, voi_masks, srcdir.resolve()) +DATA_SLICES = { + 'Siemens_mMR_NEMA_IQ': {'transverse_slice': 72, 'coronal_slice': 109}, # 'sagittal_slice': 89 + 'Siemens_mMR_ACR': {'transverse_slice': 99}, + 'NeuroLF_Hoffman_Dataset': {'transverse_slice': 72}, + 'Mediso_NEMA_IQ': {'transverse_slice': 22, 'coronal_slice': 89, 'sagittal_slice': 66}, + 'Siemens_Vision600_thorax': {}} + if SRCDIR.is_dir(): # create list of existing data # NB: `MetricsWithTimeout` initialises `SaveIters` which creates `outdir` - data_dirs_metrics = [(SRCDIR / "Siemens_mMR_NEMA_IQ", OUTDIR / "mMR_NEMA", - [MetricsWithTimeout(outdir=OUTDIR / "mMR_NEMA", transverse_slice=72, coronal_slice=109)]), - (SRCDIR / "NeuroLF_Hoffman_Dataset", OUTDIR / "NeuroLF_Hoffman", - [MetricsWithTimeout(outdir=OUTDIR / "NeuroLF_Hoffman", transverse_slice=72)]), - (SRCDIR / "Siemens_Vision600_thorax", OUTDIR / "Vision600_thorax", - [MetricsWithTimeout(outdir=OUTDIR / "Vision600_thorax")])] + data_dirs_metrics = [ + (SRCDIR / "Siemens_mMR_NEMA_IQ", OUTDIR / "mMR_NEMA", + [MetricsWithTimeout(outdir=OUTDIR / "mMR_NEMA", **DATA_SLICES['Siemens_mMR_NEMA_IQ'])]), + (SRCDIR / "NeuroLF_Hoffman_Dataset", OUTDIR / "NeuroLF_Hoffman", + [MetricsWithTimeout(outdir=OUTDIR / "NeuroLF_Hoffman", **DATA_SLICES['NeuroLF_Hoffman_Dataset'])]), + (SRCDIR / "Siemens_Vision600_thorax", OUTDIR / "Vision600_thorax", + [MetricsWithTimeout(outdir=OUTDIR / "Vision600_thorax", **DATA_SLICES['Siemens_Vision600_thorax'])])] else: log.warning("Source directory does not exist: %s", SRCDIR) data_dirs_metrics = [(None, None, [])] # type: ignore