Can you try mri_coreg instead of fsl? ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mri_coreg
On 11/19/15 5:25 PM, Caspar M. Schwiedrzik wrote:
Hi! I am trying to align a mean EPI volume and a Bruker magnitude map from a fieldmap measurement using tkregister2, fsl_rigid_register and mri_vol2vol. Unfortunately, it seems that somewhere, most likely during fsl_rigid_register, the image orientation get scrambled, and the output has the wrong orientation.
Here is what I get from*tkregister2:*
target volume epi.nii movable volume fieldmap0001.nii reg file mag_2_mocovol.register.dat LoadVol 0 ZeroCRAS 0 $Id: tkregister2.c,v 1.121.2.1 2011/03/28 20:25:16 greve Exp $ Diagnostic Level -1 INFO: loading target epi.nii Setting targ orientation to RIA INFO: target does not conform to COR format, so I'm going to reslice to COR. This will not affect the final registration. Ttarg: -------------------- -1.000 0.000 0.000 128.000; 0.000 0.000 1.000 -128.000; 0.000 -1.000 0.000 128.000; 0.000 0.000 0.000 1.000; INFO: loading movable fieldmap0001.nii Setting mov orientation to RIA Tmov: -------------------- -0.547 0.000 0.000 17.500; 0.000 0.000 0.547 -17.500; 0.000 -0.547 0.000 17.500; 0.000 0.000 0.000 1.000; mkheaderreg = 1, float2int = 0 Computing reg from header (and possibly input matrix) ---- Input registration matrix (computed) -------- -1.000 0.000 0.000 -0.587; 0.000 1.000 0.000 -2.150; 0.000 0.000 1.000 -2.188; 0.000 0.000 0.000 1.000;
---- Input registration matrix -------- -1.000 0.000 0.000 -0.587; 0.000 1.000 0.000 -2.150; 0.000 0.000 1.000 -2.188; 0.000 0.000 0.000 1.000; Determinant -1 subject = rat RegMat --------------------------- 1.000 0.000 0.000 -0.587; 0.000 1.000 0.000 -2.150; 0.000 0.000 1.000 -2.188; 0.000 0.000 0.000 1.000; FSLOUTPUTTYPE NIFTI_GZ tkreg2FSL: mov det = 0.163555, ref det = 0.154688 INFO: FSL2FreeSurfer: Mov volume is NIFTI with positive det, applying LR flip to registration matrix. INFO: FSL2FreeSurfer: Ref volume is NIFTI with positive det, applying LR flip to registration matrix.
here is what I get from fsl_rigid_register: $Id: fsl_rigid_register,v 1.31 2011/03/02 20:16:39 nicks Exp $ Thu Nov 19 17:13:48 EST 2015 fieldmap0001_reg.nii Reference is nifti, not converting Input is nifti, not converting Output is nifti, not converting
/Freiwald/cschwiedrz/rodent/test/Rat_673b_Baseline/Phasemap calling eval flirt.fsl -in ./fieldmap0001.hdr -out ./fieldmap0001_reg.hdr -bins 256 -cost corratio -searchrx -10 10 -searchry -10 10 -searchrz -10 10 -interp trilinear -dof 6 -ref ./epi.hdr -init initxfm.fslmat -omat ./fieldmap0001_reg.fslmat /Freiwald/cschwiedrz/rodent/test/Rat_673b_Baseline/Phasemap mri_copy_params --pulse fieldmap0001_reg.nii fieldmap0001.nii fieldmap0001_reg.nii only copying pulse parameters WARNING: volume sizes are different in_vol : 80, 80, 22 temp_vol : 64, 64, 64 WARNING: voxel sizes are different in_vol : 0.375, 0.375, 1.1 temp_vol : 0.546875, 0.546875, 0.546875
/Freiwald/cschwiedrz/rodent/test/Rat_673b_Baseline/Phasemap tkregister2_cmdl --targ epi.nii --mov fieldmap0001.nii --reg ./fsl_rigid_register.28592/reg.dat --fslreg fieldmap0001_reg.nii.fslmat --noedit tkregister_tcl /Freiwald/lab_files/opt/freesurfer-Linux-centos4_x86_64-stable-pub-v5.1.0-full/tktools/tkregister2.tcl ---- FSL registration matrix -------- 0.987 -0.164 0.002 0.247; 0.157 0.943 -0.295 -5.691; 0.046 0.291 0.956 7.475; 0.000 0.000 0.000 1.000;
target volume epi.nii movable volume fieldmap0001.nii reg file ./fsl_rigid_register.28592/reg.dat LoadVol 0 ZeroCRAS 0 $Id: tkregister2.c,v 1.121.2.1 2011/03/28 20:25:16 greve Exp $ Diagnostic Level -1 INFO: loading target epi.nii INFO: target does not conform to COR format, so I'm going to reslice to COR. This will not affect the final registration. Ttarg: -------------------- -1.000 0.000 0.000 128.000; 0.000 0.000 1.000 -128.000; 0.000 -1.000 0.000 128.000; 0.000 0.000 0.000 1.000; INFO: loading movable fieldmap0001.nii Tmov: -------------------- -0.547 0.000 0.000 17.500; 0.000 0.000 0.547 -17.500; 0.000 -0.547 0.000 17.500; 0.000 0.000 0.000 1.000; mkheaderreg = 0, float2int = 0 FSLOUTPUTTYPE NIFTI fsl2TkReg: mov det = 0.163555, ref det = 0.154688 INFO: FSL2FreeSurfer: Mov volume is NIFTI with positive det, applying LR flip to registration matrix. INFO: FSL2FreeSurfer: Ref volume is NIFTI with positive det, applying LR flip to registration matrix. ---- Input registration matrix (computed) -------- -0.987 0.046 -0.157 0.692; -0.002 0.956 0.295 -19.148; -0.164 -0.291 0.943 -0.998; 0.000 0.000 0.000 1.000;
---- Input registration matrix -------- -0.987 0.046 -0.157 0.692; -0.002 0.956 0.295 -19.148; -0.164 -0.291 0.943 -0.998; 0.000 0.000 0.000 1.000; Determinant -1 subject = subject-unknown RegMat --------------------------- 0.987 0.046 -0.157 0.692; 0.002 0.956 0.295 -19.148; 0.164 -0.291 0.943 -0.998; 0.000 0.000 0.000 1.000; Cleaning up
Started at Thu Nov 19 17:13:48 EST 2015 Ended at Thu Nov 19 17:13:50 EST 2015
fsl_rigid_register Done
if I check the results here using tkmedit -f epi.nii -aux fieldmap0001_reg.nii the orientation of fieldmap0001_reg.nii is already wrong.
here is what I get from mri_vol2vol: movvol fieldmap_rads.nii.gz targvol epi.nii outvol fieldmap_rads_reg.nii.gz regfile mag_2_mocovol.register.dat invert 0 tal 0 talres 2 regheader 0 noresample 0 interp trilinear (1) precision float (3) Gdiag_no -1 Synth 0 SynthSeed 1448209916
Final tkRAS-to-tkRAS Matrix is: 0.987 0.046 -0.157 0.692; 0.002 0.956 0.295 -19.148; 0.164 -0.291 0.943 -0.998; 0.000 0.000 0.000 1.000;
Vox2Vox Matrix is: 0.676 -0.108 -0.093 8.999; 0.112 0.646 0.586 -2.959; -0.002 -0.202 1.922 -16.003; 0.000 0.000 0.000 1.000;
Resampling Output registration matrix is identity INFO: wAriting registration matrix to fieldmap_rads_reg.nii.gz.reg
checking the result with tkregister2 --mov fieldmap_rads_reg.nii.gz --targ epi.nii --reg fieldmap_rads_reg.nii.gz.reg also yields the wrong orientation, obviously.
In this case, I am changing the fieldmap to RIA orientation, although it is actually IPL; doing the same steps with the original IPL orientation gives the same faulty results.
this is the code:
tkregister2 --s rat \ --targ $epi \ --mov fieldmap0001.nii \ --reg mag_2_mocovol.register.dat \ --fslregout initxfm.fslmat \ --noedit \ --regheader \ --mov-orientation $fieldmap_orient \ --targ-orientation $epi_orient
flirt_opts="-maxangle 10 -dof 6 -interp trilinear -bins 256 -cost corratio" fsl_rigid_register -r $epi \ -i fieldmap0001.nii \ -o fieldmap0001_reg.nii \ -regmat mag_2_mocovol.register.dat \ -initxfm initxfm.fslmat \ ${flirt_opts}
# apply registration to phase mri_vol2vol --mov fieldmap_rads.nii.gz --targ $epi --o fieldmap_rads_reg.nii.gz --reg mag_2_mocovol.register.dat --trilin
Any advice would be appreciated. Thanks! Caspar
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer