Skip to content

Commit

Permalink
handle the case where a single dicom path is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Dec 15, 2023
1 parent 3888bca commit 12c6307
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xnat_ingest/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ def from_dicoms(
DICOM files within the session
"""
if isinstance(dicoms_path, Path) or "*" not in dicoms_path:
dicom_fspaths = list(Path(dicoms_path).iterdir())
dicoms_path = Path(dicoms_path)
if not dicoms_path.exists():
raise ValueError(f"Provided DICOMs path '{dicoms_path}' does not exist")
if dicoms_path.is_dir():
dicom_fspaths = list(Path(dicoms_path).iterdir())
else:
dicom_fspaths = [dicoms_path]
else:
dicom_fspaths = [Path(p) for p in glob(dicoms_path)]

Expand Down

0 comments on commit 12c6307

Please sign in to comment.