diff --git a/pyproject.toml b/pyproject.toml index 5e8bb6d..8d1f974 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,4 +3,4 @@ requires = ["setuptools", "wheel"] [project] name = "wbhiutils" -version = "0.0.2" +version = "0.0.3" diff --git a/wbhiutils/parse_dicom_hdr.py b/wbhiutils/parse_dicom_hdr.py index 78c6715..bf5f795 100644 --- a/wbhiutils/parse_dicom_hdr.py +++ b/wbhiutils/parse_dicom_hdr.py @@ -3,7 +3,7 @@ # Parse a dicom header and return the pi-id and sub-id def parse_pi_sub(dcm_hdr, site): if site == 'ucsb': - pi_id, sub_id = dcm_hdr["PatientName"].split('^')[:2] + pi_id, sub_id = re.split('[^0-9a-zA-Z]', dcm_hdr["PatientName"], maxsplit=1) elif site == 'uci': pi_id = re.split('[^0-9a-zA-Z]', dcm_hdr["PatientName"])[0] sub_id = re.split('[^0-9a-zA-Z]', dcm_hdr["PatientID"])[0] @@ -11,6 +11,6 @@ def parse_pi_sub(dcm_hdr, site): pi_id = re.split(' ', dcm_hdr["StudyDescription"])[0] sub_id = dcm_hdr["PatientName"] else: - pi_id, sub_id = dcm_hdr["PatientName"].split('^')[:2] + pi_id, sub_id = re.split('[^0-9a-zA-Z]', dcm_hdr["PatientName"], maxsplit=1) return pi_id, sub_id