Hi Martin, I've uploaded a .tgz file with a T1w volume, BOLD volume, and a valid LTA file.
https://gate.nmr.mgh.harvard.edu/filedrop2/?g=7f71pykmv7p Chris ________________________________________ From: freesurfer-boun...@nmr.mgh.harvard.edu <freesurfer-boun...@nmr.mgh.harvard.edu> on behalf of Martin Reuter <mreu...@nmr.mgh.harvard.edu> Sent: Tuesday, October 17, 2017 9:32:54 AM To: Freesurfer support list Subject: Re: [Freesurfer] lta_convert does not produce ITK transforms that are correctly applied by antsApplyTransforms Hi Chris, thanks, can you send the images and the exact commands. We have had success in the past, could be that you have a special case (e.g. maybe we never tested registration across different resolutions or whatever?). Thanks, Martin https://gate.nmr.mgh.harvard.edu/filedrop2/ On 16. Oct 2017, at 19:37, Christopher Markiewicz <markiew...@stanford.edu<mailto:markiew...@stanford.edu>> wrote: Doug, Sorry if I muddied things by going into the significant digits - accurate to 5 seems reasonable. I was simply meaning to say that the rotation and scaling parameters are not the issue, to save the reader time inspecting them. The translations (final three parameters) are off by anywhere 3 to 54mm, though. LTA-FSL-ITK: 1.3066136395454464 -45.60342165876236 -43.10584860730749 LTA-ITK: -2.2848172187805176 -2.9065067768096924 11.744022369384766 I'm guessing lta_convert has the wrong model of the origin in ITK style affines, at least as applied by antsApplyTransforms. Chris ________________________________________ 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 Douglas Greve <gr...@nmr.mgh.harvard.edu<mailto:gr...@nmr.mgh.harvard.edu>> Sent: Monday, October 16, 2017 12:39:28 PM To: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Subject: Re: [Freesurfer] lta_convert does not produce ITK transforms that are correctly applied by antsApplyTransforms Not sure I understand. If the two transforms are only off by less than the 5th decimal, then why are the registrations off so much. As for why it would be off at the 5ht dec, it probably has to do with the way we store the matrix. When a volume is read in, the matrix is decomposed into translation, scale, and direction cosine, and then the matrix is thrown away. When a volume with the same geometry is written out, the matrix is recomputed. Some resolution is lost during the decomposition/recomposition, and we don't end up with the exact same matrix. On 10/14/17 1:30 PM, Christopher Markiewicz wrote: Hi, I've used `bbregister` to generate a transform `bold2T1.lta` from `bold.nii` to `T1.mgz` (assume we have a `T1.nii` as well for the sake of ANTs). The following produces a well-aligned output: mri_convert --apply_transform bold2T1.lta bold.nii bold_space-T1.nii As does the following: lta_convert --inlta bold2T1.lta --outfsl bold2T1.mat c3d_affine_tool -ref T1.nii -src bold.nii bold2T1.mat -fsl2ras -oitk bold2T1.txt antsApplyTransforms -i bold.nii -r T1.nii -o bold_space-T1.nii -t bold2T1.txt However, if one skips the FSL step, the registration is quite far off: lta_convert --inlta bold2T1.lta --outitk bold2T1.txt antsApplyTransforms -i bold.nii -r T1.nii -o bold_space-T1.nii -t bold2T1.txt Comparing the ITK transform files: LTA-FSL-ITK #Insight Transform File V1.0 #Transform 0 Transform: MatrixOffsetTransformBase_double_3_3 Parameters: 0.9895096215486424 0.011126830936108464 -0.00042204653562094823 -0.01079971161879626 0.872329255299452 -0.42602926756857834 -0.004755964529051335 0.42420535065804454 0.8878552541301569 -1.3066136395454464 -45.60342165876236 -43.10584860730749 FixedParameters: 0 0 0 LTA-ITK #Insight Transform File V1.0 #Transform 0 Transform: AffineTransform_double_3_3 Parameters: 0.98950976133346558 0.011126830242574215 -0.00042204943019896746 -0.010799713432788849 0.87232941389083862 -0.42602935433387756 -0.0047559700906276703 0.42420542240142822 0.88785547018051147 -2.2848172187805176 -2.9065067768096924 11.744022369384766 FixedParameters: 0 0 0 To 5 significant digits, these are the same, except the last three (translation) parameters. And the `AffineTransform_double_3_3` is different from `MatrixOffsetTransformBase_double_3_3`, though I'm not sure whether this has any effect. Here is the original LTA: type = 1 # LINEAR_RAS_TO_RAS nxforms = 1 mean = 0.0000 0.0000 0.0000 sigma = 1.0000 1 4 4 1.010462999343872e+00 -1.063966564834118e-02 4.625014495104551e-03 -2.332115173339844e+00 1.228639855980873e-02 9.293417930603027e-01 -4.459420144557953e-01 2.507942199707031e+00 4.575361963361502e-04 4.440840482711792e-01 9.132194519042969e-01 -1.201664733886719e+01 0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 9.999998807907104e-01 src volume info valid = 1 # volume info valid filename = /scratch/fmriprep_wf/single_subject_02_wf/func_preproc_task_short_wf/bold_reg_wf/bbreg_wf/bbregister/uni_masked_xform.nii.gz volume = 64 64 34 voxelsize = 3.125000000000000e+00 3.125000000000000e+00 4.000000000000000e+00 xras = -1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 yras = 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00 zras = 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00 cras = -1.090248107910156e+00 -1.071614074707031e+01 1.619928741455078e+01 dst volume info valid = 1 # volume info valid filename = /scratch/fmriprep_wf/single_subject_02_wf/anat_preproc_wf/t1_merge/sub-02_T1w_template.nii.gz volume = 160 192 192 voxelsize = 1.000000000000000e+00 1.333333015441895e+00 1.333333015441895e+00 xras = 1.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 yras = 0.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00 zras = 0.000000000000000e+00 0.000000000000000e+00 1.000000000000000e+00 cras = -3.000000000000000e+00 2.999969482421875e+00 -8.000030517578125e+00 subject sub-02 fscale 0.100000 If it would be useful, I can provide any relevant images for testing. -- Chris Markiewicz Center for Reproducible Neuroscience Stanford University _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto: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 Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer