Skip to content

Commit 02f7791

Browse files
committed
Add AcquisitionDateTime to resolve PatientAgeDerived for the latest XA DICOM versions (GitHub issue #267)
1 parent 176afda commit 02f7791

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bidscoin/plugins/dcm2niix2bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def get_attribute(self, dataformat: Union[DataFormat, str], sourcefile: Path, at
107107
# Parse custom "DICOM" tags
108108
if attribute == 'PatientAgeDerived':
109109
try:
110-
acqdate = datetime.strptime(get_dicomfield('AcquisitionDate', sourcefile), '%Y%m%d')
110+
acqdate = datetime.strptime(get_dicomfield('AcquisitionDate', sourcefile) or get_dicomfield('AcquisitionDateTime', 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:

0 commit comments

Comments
 (0)