File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -303,9 +303,16 @@ def update_json_with_dicom_value(
303303
304304 # lastly if ezbids is true update the sidecar with acquisition data
305305 if ezbids :
306+ acquisition_date = parser .parse (dicom_header .get ("AcquisitionDate" , "" ))
307+ acquisition_time = parser .parse (dicom_header .get ("AcquisitionTime" , "" ))
308+ if acquisition_time and acquisition_date :
309+ acquisition_datetime = datetime .datetime .combine (acquisition_date .date (), acquisition_time .time ())
310+ else :
311+ acquisition_datetime = "0000-00-00T00:00:00"
306312 json_updater .update (
307- {"AcquisitionDate" : dicom_header .get ("AcquisitionDate" , "" ),
308- "AcquisitionTime" : dicom_header .get ("AcquisitionTime" , "" ),
313+ {"AcquisitionDate" : f"{ acquisition_date .date ()} " ,
314+ "AcquisitionTime" : f"{ acquisition_time .time ()} " ,
315+ "AcquisitionDateTime" : f"{ acquisition_datetime .isoformat ()} "
309316 })
310317
311318 # after updating raise warnings to user if values in json don't match values in dicom headers, only warn!
You can’t perform that action at this time.
0 commit comments