External Email - Use Caution
mri_synthmorph is simply an amazing SOTA tool that I want to incorporate into all my pipelines. However, I am unsure how to convert the combined affine+nonlinear deformation image into a format that can be worked with by ants or FSL.
Optimally, synthmorph + lta_convert + mri_convert would provide tools to: 1. separate affine and nonlinear components of the registration (useful in certain applications) 2. convert freesurfer transforms to current standard formats (FSL and ITK ants)
-Josh
Hi Josh,
Thank you for your interest in SynthMorph. FreeSurfer includes the tool `mri_warp_convert` for converting between deformation field formats.
To convert to LPS displacements (ITK/ANTs format), you can use the following command:
mri_warp_convert --inmgzwarp synthmorph.nii.gz --outitk ants.nii.gz
For FSL, there is a similar flag:
mri_warp_convert --inmgzwarp synthmorph.nii.gz --outfsl fsl.nii.gz
When you initialize the deformable registration with an affine transform, that transform will be included in the output warp as is. However, joint registration (and, similarly, initialized deformable registration with `-M`) applies half the affine before and the other half after the deformation to ensure end-to-end symmetry.
This means the warp lives in an affine mid-space that includes shear, and we're currently exploring the best way to save it.
I hope this helps, Malte
________________________________________ From: freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Josh nimzodisaster@gmail.com Sent: Wednesday, December 11, 2024 18:50 To: Freesurfer support list Subject: [Freesurfer] needed: tools to work with synthmorph deformations in ANTS and FSL pipelines.
External Email - Use Caution
mri_synthmorph is simply an amazing SOTA tool that I want to incorporate into all my pipelines. However, I am unsure how to convert the combined affine+nonlinear deformation image into a format that can be worked with by ants or FSL.
Optimally, synthmorph + lta_convert + mri_convert would provide tools to: 1. separate affine and nonlinear components of the registration (useful in certain applications) 2. convert freesurfer transforms to current standard formats (FSL and ITK ants)
-Josh
External Email - Use Caution
For some reason the replies I see on the mail archive are not showing up in my mail server.
I am using synthmorph from its latest docker freesurfer/synthmorph:latest and am trying to use the mri_convert_warp from docker image freesurfer/freesurfer:7.4.1, with this command: mri_warp_convert --inmgzwarp 106682-100.nii_to_template_final_deform.nii.gz --outitk test.nii.gz and I get ERROR: Option: --INMGZWARP unknown (see --help) !!
Is this option newer than 7.4.1? Also synthmorph documentation says deformation are in RAS space, so mri_warp_convert --inras warp.nii.gz --outitk warp.nii.gz ?
On Wed, Dec 11, 2024 at 3:50 PM Josh nimzodisaster@gmail.com wrote:
mri_synthmorph is simply an amazing SOTA tool that I want to incorporate into all my pipelines. However, I am unsure how to convert the combined affine+nonlinear deformation image into a format that can be worked with by ants or FSL.
Optimally, synthmorph + lta_convert + mri_convert would provide tools to:
- separate affine and nonlinear components of the registration (useful in
certain applications) 2. convert freesurfer transforms to current standard formats (FSL and ITK ants)
-Josh
The `--inmgzwarp` flag likely didn't make it into the 7.4.1 release in June 2023, as the commit adding it was made in July 2023: https://github.com/freesurfer/freesurfer/commit/2014205c296dca5a1a2715b6b9b6....
You are correct that SynthMorph warps are both in MGZWARP format and RAS displacements (which are not generally equivalent). You can use `--inras`, as long as you also specify the source geometry:
mri_warp_convert -g moving.nii--inras synthmorph.nii--outitk ants.nii
________________________________________ From: freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Josh nimzodisaster@gmail.com Sent: Monday, December 16, 2024 18:11 To: Freesurfer support list Subject: Re: [Freesurfer] needed: tools to work with synthmorph deformations in ANTS and FSL pipelines.
External Email - Use Caution
For some reason the replies I see on the mail archive are not showing up in my mail server.
I am using synthmorph from its latest docker freesurfer/synthmorph:latest and am trying to use the mri_convert_warp from docker image freesurfer/freesurfer:7.4.1, with this command: mri_warp_convert --inmgzwarp 106682-100.nii_to_template_final_deform.nii.gz --outitk test.nii.gz and I get ERROR: Option: --INMGZWARP unknown (see --help) !!
Is this option newer than 7.4.1? Also synthmorph documentation says deformation are in RAS space, so mri_warp_convert --inras warp.nii.gz --outitk warp.nii.gz ?
On Wed, Dec 11, 2024 at 3:50 PM Josh <nimzodisaster@gmail.commailto:nimzodisaster@gmail.com> wrote: mri_synthmorph is simply an amazing SOTA tool that I want to incorporate into all my pipelines. However, I am unsure how to convert the combined affine+nonlinear deformation image into a format that can be worked with by ants or FSL.
Optimally, synthmorph + lta_convert + mri_convert would provide tools to: 1. separate affine and nonlinear components of the registration (useful in certain applications) 2. convert freesurfer transforms to current standard formats (FSL and ITK ants)
-Josh
freesurfer@nmr.mgh.harvard.edu