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-boun...@nmr.mgh.harvard.edu 
<freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Antoine Royer 
<antoine.ro...@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
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