Skip to content

Commit

Permalink
Merge pull request #105 from SyneRBI/data-slices
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Sep 13, 2024
2 parents 5c1fa8a + 955bd0e commit 4a8a865
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
24 changes: 7 additions & 17 deletions SIRF_data_preparation/dataset_settings.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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])
20 changes: 14 additions & 6 deletions petric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a8a865

Please sign in to comment.