Anonymise nifti?

Is there a handy command line way of anonymising nifti-files using MRtrix?

I know there is an option in dcmedit for anonymising DICOM files. Also, I could manually edit the header (after mrconvert into .mih) by removing the information under “comments”. But is there a command line way of doing this?

Thanks a lot, Samuel

Hi Samuel,

Short answer is, yes, as of ~4 minutes ago… We’ve just added options to mrconvert to manipulate generic header entries/properties. Once you update, you should be able to anonymise any images (DICOM, NIfTI or whatever) by clearing or setting the comments field (the only field where MRtrix3 would store patient-confidential information right now). For example:

mrconvert DICOM_folder/ -clear_property comments out.mif

or:

mrconvert in.nii.gz -set_property comments anonymous out.nii

And if you use the MRtrix3 option shortening feature, you can write it more simply like this:

mrconvert DICOM/ -clear comments out.nii

Hope this does the trick!
Donald

works great, thanks a lot!!! :slight_smile:
Samuel

Hi everyone,
is there a way to do the same for tck files? In the command_history field there can easily be some confidential information.

Thank you in advance for your help.
Matteo

is there a way to do the same for tck files? In the command_history field there can easily be some confidential information.

Once can do “ -clear_property comments -clear_property command_history” in mrconvert, but I hadn’t thought of the same for track files (note that this is only an issue for anybody using the development branch of MRtrix3; version 3.0_RC3 and the master branch do not write this information to track files).

I suppose what this would ideally require is tckconvert having the same header modification options as mrconvert; ideally combined with track data piping so that you don’t have to duplicate your track data on disk. I’ve added it to the list. In the meantime, I suppose you could open the track file in a hex editor and replace the offending text with spaces (make sure that the number of characters does not increase or decrease).