Skip to content

Commit

Permalink
Add UCR to parse_dicom_hdr.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jbwexler authored Dec 20, 2024
1 parent 07e0c9d commit 2c712c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wbhiutils/parse_dicom_hdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def parse_pi(dcm_hdr: dict, site: str) -> str:
return dcm_hdr["ReferringPhysicianName"]
elif site == 'ucsf':
return re.split('[^0-9a-zA-Z]', dcm_hdr["StudyDescription"], maxsplit=1)[1]
elif site == 'ucr':
if dcm_hdr["StudyDescription"].startswith("LC_Grant Final_Setup"):
return "lc_grant"
return re.match(r"^(PSYCHOLOGY|BIO|BIOE)-([A-Za-z0-9]+)", dcm_hdr["StudyDescription"]).group(2)
else:
return re.split('[^0-9a-zA-Z]', dcm_hdr["PatientName"], maxsplit=1)[0]

Expand All @@ -30,5 +34,7 @@ def parse_sub(dcm_hdr: dict, site: str) -> str:
return dcm_hdr["PatientID"]
elif site == 'ucsf':
return dcm_hdr["PatientID"]
elif site == 'ucr':
return dcm_hdr["PatientName"]
else:
return re.split('[^0-9a-zA-Z]', dcm_hdr["PatientName"], maxsplit=1)[1]

0 comments on commit 2c712c1

Please sign in to comment.