This can be a little tricky. Some information gets embedded into the files (you won't find this with a text search). You can generally see it with mri_info (mgz files) or mris_info (surface files)

However, mri_info can print out info that is not in the file but just relates to the location of the file. Eg, it prints out the "transform name". Eg, if you run mri_info orig.mgz you will see something like
/autofs/vast/adni3/subjects/002_S_4654.y0/mri/transforms/talairach.xfm
This gives the impression that this information is in the file, but it is not. If you copy orig.mgz to somewhere else and run mri_info, you will not see a transform name. mri_info is actually just finding the talairach.xfm file under the transform folder. So if you just copy your subject to another folder, the new folder will appear in the transform name

If you run mris_info lh.white, you will see something like
file    : /autofs/vast/adni3/subjects/002_S_4654.y0/mri/wm.mgz
This info is embedded in the surface file. To change it, you can run something like
mris_convert --vol-geom ../mri/wm.mgz lh.white lh.white

Some of the info is that command lines can get embedded into files. For mgz files, you can run
mri_convert --delete-cmds file.mgz file.mgz
for surfaces, you can run the similar
mris_convert --delete-cmds lh.white lh.white # can be combined with --vol-geom above

So, my strategy would be to copy your subject folder to a new folder, the run mri_convert and mris_convert as above, then go through each file running mri_info or mris_info and looking for your original subject name.

For defacing, you can use https://surfer.nmr.mgh.harvard.edu/fswiki/MiDeFace


On 6/18/2024 12:43 PM, Dan Fitch wrote:

        External Email - Use Caution

Hi folks,

Our subject identifiers that we push through Freesurfer are internal-only. We have a public-facing set of IDs, and we'd like to include anonymized Freesurfer data in the BIDS that we share. So: we need to take the stuff we have in $SUBJECT_DIR and transform it. Unfortunately, this isn't as simple as just renaming the directories, as many of the outputs and logs include "# subjectname sub-XXXX" comments and cmdlines that include the subject name.

1.
    Is there an extant method to rename subject directories? I've
    searched around on Github and on this list's archives; came up blank.
2.
    Would it be enough to walk the directories and replace all
    instances of e.g. "sub-1234" with "sub-30000"? Or do subject
    numbers get embedded in binary headers/metadata, as well?


The extra-fun touch is that we are not actually allowed to SEE the mapping from internal IDs to public-facing IDs, so any tool we provide for this translation needs to be useable by someone who is unfamiliar with Freesurfer. (Don't ask.)

Then we will also need to de-face all the images, of course.

Any tips or leads appreciated; otherwise, I'll build a thing and eventually post about it here.

Dan Fitch
Research Engineer
University of Wisconsin-Madison Institute on Aging

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is 
addressed.  If you believe this e-mail was sent to you in error and the e-mail 
contains patient information, please contact the Mass General Brigham 
Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline 
<https://www.massgeneralbrigham.org/complianceline> .
Please note that this e-mail is not secure (encrypted).  If you do not wish to 
continue communication over unencrypted e-mail, please notify the sender of 
this message immediately.  Continuing to send or respond to e-mail after 
receiving this message means you understand and accept this risk and wish to 
continue to communicate over unencrypted e-mail. 

Reply via email to