Skip to content

Commit ea15f21

Browse files
committed
Change the custom PatientAgeCalculated "DICOM" tag to PatientAgeDerived (GitHub issue #267)
1 parent cb2f50e commit ea15f21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bidscoin/plugins/dcm2niix2bids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ def get_attribute(self, dataformat: Union[DataFormat, str], sourcefile: Path, at
105105
if dataformat == 'DICOM':
106106

107107
# Parse custom "DICOM" tags
108-
if attribute == 'PatientAgeCalculated':
108+
if attribute == 'PatientAgeDerived':
109109
try:
110110
acqdate = datetime.strptime(get_dicomfield('AcquisitionDate', sourcefile), '%Y%m%d')
111111
birthdate = datetime.strptime(get_dicomfield('PatientBirthDate', sourcefile), '%Y%m%d')
112112
return (acqdate - birthdate).days / 365.25
113113
except Exception as dateerror:
114-
LOGGER.warning(f"Could not calculate 'PatientAgeCalculated' from 'AcquisitionDate' and 'PatientBirthDate' in {sourcefile}, using 'PatientAge' instead\n{dateerror}")
114+
LOGGER.warning(f"Could not calculate 'PatientAgeDerived' from 'AcquisitionDate' and 'PatientBirthDate' in {sourcefile}, using 'PatientAge' instead\n{dateerror}")
115115
return get_dicomfield('PatientAge', sourcefile)
116116
else:
117117
return get_dicomfield(attribute, sourcefile)

0 commit comments

Comments
 (0)