Hi Andrew,

Sorry for the late response. Copied below is the suggestions from Martin.

“
I looked at those images. A few points:

- bias fields seem to be very different, I think using --iscale helps a little 
here, if very high accuracy of the registration is important, one should do a 
bias field removal beforehand.

- manually setting the sat to anything between 5 and 8 also looked like it 
helps --sat 5 in robust register

- robust register can be used if only two time points are involved to register 
into a mid space using —halfdst halfmov and halfdstlta outputs you get those 
images and transforms. Only thing missing is the actual template image which 
for two time points is simply the average of the two images after alignment in 
the mid space (so probably mri_calc or some other tool can compute that average 
image if it is needed).

- Scalp is changing a lot here across time, not sure why. How far are these 
time points apart? What type of data (aging, disease, treatment) is this? There 
are also noticeable changes in the brain. Anyway, best results are when using 
the skull stripped images, it is also faster. In freesurfer we work with 
norm.mgz in the longitudinal pipeline which are both skull stripped an bias 
corrected.

- Finally, in robust_template I also get the error about deviation from 
rotation. For some reason, that I could not yet find out, the first 
registration of A to B is not perfectly a rigid transform (some small deviation 
from a rotation matrix, maybe very subtle shearing as the determinant is still 
very close to 1, so no scaling). This could be a numerical issue. Anyway 
increasing the threshold to 0.001 should fix this. Or did you get another error 
after that for this specific case?
“



From: Andrew Beaudin <abeau...@ucalgary.ca>
Sent: Wednesday, December 7, 2022 1:30 PM
To: Huang, Yujing <yhuan...@mgh.harvard.edu>; Freesurfer support list 
<freesurfer@nmr.mgh.harvard.edu>
Cc: Reuter, Martin,Ph.D. <mreu...@mgh.harvard.edu>
Subject: Re: [Freesurfer] Fwd: mri_robust_template - MyMatrix::RotationMean 
Error


        External Email - Use Caution
Hi Yujing,
 No problem at all.  I really appreciate yours, and now Martin's, help with 
this issue.  If you would like to start with dicoms, please let me know.

Again, thank you both for your help.

Andrew

----
Andrew Beaudin, PhD | Research Associate
University of Calgary | Cumming School of Medicine
Department of Clinical Neurosciences
HSC Rm 2935J, 3330 Hospital Drive N.W. | Calgary, AB | T2N 4N1
Phone: (403) 210-6273

________________________________
From: Huang, Yujing [mailto:yhuan...@mgh.harvard.edu]
Sent: Wednesday, December 7, 2022 at 10:27
To: Andrew Beaudin <abeau...@ucalgary.ca><mailto:abeau...@ucalgary.ca>, 
Freesurfer support list 
<freesurfer@nmr.mgh.harvard.edu><mailto:freesurfer@nmr.mgh.harvard.edu>
Cc: Reuter, Martin,Ph.D. 
<mreu...@mgh.harvard.edu><mailto:mreu...@mgh.harvard.edu>
Subject: [Freesurfer] Fwd: mri_robust_template - MyMatrix::RotationMean Error

[△EXTERNAL]

Hi Andrew,

Sorry for the late response. I’m able to reproduce your error.

I have included Martin to the communication. He is the author of the program. 
He is going to take a look at your data.

Best,

Yujing



From: Andrew Beaudin <abeau...@ucalgary.ca><mailto:abeau...@ucalgary.ca>
Sent: Friday, November 25, 2022 3:25 PM
To: Huang, Yujing <yhuan...@mgh.harvard.edu><mailto:yhuan...@mgh.harvard.edu>; 
Freesurfer support list 
<freesurfer@nmr.mgh.harvard.edu><mailto:freesurfer@nmr.mgh.harvard.edu>
Subject: RE: [Freesurfer] Fwd: mri_robust_template - MyMatrix::RotationMean 
Error


        External Email - Use Caution
Hi Huang,
  Thank you very much for your help with this.  Apologies for the delay.

  You should be able to retrieve sample images from the following link (expires 
on Dec. 2).  I have also included a brief word document at the link that 
includes some details of the nifti images.

https://uofc-my.sharepoint.com/:f:/g/personal/abeaudin_ucalgary_ca/EmL7JGE0J-BHpnRfqArO3OMBlcD4VPqRkUZKfsmKGeL2SQ<https://secure-web.cisco.com/1hstJ7MT7lbWknwArluI7lsJDpCaPEnPjFOntWZC705TN7hf2zZ6yi6kYZOC0uvnzY4lhzK3ZM6JenT-iUCVRXmGQD3uftAD8OYL8nRsUntQSgd62pdkysnwz7Ei0MpfFScbOiKSm0zYOh7orQWmOfvRZJYI8GvWgu9XtDcLuLHMfgMkdllTtYJdE5Ht3Rh2a17I1tqEXZCjpKzzl_Hdx6NaDHJPqGxeKLX0pSSO_LGk3WyZ7S3YL04EgD6GiMRV2KCYSn4mx2cLl7I06xdwOr9DxyUFAXoLsVoBpaUDi-KcISE065Vag1H-7HyUhCIAgQFmsEVYjvotyAmUOYZvUQw/https%3A%2F%2Fuofc-my.sharepoint.com%2F%3Af%3A%2Fg%2Fpersonal%2Fabeaudin_ucalgary_ca%2FEmL7JGE0J-BHpnRfqArO3OMBlcD4VPqRkUZKfsmKGeL2SQ>


The command call I am using is:

mri_robust_template --mov 2001A_T1o_brain.nii.gz 2001B_T1o_brain.nii.mgz --lta 
2001A2template.lta 2001B2template.lta --average 1 --template 
2001_template.nii.gz --satit

  However, while troubleshooting I have also tried the following with no 
success:

1) using the --iscale flag - same MyMatrix::RotationMean Error (see below for 
log)
2) using --inittp 0 - results in a 'Segmentation fault'
3) using --average 0 - same MyMatrix::RotationMean Error
4) using Freesurfer v7.2 - same MyMatrix::RotationMean Error
5) running mri_robust_template call on Catalina and Big Sur systems with FS 
v6.0 - same MyMatrix::RotationMean Error.


Again, thank you for the help….and please let me know if your need any 
additional information or anything clarified.

Andrew
----
Andrew Beaudin, PhD | Postdoctoral Scholar
University of Calgary | Cumming School of Medicine
Department of Clinical Neurosciences
HSC Rm 2935J, 3330 Hospital Drive N.W. | Calgary, AB | T2N 4N1
Phone: (403) 210-6273

From: Huang, Yujing <yhuan...@mgh.harvard.edu<mailto:yhuan...@mgh.harvard.edu>>
Sent: November 22, 2022 7:32 AM
To: Freesurfer support list 
<freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu>>
Cc: Andrew Beaudin <abeau...@ucalgary.ca<mailto:abeau...@ucalgary.ca>>
Subject: RE: [Freesurfer] Fwd: mri_robust_template - MyMatrix::RotationMean 
Error

[△EXTERNAL]

Hi Andrew,

Can you send us some data to debug? The link has expired. Also, the command 
line that you are having trouble with.

Thanks.

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 Andrew Beaudin
Sent: Wednesday, June 29, 2022 10:45 PM
To: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu>
Subject: [Freesurfer] Fwd: mri_robust_template - MyMatrix::RotationMean Error


        External Email - Use Caution
Hello Freesurfer Community,
  I am trying to use mri_robust_template (with its default 6 DOF registration) 
outside of the Freesurfer longitudinal pipeline to generate within-participant 
T1 templates from 2 time points.  Unfortunately, I am coming up against a 
'MyMatrix::RotationMean input(s) not rotation' error on images acquired on our 
GE 3T Discovery 750 system, but not our colleagues' Seimens 3T Prisma images.  
I have pasted the output from the --debug flag below (and attached as text file 
- line 188 is the MyMatrix message).   If helpful, images can be download from 
the following link: MailScanner has detected a possible fraud attempt from 
"secure-web.cisco.com" claiming to be 
https://uofc-my.sharepoint.com/:f:/g/personal/abeaudin_ucalgary_ca/EmL7JGE0J-BHpnRfqArO3OMBlcD4VPqRkUZKfsmKGeL2SQ?e=lcovfR<https://secure-web.cisco.com/1FGQFgBoMNs00DgWtLCrKSIIdug6juLkb2Nu2KrASFJPZBjdCx_joSq08q6GYn899WbiMHITtkL3x-o5AHvRXbH-2JHAu0_Gw5aFmg9rIhsPy0Zu8zpryZYHjsE4umwwEylBRyd0TGNV3m-d5k9_IsQhRu2SYc6vj4WIaJ8F_q9uIcsgpX_QVuppEMG4lRVPp3RvveMfZRpMkehNDZJ_pJT9pje_N5viL2Zb7XZPRfaNnCKK7hTcevtyaKDqtmy85Rm2GqvtUB9vFnPFssxAMeZH7UBH2-8RQCzhCokbVocDQ7-m0q6rQ-kCKxQSNMpVdE3gMPmdjbjJ6vIqZ0RuPLkj9Labe95_FuZXUxmFfL8Y/https%3A%2F%2Fuofc-my.sharepoint.com%2F%3Af%3A%2Fg%2Fpersonal%2Fabeaudin_ucalgary_ca%2FEmL7JGE0J-BHpnRfqArO3OMBlcD4VPqRkUZKfsmKGeL2SQ%3Fe%3DlcovfR>

Briefly:
   - the images are skull-stripped niftis and I am running Freesurfer 6.0 
(freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c) on a WSL2 Ubuntu 
18.04 installation.
   - the call is: mri_robust_template --mov 2001A_T1o_brain.nii.gz 
2001B_T1o_brain.nii.mgz --lta 2001A2template.lta 2001B2template.lta --average 1 
--template 2001_template.nii.gz --satit

   -  I have tried the following with no success:
1) using the --iscale flag - same result as shown below.
2) using --inittp 0 - results in a 'Segmentation fault'
3) using --average 0 - same result as shown below
4) using Freesurfer v7.2 - same result as below
5) running mri_robust_template call on Catalina and Big Sur systems with FS 
v6.0 - same result as below.

  Currently, the only way to get mri_robust_template to work with our GE images 
is to run it with the --affine flag.  I would prefer to use the rigid body 
registration but am at a loss for why these images are failing using the rigid 
body registration is failing. Any help/insights/recommendations are greatly 
appreciated.

Thank you very much.

Andrew

----
Andrew Beaudin, PhD | Postdoctoral Scholar
University of Calgary | Cumming School of Medicine
Department of Clinical Neurosciences
HSC Rm 2935J, 3330 Hospital Drive N.W. | Calgary, AB | T2N 4N1
Phone: (403) 210-6273


DEBUG REPORT:

$Id: mri_robust_template.cpp,v 1.54 2016/05/05 21:17:08 mreuter Exp $

--mov: Using 2001A_T1o_brain.nii.gz as movable/source volume.
--mov: Using 2001B_T1o_brain.nii.gz as movable/source volume.
    Total: 2 input volumes
--lta: Will output LTA transforms
--average: Using method 1 for template computation.
--template: Using 2001_template.nii.gz as template output volume.
--satit: Will estimate SAT iteratively!
--debug: Will output debug info and files!
reading source '2001A_T1o_brain.nii.gz'...
converting source '2001A_T1o_brain.nii.gz' to bspline ...
MRItoBSpline degree 3
reading source '2001B_T1o_brain.nii.gz'...
converting source '2001B_T1o_brain.nii.gz' to bspline ...
MRItoBSpline degree 3
Will use TP 2 as random initial target (seed 108242 ).

MultiRegistration::initializing Xforms (init 2 , maxres 0 , iterate 5 , epsit 
0.01 ) :

 MultiRegistration Parameters

 Outdir:        ./
 TransOnly:     false
 Rigid:         true
 Robust:        true
 Satit:         true
 Iscale:        false
 IscaleOnly:    false
 NoMulti:       false
 SubsampleSize: -1
 HighIt:        -1
 FixVoxel:      false
 KeepType:      true
 Average:       1
 DoublePrec:    false
 BackupWeights: false
 SampleType:    5
 CRASCenter:    false
 Debug:         1


[init] ========================= TP 1 to TP 2 ==============================
         Register TP 1 ( 2001A_T1o_brain.nii.gz )
          to      TP 2 ( 2001B_T1o_brain.nii.gz )

Registration::setSourceAndTarget(MRI s, MRI t, keeptype = TRUE )
   Type Source : 3  Type Target : 3  keeping type
   Mov: (1, 1, 1)mm  and dim (176, 256, 256)
   Dst: (1, 1, 1)mm  and dim (176, 256, 256)
   Asserting both images: 1mm isotropic
    - no Mov reslice necessary
    - no Dst reslice necessary


 Registration::findSaturation
   - computing centroids
   - computing initial transform
     -- using translation info
   - Get Gaussian Pyramid Limits ( min size: 16 max size: -1 )
   - Build Gaussian Pyramid ( Limits min steps: 0 max steps: 3 )
   - Build Gaussian Pyramid ( Limits min steps: 0 max steps: 3 )

   - Max Resolution used: 2
     -- gpS ( 44 , 64 , 64 )
     -- gpT ( 44 , 64 , 64 )
   - running loop to estimate saturation parameter:
     -- Iteration: 1  trying sat: 16
         min sat: 16 ( 0.729941 ), max sat: 0 ( -1 ), sat diff: -16, 
(wlimit=0.16)
     -- Iteration: 2  trying sat: 32
         min sat: 32 ( 0.713406 ), max sat: 0 ( -1 ), sat diff: -32, 
(wlimit=0.16)
     -- Iteration: 3  trying sat: 64
         min sat: 64 ( 0.692689 ), max sat: 0 ( -1 ), sat diff: -64, 
(wlimit=0.16)
     -- Iteration: 4  trying sat: 128
         min sat: 128 ( 0.666858 ), max sat: 0 ( -1 ), sat diff: -128, 
(wlimit=0.16)
     -- Iteration: 5  trying sat: 256
         min sat: 256 ( 0.637119 ), max sat: 0 ( -1 ), sat diff: -256, 
(wlimit=0.16)
     -- Iteration: 6  trying sat: 512
         min sat: 512 ( 0.591624 ), max sat: 0 ( -1 ), sat diff: -512, 
(wlimit=0.16)
     -- Iteration: 7  trying sat: 1024
         min sat: 1024 ( 0.550606 ), max sat: 0 ( -1 ), sat diff: -1024, 
(wlimit=0.16)
     -- Iteration: 8  trying sat: 2048
         min sat: 2048 ( 0.485668 ), max sat: 0 ( -1 ), sat diff: -2048, 
(wlimit=0.16)
     -- Iteration: 9  trying sat: 4096
         min sat: 4096 ( 0.370434 ), max sat: 0 ( -1 ), sat diff: -4096, 
(wlimit=0.16)
     -- Iteration: 10  trying sat: 8192
         min sat: 8192 ( 0.19981 ), max sat: 0 ( -1 ), sat diff: -8192, 
(wlimit=0.16)
     -- Iteration: 11  trying sat: 16384
         min sat: 8192 ( 0.19981 ), max sat: 16384 ( 0.0606314 ), sat diff: 
8192, (wlimit=0.16)
     -- Iteration: 12  trying sat: 12288
         min sat: 8192 ( 0.19981 ), max sat: 12288 ( 0.103499 ), sat diff: 
4096, (wlimit=0.16)
     -- Iteration: 13  trying sat: 10240
         min sat: 8192 ( 0.19981 ), max sat: 10240 ( 0.142423 ), sat diff: 
2048, (wlimit=0.16)
     -- Iteration: 14  trying sat: 9216
         min sat: 9216 ( 0.16727 ), max sat: 10240 ( 0.142423 ), sat diff: 
1024, (wlimit=0.16)
     -- Iteration: 15  trying sat: 9728
         min sat: 9216 ( 0.16727 ), max sat: 9728 ( 0.155264 ), sat diff: 512, 
(wlimit=0.16)
     -- Iteration: 16  trying sat: 9472
         min sat: 9472 ( 0.160488 ), max sat: 9728 ( 0.155264 ), sat diff: 256, 
(wlimit=0.16)
     -- Iteration: 17  trying sat: 9600
         min sat: 9472 ( 0.160488 ), max sat: 9600 ( 0.157199 ), sat diff: 128, 
(wlimit=0.16)
     -- Iteration: 18  trying sat: 9536
         min sat: 9472 ( 0.160488 ), max sat: 9536 ( 0.159131 ), sat diff: 64, 
(wlimit=0.16)
     -- Iteration: 19  trying sat: 9504
         min sat: 9472 ( 0.160488 ), max sat: 9504 ( 0.159604 ), sat diff: 32, 
(wlimit=0.16)
     -- Iteration: 20  trying sat: 9488
         min sat: 9472 ( 0.160488 ), max sat: 9488 ( 0.159903 ), sat diff: 16, 
(wlimit=0.16)
     -- Iteration: 21  trying sat: 9480
         min sat: 9480 ( 0.160034 ), max sat: 9488 ( 0.159903 ), sat diff: 8, 
(wlimit=0.16)
     -- Iteration: 22  trying sat: 9484
         min sat: 9484 ( 0.160123 ), max sat: 9488 ( 0.159903 ), sat diff: 4, 
(wlimit=0.16)
     -- Iteration: 23  trying sat: 9486
         min sat: 9484 ( 0.160123 ), max sat: 9486 ( 0.159831 ), sat diff: 2, 
(wlimit=0.16)
     -- Iteration: 24  trying sat: 9485
         min sat: 9484 ( 0.160123 ), max sat: 9485 ( 0.159908 ), sat diff: 1, 
(wlimit=0.16)
     -- Iteration: 25  trying sat: 9484.5
   - final SAT: 9485 ( it: 25 , weight check 0.159908 <= 0.16 )


 Registration::computeMultiresRegistration
   - computing centroids
   - computing initial transform
     -- using translation info
   - Get Gaussian Pyramid Limits ( min size: 16 max size: -1 )
   - initial transform:
Ti = [ ...
 1.0000000000000                0                0 -2.0251428914711
               0  1.0000000000000                0  6.0311902437196
               0                0  1.0000000000000  2.8105113695639
               0                0                0  1.0000000000000  ]

   - initial iscale:  Ii =1

Resolution: 3  S( 22 32 32 )  T( 22 32 32 )
 Iteration(f): 1
     -- diff. to prev. transform: 2.97694
 Iteration(f): 2
     -- diff. to prev. transform: 0.0903233
 Iteration(f): 3
     -- diff. to prev. transform: 0.0191757
 Iteration(f): 4
     -- diff. to prev. transform: 0.0116139
 Iteration(f): 5
     -- diff. to prev. transform: 0.00140989  <= 0.01   :-)

Resolution: 2  S( 44 64 64 )  T( 44 64 64 )
 Iteration(f): 1
     -- diff. to prev. transform: 1.81202
 Iteration(f): 2
     -- diff. to prev. transform: 0.199033
 Iteration(f): 3
     -- diff. to prev. transform: 0.00925469  <= 0.01   :-)

Resolution: 1  S( 88 128 128 )  T( 88 128 128 )
 Iteration(f): 1
     -- diff. to prev. transform: 1.02247
 Iteration(f): 2
     -- diff. to prev. transform: 0.0229168
 Iteration(f): 3
     -- diff. to prev. transform: 0.000719712  <= 0.01   :-)

Resolution: 0  S( 176 256 256 )  T( 176 256 256 )
 Iteration(f): 1
     -- diff. to prev. transform: 0.664624
 Iteration(f): 2
     -- diff. to prev. transform: 0.0108463
 Iteration(f): 3
     -- diff. to prev. transform: 0.000585613  <= 0.01   :-)

   - final transform:
Tf = [ ...
 0.9994709868827 -0.0113151175724 -0.0304912199489  4.8530791096303
 0.0126622658755  0.9989355014916  0.0443568583483  2.1370162587100
 0.0299568590234 -0.0447194809223  0.9985503265352  5.4716006804225
               0                0                0  1.0000000000000  ]

   - final iscale:  If = 1
CentroidT = [ 86.5860705940972 104.6067830299094 138.6676688710562  
1.0000000000000  ]

CentroidSinT = [ 88.1595712077722 107.7558909090270 139.3780739549505  
1.0000000000000  ]

Centroid = [ 87.3728209009347 106.1813369694682 139.0228714130033  
1.0000000000000  ]

 MyMatrix::RotationMean input(s) not rotation
meant = [ -1.2248131651588  1.2892456671960  3.1420193014715  ]

Input rotation's max deviation from rotation is: 0.000393411






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://secure-web.cisco.com/1YFv6ynnQtVwxD61_92Xy0zSgOn5A4uR1nLgV2tl4XDmF3jch_6hkkwF6MtuN2LTDjOqfhiQ3Wg-yTmkMyfERS-4kdXSDkmxiWGEiNUogrRchZnezlAtCn_oR8CAnlXnLYv2Fp3B8GbRvrhIYEHc1Ti0WoQHCuhhyXFavIkMkewZYwDPvvmbDSrI5doE8xlT7O9uPQRQXX_o2uQuN9lgzLiu8lgCrEUm_pHncUNtZLqd965cSX31MiDapVNgx7zube-Ez5qRRLt_-EYuiRpfYxR-CpSVJVv2tooEf3K3H-1TQ2x_x8Td3rdvlMXC9vUdBXNqqIhU6yJTMVKJ5pmNsMw/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>
 .

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.
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://secure-web.cisco.com/1cUNAiKH4ulUP3fRKKP1t87y2Y7lfv51xZKoMD0jD3rUhfQTVmd-igLxTi0Cl3liUlJtaEb7pjHbfzFEg5wwui-kxZVgYSZJ_hQUokVv1PqGSaLXa9nIVIhBhBcVhAT_FGTZjL9sjWBYbLrHW0q4sfHZmPT_FEl5CUqPnBTCpY7je3JtiZD2Ch8K0H5KNo4BQBwdvAfw5qvpLdvNZ1GpgLXTcDBSK50G4-EE9ktbgUHm3zDDV972tnQMJvp49eF_1wL-B6hq4Ndtqh2HB9V9usE1FvvQD9n6qluTVCJtOXW5XdNKCtjzn5kmg9qdbxEtC9P_KaYUQrlJgj4Cl3gntIQ/https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline>
 .

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.

_______________________________________________
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