Skip to content

Commit

Permalink
revert to re.split, use maxsplit=1
Browse files Browse the repository at this point in the history
  • Loading branch information
jbwexler committed May 14, 2024
1 parent a76c19b commit ffffacb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ requires = ["setuptools", "wheel"]

[project]
name = "wbhiutils"
version = "0.0.2"
version = "0.0.3"
4 changes: 2 additions & 2 deletions wbhiutils/parse_dicom_hdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# 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]
elif site == 'ucb':
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

0 comments on commit ffffacb

Please sign in to comment.