@@ -149,6 +149,7 @@ def update_json_with_dicom_value(
149
149
dicom_header ,
150
150
dicom2bids_json = None ,
151
151
silent = True ,
152
+ ezbids = False ,
152
153
** additional_arguments ,
153
154
):
154
155
"""
@@ -160,6 +161,9 @@ def update_json_with_dicom_value(
160
161
:param missing_values: dictionary output from check_json indicating missing fields and/or values
161
162
:param dicom_header: the dicom or dicoms that may contain information not picked up by dcm2niix
162
163
:param dicom2bids_json: a json file that maps dicom header entities to their corresponding BIDS entities
164
+ :param silent: run silently without error, status, or warning messages
165
+ :param ezbids: boolean to supply additional data that ezbids or other software requires, defaults to false. When
166
+ true the sidecar json will be updated with AcquisitionDate, AcquisitionTime, and AcquisitionDateTime
163
167
:return: a dictionary of successfully updated (written to the json file) fields and values
164
168
"""
165
169
@@ -297,6 +301,13 @@ def update_json_with_dicom_value(
297
301
# remove scandate if it exists
298
302
json_updater .remove ("ScanDate" )
299
303
304
+ # lastly if ezbids is true update the sidecar with acquisition data
305
+ if ezbids :
306
+ json_updater .update (
307
+ {"AcquisitionDate" : dicom_header .get ("AcquisitionDate" , "" ),
308
+ "AcquisitionTime" : dicom_header .get ("AcquisitionTime" , "" ),
309
+ })
310
+
300
311
# after updating raise warnings to user if values in json don't match values in dicom headers, only warn!
301
312
updated_values = json .load (open (path_to_json , "r" ))
302
313
for key , value in paired_fields .items ():
0 commit comments