Skip to content

Commit

Permalink
lazily import medimages4tests to speed up cases where it isn't required
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Oct 10, 2024
1 parent c0eedb3 commit 7d8f430
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions xnat4tests/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
from contextlib import contextmanager
from pathlib import Path
from xnat.exceptions import XNATResponseError
from medimages4tests.dummy.dicom.mri.t1w.siemens.skyra.syngo_d13c import (
get_image as t1w_syngo,
)
from medimages4tests.dummy.dicom.mri.dwi.siemens.skyra.syngo_d13c import (
get_image as dwi_syngo,
)
from medimages4tests.dummy.dicom.mri.fmap.siemens.skyra.syngo_d13c import (
get_image as fmap_syngo,
)
from medimages4tests.mri.neuro.t1w import get_image as openneuro_t1w
from .base import connect
from .config import Config
from .utils import logger
Expand Down Expand Up @@ -64,6 +54,15 @@ def add_data(dataset: str, config_name: str or dict = "default"):
)

if dataset == "dummydicom":
from medimages4tests.dummy.dicom.mri.t1w.siemens.skyra.syngo_d13c import (
get_image as t1w_syngo,
)
from medimages4tests.dummy.dicom.mri.dwi.siemens.skyra.syngo_d13c import (
get_image as dwi_syngo,
)
from medimages4tests.dummy.dicom.mri.fmap.siemens.skyra.syngo_d13c import (
get_image as fmap_syngo,
)

_upload_dicom_data(
[t1w_syngo(), dwi_syngo(), fmap_syngo()],
Expand All @@ -74,6 +73,7 @@ def add_data(dataset: str, config_name: str or dict = "default"):
)

elif dataset == "openneuro-t1w":
from medimages4tests.mri.neuro.t1w import get_image as openneuro_t1w

_upload_directly(
{"t1w": openneuro_t1w()},
Expand Down Expand Up @@ -119,6 +119,9 @@ def add_data(dataset: str, config_name: str or dict = "default"):
)

elif dataset == "user-training":
from medimages4tests.dummy.dicom.mri.fmap.siemens.skyra.syngo_d13c import (
get_image as fmap_syngo,
)

_upload_dicom_data(
[t1w_syngo(), fmap_syngo()],
Expand Down

0 comments on commit 7d8f430

Please sign in to comment.