External Email - Use Caution        

Hi Yazdan,

Thanks for the information.

Is the “PSR/LAS/RAS Orientation of image” you mentioned the same ‘Orientation’ 
reported by mri_info? I believe the Orientation reported by mri_info tells the 
data ordering on disk. It is not the anatomical space. Both nii and mgz are RAS.

I tried the method described in this posting 
(https://secure-web.cisco.com/1APqgiyEgb8KoTku5P1376REqaOm8LWn2j_60Z3VrODJu7DE6KX_dDgXHnyeNktNrvoY9UE8pztcC7TCnb9h1PgIAXAP6kEd4Gd_C0ixAxfgnBJlou_FkCewSW8_ccaXgIndWa-TX4_0jh53UNXJJWnohUqlbf2uexaNApI9yRCI9Gc05xXT4w5kh-xBOJ6yQ0TBjjMzxGKeQojzPYME53MhQwIt2Rq_rcHXbAkV3NMfjxZvvtrICQCv6QrXBdAX9xMR0IqW0uqjjVP1vDsXuQQ/https%3A%2F%2Fstackoverflow.com%2Fquestions%2F71441883%2Fhow-to-get-transformation-affine-from-itk-registration)
registration_ras = flip_LPS_RAS @ registration_lps @ flip_LPS_RAS

registration_lps is ants.txt read in by lta_convert. I converted 
inv(registration_ras) to vox2vox using the vox2ras printed by mri_info. I got 
the same results as lta_convert.

I’m wondering if there are other ways to verify ants_0GenericAffine.mat and 
ants.txt generated by Ants.

Best,

Yujing




From: freesurfer-boun...@nmr.mgh.harvard.edu 
<freesurfer-boun...@nmr.mgh.harvard.edu> On Behalf Of Yazdan Rezaee Jouryabi
Sent: Sunday, October 8, 2023 10:04 AM
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] lta_convert issue with ants Registration Matrix


        External Email - Use Caution
Hi Yujing,

Sure.

the results of applying mri_info are attached below

Bests,
Yazdan.

On Fri, 6 Oct 2023 at 23:19, Huang, Yujing 
<yhuan...@mgh.harvard.edu<mailto:yhuan...@mgh.harvard.edu>> wrote:

        External Email - Use Caution
Hi Yazdan,

Thank you for the detailed explanation.

I’m wondering if you could send output of mri_info for Image.nii, 
fsl_resampled.nii.gz, fslregistered.nii.gz, freesurfer.nii, and output from 
ANTs.

Best,

Yujing

From: 
freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu>
 
<freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu>>
 On Behalf Of Yazdan Rezaee Jouryabi
Sent: Friday, September 29, 2023 12:19 PM
To: Freesurfer support list 
<freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu>>
Subject: Re: [Freesurfer] lta_convert issue with ants Registration Matrix


        External Email - Use Caution
Hi Yujing,
I'll try to explain it more explicitly, I rerun my Code and show the results 
beyond attaching the Registration files too.

Consider a 3D-Nifti image called "Image.nii" the steps bellow executed in order:
0- Every time we Will generate a random Registration Matrix and Save it under 
the name "fsl.mat" which is the desired Registration matrix.
==============================================================================
fsl.mat :=

[[ 0.95509431, -0.28438761, 0.08317783, -5.        ]

 [ 0.2961434,   0.90701597, -0.29936787, -5.        ]

 [ 0.00969289,  0.31055712,  0.9505053,  -2.        ]

 [ 0.,          0.,          0.,          1.        ]]
==============================================================================

1- using a known registration matrice (called and attached in the first message 
and this message as "fsl.mat") resample the "Image.nii" to second Image called 
"fsl_resampled.nii"
      Command :   flirt -ref ./Image.nii -in ./Image.nii -applyxfm -init 
./fsl.mat -out ./fsl_resampled.nii -interp spline
2- find out the registration matrices using Registration Methods, here we will 
use FSL, FreesSurefer, ANTs:
2.1. FSL Commands:
===============================================================================
      Command : flirt -in ./Image.nii -out ./fslregistered.nii.gz -ref 
./fsl_resampled.nii.gz -cost normmi -dof 6 -omat ./fslregistered.mat -interp 
spline
===============================================================================
fslregistered :

0.9551458402  -0.2842262621  0.08313877187  -5.029802253

0.2959789517  0.9070999982  -0.2992758021  -5.014360215

0.009646861275  0.3104593324  0.9505376886  -1.971170444

0  0  0  1
=======================================================
The Registration Matrice in this Case Called "fslregistered.mat", using 
lta_convert we will make "fslregistered.lta"
      Command : lta_convert --infsl ./fsl/fslregistered.mat --outlta 
./fsl/fslregistered.lta --src ./Image.nii --trg ./fsl/fslregistered.nii.gz 
--ltavox2vox
===============================================================================
fslregistered.lta :

9.551459550857544e-01 -2.368552237749100e-01 6.928230822086334e-02 
-4.191513061523438e+00

3.551747798919678e-01 9.071001410484314e-01 -2.992758452892303e-01 
-5.014381408691406e+00

1.157622877508402e-02 3.104593753814697e-01 9.505378007888794e-01 
-1.971183776855469e+00

0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 
1.000000000000000e+00
2.2. FreeSurfer Commands:
===============================================================================
      Command : mri_robust_register --mov ./Image.nii --dst 
./fsl_resampled.nii.gz --mapmov ./freesurfer.nii --lta freesurfer.lta --halfmov 
half-mov.nii --halfdst halfdst.nii --halfmovlta h1.lta --halfdstlta h2.lta 
--iscale --satit

===============================================================================
freesurfer.lta :
type      = 0 # LINEAR_VOX_TO_VOX

nxforms   = 1

mean      = 87.0000 129.0000 106.0000

sigma     = 10000.0000

1 4 4

9.550938606262207e-01 -2.369909435510635e-01 6.931482255458832e-02 
-4.167178630828857e+00

3.553738296031952e-01 9.070160388946533e-01 -2.993661761283875e-01 
-4.999662876129150e+00

1.163147203624249e-02 3.105554580688477e-01 9.505058526992798e-01 
-2.000635147094727e+00

0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 
1.000000000000000e+00
================================================================================
The Registration Matrice in this Case Called "freesurfer.lta", using 
lta_convert we will do the conversion and build the FSL-Space  "freesurfer.mat"
      Command : lta_convert --inlta ./freesurfer/freesurfer.lta --outfsl 
./freesurfer/freesurfer.mat --src ./Image.nii --trg ./fsl_resampled.nii.gz

========================================================
freesurfer.mat :
   0.95509410   -0.28438917    0.08317780   -5.00063801

   0.29614490    0.90701610   -0.29936624   -4.99965954

   0.00969290    0.31055552    0.95050597   -2.00067019

   0.00000000    0.00000000    0.00000000    1.00000000
================================================================================
2.3. ANTs Commands:
================================================================================
     Commands : antsRegistrationSyNQuick.sh -d 3 -f ./fsl_resampled.nii.gz -m 
./Image.nii -o ants_ -t r
 Using the ConvertTransform File we will make the "ants.txt"
     Command : ConvertTransformFile 3 ./ANTS/ants_0GenericAffine.mat 
./ANTS/ants.txt
================================================================================
ants.txt:

#Insight Transform File V1.0

#Transform 0

Transform: AffineTransform_double_3_3

Parameters: 0.9996357319973235 -0.01682948721742278 -0.021099091785527296 
0.015864886388920783 0.9988573896699559 -0.045080156184165145 
0.02183365965755943 0.04472900023162478 0.9987605357863502 -2.215029749904149 
1.2122977228542815 -6.0667455324006445

FixedParameters: 5.195914900051355 -10.250280974097581 -6.670270481513606
================================================================================
Using lta_convert we first make "ants.lta"
     Command: lta_convert --initk ./ANTS/ants.txt --outlta ./ANTS/ants.lta 
--src ./Image.nii --trg ./fsl_resampled.nii.gz --ltavox2vox
================================================================================

type      = 0 # LINEAR_VOX_TO_VOX

nxforms   = 1

mean      = 0.0000 0.0000 0.0000

sigma     = 1.0000

1 4 4

9.996357560157776e-01 -1.322073861956596e-02 1.819471642374992e-02 
1.924201965332031e+00

2.019538544118404e-02 9.988574385643005e-01 -4.472899809479713e-02 
3.623344421386719e+00

-2.531890943646431e-02 4.508015885949135e-02 9.987605214118958e-01 
2.642463684082031e+00

0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 
1.000000000000000e+00
=================================================================================
Using the lta_convert we make the "ants.mat", the FSL-Spaced Registration 
matrix for ANTs
      Command: lta_convert --inlta ./ANTS/ants.lta --outfsl ./ANTS/ants.mat 
--src ./Image.nii --trg ./fsl_resampled.nii.gz
=================================================================================
  0.99963582   -0.01586489    0.02183366    2.30903101

   0.01682949    0.99885744   -0.04472899    3.62335658

  -0.02109909    0.04508016    0.99876052    2.64244890

   0.00000000    0.00000000    0.00000000    1.00000000


As we could see there are problems in 'ants.lta' and 'ants.mat', I'm not sure 
Yet but I Suspect that the "PSR" Orientation of the Image Which is a 
Left-handed coordination System may cause that because in Another Experiment 
with "LAS" these problem had been occured but in another "RAS" Image the 
lta_convertor worked precisely with no problem.

The Registration Files are attached for More Information about Image's Geometry 
Sform's and Other ...


Best,

Yazdan




On Mon, 25 Sept 2023 at 17:16, Huang, Yujing 
<yhuan...@mgh.harvard.edu<mailto:yhuan...@mgh.harvard.edu>> wrote:

        External Email - Use Caution
Hi Yazdan,

I’m trying to understand the issues.

Can you specify the commands used to generate the matrices attached to your 
email? And give more details of the issues you are seeing?

Best,

Yujing

From: 
freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu>
 
<freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu>>
 On Behalf Of Yazdan Rezaee Jouryabi
Sent: Monday, September 25, 2023 1:49 AM
To: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu>
Subject: [Freesurfer] lta_convert issue with ants Registration Matrix


        External Email - Use Caution
Dear all, Hi

for checking registration i used fsl applyxfm on an Image(1)(Called Image.nii ) 
with specific Registration Matrice (Which we suppose to receive when we apply 
registration Methods) and Generate the "fsl_resampled.nii.gz" (Note: Image 
Orientations were LAS and in one other Experiment with also the same problem 
PSR)

for our case i will attach the "fsl.mat" (Desired Matrix)

using, fsl, freesurfer, and ants i got the correct results (let's call them 
"fslregistered.mat" and "freesurfer.mat" the converted lta to fsl-liked Matrix) 
Everything is OK till now

 But the converted lta-like and fsl-like matrix for ANTs (Which are called 
ants.lta, and ants.mat) using the lines below:
- ConvertTransformFile 3 ./ANTS/ants_0GenericAffine.mat ./ANTS/ants.txt
- lta_convert --initk ./ANTS/ants.txt --outlta ./ANTS/ants.lta --src 
./Image.nii --trg ./fsl_resampled.nii.gz --ltavox2vox
- lta_convert --inlta ./ANTS/ants.lta --outfsl ./ANTS/ants.mat --src 
./Image.nii --trg ./fsl_resampled.nii.gz

As All Results Images (Registered Image of all Methods) are aligned perfectly i 
think that there might be some issues with lta_convert


Best Regards
Yazdan Rezaee J


P.S.
" I've checked the one similar mail on this topic and the conclusion on that 
was about (sform, qform) incompatibility but the affine matrices of S-form and 
q-form are equivalent in my case."

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu>
MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" 
claiming to be 
https://secure-web.cisco.com/1T4VflfbFNHFZtzv4aDwkt_rLI0_1iCtzGaE9nS3JSgI01uqFWrtnPgpVctdkI6kOVB_Mbo-ZeFw9YgWEDvSnSVd3TS4c7l6ByPUgdJIQNoJtwIA-O-QL674PL7zKbTFeOk3DF-m66erRpoJ3iZeCGXbpF2KnZ7ysYQCdaTNEPY6vUw88-r7imXNWYUjkTyZqDcMxagDZK7HA1Ub84S1eZNGWSEr_NE4u9KqYxldvS5eYlhEueAR7F3JeIvCRaiaWW9s1bGK_VpZp2u6G6j1YDA/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer<https://secure-web.cisco.com/1CVysUaKA0QPJhHH2wwhYBipzUhFEaeL8kkwOtuATULgzm-ARVtRifTqrnuMch9mPrhoX5WsrgJCZI4n6LV0QrBOiwz8JOJSZcKXl0-srjhHE7Ez1eAdpgDrWIqslv1yZuu9lDDu4UrcCR_1k8-OHZM1lX5im7TD25ziCO5ibM6spWh-yZJ_pdgSrOWg3COhe2JLUiyCL3VPWaa-l3gJ-VY8E3fKgFi47mdINsuywYT2Z2bpFzMA0qVMOcxBZP6V2Jz-SpyfFbeS55S0r_f_lNm2JigMyuajjviAgHw-npf_6HYFs541IzQp4hzn0kOTN/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer>
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://secure-web.cisco.com/1HBgIDEBIYpSxmd81RiCtAALySfaubdqnxg1mEdqxlT42acovSAlbjgev4BoycVRnKwA2H4jpT5R01ZXE1Ciwr19e7kXK3bpX6Hb3e-ccJKKIf9rfAc9fGA6vU3LNEmB_s7_DVA4yhib9Unfb7FYqD1ft7aItj9P27Hi0c7iq4msxVNcrq15YUWaiyqWISMq2WjjlkqHMfrfjAfCSkbg43KlIdMaOhd_l3tqTNnb0WiCNOhg7tRjj6gbwT25nTMF0mza9sMguRydWKZZMmvVcBA/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline<https://secure-web.cisco.com/1iXmC6GDGT_irmtwnhqZdBKSxywaeJC3Q1wdvh_a0KY5o7X2IMOclXP4f0k-GqI_PRroMRHLYU-2PytqXKGTg6_fWW1KVDHATy0ENxJF3psR7lP7a-RRfcFNfBEjlwcIVKlvbWPxlCCMyKVbMe6U5Fh-MyOLPX0g_j4lWjXAjcWLJkRG0g4PBTK_xzSz904-Aq-5yTIzIoulIOOVdRa03bD2RdUbEfx4x44oD3QmrEeVyAQcHQXg97yGoNqncOG-pa601HCmc65kmd9kIqklmkjAhm1NA5O-PbF2zqMYfQYmUWbVziolYCOD5tYgNE9wx/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>
 <MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" 
claiming to be 
https://secure-web.cisco.com/1HBgIDEBIYpSxmd81RiCtAALySfaubdqnxg1mEdqxlT42acovSAlbjgev4BoycVRnKwA2H4jpT5R01ZXE1Ciwr19e7kXK3bpX6Hb3e-ccJKKIf9rfAc9fGA6vU3LNEmB_s7_DVA4yhib9Unfb7FYqD1ft7aItj9P27Hi0c7iq4msxVNcrq15YUWaiyqWISMq2WjjlkqHMfrfjAfCSkbg43KlIdMaOhd_l3tqTNnb0WiCNOhg7tRjj6gbwT25nTMF0mza9sMguRydWKZZMmvVcBA/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline<https://secure-web.cisco.com/1iXmC6GDGT_irmtwnhqZdBKSxywaeJC3Q1wdvh_a0KY5o7X2IMOclXP4f0k-GqI_PRroMRHLYU-2PytqXKGTg6_fWW1KVDHATy0ENxJF3psR7lP7a-RRfcFNfBEjlwcIVKlvbWPxlCCMyKVbMe6U5Fh-MyOLPX0g_j4lWjXAjcWLJkRG0g4PBTK_xzSz904-Aq-5yTIzIoulIOOVdRa03bD2RdUbEfx4x44oD3QmrEeVyAQcHQXg97yGoNqncOG-pa601HCmc65kmd9kIqklmkjAhm1NA5O-PbF2zqMYfQYmUWbVziolYCOD5tYgNE9wx/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>>
 .
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu>
MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" 
claiming to be 
https://secure-web.cisco.com/1T4VflfbFNHFZtzv4aDwkt_rLI0_1iCtzGaE9nS3JSgI01uqFWrtnPgpVctdkI6kOVB_Mbo-ZeFw9YgWEDvSnSVd3TS4c7l6ByPUgdJIQNoJtwIA-O-QL674PL7zKbTFeOk3DF-m66erRpoJ3iZeCGXbpF2KnZ7ysYQCdaTNEPY6vUw88-r7imXNWYUjkTyZqDcMxagDZK7HA1Ub84S1eZNGWSEr_NE4u9KqYxldvS5eYlhEueAR7F3JeIvCRaiaWW9s1bGK_VpZp2u6G6j1YDA/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer<https://secure-web.cisco.com/1BStSAxLh5BeN2L3rU2frK5cGS07arbjFgCFDCXjer8mI9E6QhC8axsTzJmtNHA0f1DD52gOLn7V-0bXwHcjGpMgOvj5Ej9o0ngUReq4erjdQzvYap5kCRZ7e1R0AlzG3ItDCyzjDBFs1Hwuf_QGSCA0SbXehYcVoataMjv341ofR-qoXsG8G2K8Q2d1z1G3CluiFixSCjME4890bumFvO47QQG0nNCEDOPpFNuPHYPbFtpXrvY-tFm2uqnoNPMEp5d-TAX_caWLaTC52xtF8vU_f4PLeM-ImIm6-4ZiPLVGGJ6bU0ZNKXVhnhIG9oCdTp1_UXPx1xKVwGkz_KsQhyQ/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Ffreesurfer>
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://secure-web.cisco.com/1HBgIDEBIYpSxmd81RiCtAALySfaubdqnxg1mEdqxlT42acovSAlbjgev4BoycVRnKwA2H4jpT5R01ZXE1Ciwr19e7kXK3bpX6Hb3e-ccJKKIf9rfAc9fGA6vU3LNEmB_s7_DVA4yhib9Unfb7FYqD1ft7aItj9P27Hi0c7iq4msxVNcrq15YUWaiyqWISMq2WjjlkqHMfrfjAfCSkbg43KlIdMaOhd_l3tqTNnb0WiCNOhg7tRjj6gbwT25nTMF0mza9sMguRydWKZZMmvVcBA/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline<https://secure-web.cisco.com/1Cw0A3cVjhHcWsRIekyy6Q8-imKvdraduISNe4Ov9uMpCll4kaZi6vRqNSbeXf5oHAJOWU0yc9x101MlugaGXfg393-hK7jLPlwskqaX9jghAgPYPl83J2yX_uUlZiB13Lx7ktR0rhXhZh2ecEYt7MW37SAI36Uj5Ulne7g4z3Out8L-iEezNr37SOf3T_y5FjcgdnZb1hXacCNjUZEKacAykR8sKRTyhhAG_E8ctWpyW8lzYotL3wx2NnOBnVKaFTjqHmusxL7PADZchaGiJLDHbflArXF6id4bAHVBYXAqA_lly_--W2-vdqYHLzapz3rtUitsPr_P065wxJ_b1Ig/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>
 <MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" 
claiming to be 
https://secure-web.cisco.com/1HBgIDEBIYpSxmd81RiCtAALySfaubdqnxg1mEdqxlT42acovSAlbjgev4BoycVRnKwA2H4jpT5R01ZXE1Ciwr19e7kXK3bpX6Hb3e-ccJKKIf9rfAc9fGA6vU3LNEmB_s7_DVA4yhib9Unfb7FYqD1ft7aItj9P27Hi0c7iq4msxVNcrq15YUWaiyqWISMq2WjjlkqHMfrfjAfCSkbg43KlIdMaOhd_l3tqTNnb0WiCNOhg7tRjj6gbwT25nTMF0mza9sMguRydWKZZMmvVcBA/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline<https://secure-web.cisco.com/1Cw0A3cVjhHcWsRIekyy6Q8-imKvdraduISNe4Ov9uMpCll4kaZi6vRqNSbeXf5oHAJOWU0yc9x101MlugaGXfg393-hK7jLPlwskqaX9jghAgPYPl83J2yX_uUlZiB13Lx7ktR0rhXhZh2ecEYt7MW37SAI36Uj5Ulne7g4z3Out8L-iEezNr37SOf3T_y5FjcgdnZb1hXacCNjUZEKacAykR8sKRTyhhAG_E8ctWpyW8lzYotL3wx2NnOBnVKaFTjqHmusxL7PADZchaGiJLDHbflArXF6id4bAHVBYXAqA_lly_--W2-vdqYHLzapz3rtUitsPr_P065wxJ_b1Ig/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>>
 .
_______________________________________________
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