Skip to content

Commit

Permalink
fixed up handling of scans without metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Nov 16, 2023
1 parent 52038b4 commit fa27685
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xnat_ingest/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,14 @@ def upload(
staged_session.select_resources(dataset, include_all_dicoms=include_dicoms),
f"Uploading scans found in {session.name}",
):
image_type = scan.metadata.get("ImageType")
if image_type and image_type[:2] == ["DERIVED", "SECONDARY"]:
modality = "SC"
if scan.metadata:
image_type = scan.metadata.get("ImageType")
if image_type and image_type[:2] == ["DERIVED", "SECONDARY"]:
modality = "SC"
else:
modality = scan.metadata.get("Modality", default_scan_modality)
else:
modality = scan.metadata.get("Modality", default_scan_modality)
modality = default_scan_modality
if modality == "SC":
ScanClass = xnat_repo.connection.classes.ScScanData
elif modality == "MR":
Expand Down

0 comments on commit fa27685

Please sign in to comment.