I am new to working with MRI data - thanks in advance for any help folks can provide!
In preparation for data sharing, we need to remove all personally identifiable information. Files are currently in BIDS format (json + nifti) and have been defaced, but there is still metadata, including “AcquisitionDateTime”, that we need to remove to fully de-identify the data.
What approaches have others used to address this? Are there existing tools we could easily implement?
Hi @en2419, and welcome to neurostars!
It shouldn’t be too hard to update this in a Python script, using the
very minimal example below (haven’t tested, please let me know if it doesn’t work)
from glob import glob
datetime="January 1st, 1300" # Just a fake time that you put in all of your files
bids="/path/to/BIDS/root/" # Specify where BIDS root is
jsons=glob(os.path.join(bids,"sub-*","*","*.json")) # Find all JSONS
for json_path in jsons: # Loop over all jsons
# Load the jsons
with open(json_path, 'r') as data_file:
json_data = json.load(data_file)
# Update the JSON field (add more fields afterwards you want to change)
json_data['AcquisitionDateTime'] = datetime
# Write out the updated JSON
with open(json_path, 'w') as data_file:
Keep in mind this will overwrite your preexisting data, so try testing and designing with just one subject in its own directory first before looping over everyone!
Thank you so much, Steven!