Hi Antoine,
Thanks for reaching out. Unless you're using a dev build of FreeSurfer, mri_synthmorph may lag behind the dockerized version, which is likely why you see a different behavior. For affine transforms, we switched to LTA format to track the source and target spaces.
SynthMorph now saves these with surfa, which insists on the .lta suffix.
Similarly, we recently added code to save warp files in .mgz format, which is more similar to NIfTI and less clunky than .m3z (surfa might not let you save warps with NIfTI extension just yet). Until the next FS release, I would recommend using SynthMorph from
the Docker Hub.
In any case, the warps store shifts in physical RAS space: your `mri_warp_convert` call looks correct, and `antsApplyTransforms -v -d 3 -i [moving] -r [fixed] -t ants_warp.nii.gz -o out.nii.gz` should produce an image identical to "warped.nii.gz".
Malte
________________________________________
From: freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of Antoine Royer <Antoine.Royer@usherbrooke.ca>
Sent: Friday, April 19, 2024 16:08
To: freesurfer@nmr.mgh.harvard.edu
Subject: [Freesurfer] Understanding registration with mri_synthmorph
External Email - Use Caution
Hi all!
I am working on implementing some freesurfer synth tools into a larger diffusion processing pipeline. Doing so, I would like to use mri_synthmorph to generate a transform and then pass it downstream. FIrstly, I use the dockerized synthmorph version, which seems
to present discrepancies in its behaviour vs local testing:
1.
Can someone explain the expected output format of freesurfer transforms? When used within docker, I must define affine transforms as .lta and deform transforms as .mgz, otherwise: "ValueError: cannot determine file format from extension for test__init_warp.txt";
while when using mri_synthform from my local freesurfer installation, it doesn't seem like an issue. While I expected .m3z to be the expected output.
2.
Here is the sequence of functions I use. My objective is to pass down the resulting transform (affine initialization + deform warp) downstream my pipeline for further registration using ANTs (antsApplyTransforms). I tested and it seems to work, but i would
appreciate an opinion. Does the --insrcgeom parameter fixes everything for me?
*
Initialization + registration (freesurfer):
*
mri_synthmorph -m affine -t <init.lta> [moving] [fixed]
mri_synthmorph -m deform -t <freesurfer_warp.mgz> -o <warped.nii.gz> -i <init.txt> [moving] [fixed]
Convert warp from freesurfer (RAS) to ANTs (LPS) using freesurfer warp_convert:
mri_warp_convert -g [moving] --inras <freesurfer_warp.mgz> --outlps <ants_warp.nii.gz>
Thank you very much!
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
MailScanner
has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer&data=05%7C02%7CAntoine.Royer%40usherbrooke.ca%7Cc17e19388d2d45ca80ea08dc614cf1e4%7C3a5a8744593545f99423b32c3a5de082%7C0%7C0%7C638492230311548251%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=sxp6B0skcANsgJULcS9fFuEjqZyxd1LllYAKl3ZvzXk%3D&reserved=0
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
MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline&data=05%7C02%7CAntoine.Royer%40usherbrooke.ca%7Cc17e19388d2d45ca80ea08dc614cf1e4%7C3a5a8744593545f99423b32c3a5de082%7C0%7C0%7C638492230311555673%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=FdxbqSZ5wfwoG%2BADfr3tpAEpJE7pw%2BThM07%2BNK351Sk%3D&reserved=0
<
MailScanner
has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline&data=05%7C02%7CAntoine.Royer%40usherbrooke.ca%7Cc17e19388d2d45ca80ea08dc614cf1e4%7C3a5a8744593545f99423b32c3a5de082%7C0%7C0%7C638492230311560567%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=06GL08A1oTyTqg93lL%2BPLgWn0TMh2iXwAwiCvhukWss%3D&reserved=0>
.
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.