Hi Doug,
I'd like to use the registration matrix from bbregister to transform functional data into a cropped FOV that corresponds with the anatomy.
I thought that bbregister outputs a ras2ras transform, so if I could crop the anatomical volume with a correct header vox2ras, things should be fine. Is my thinking here wrong?
Here is roughly what I have done:
1. Generate a registration matrix to the full anatomy
bbregister --s subj --mov func.nii --reg reg.dat --t2
2. Crop the anatomy:
mri_convert brain.mgz brain.nii fslroi brain.nii brain_crop.nii 50 150 50 150 50 150
(I know this is an fsl tool but I couldn't find an option to do exactly this in mri_convert)
3. Check the output -- looks fine so far
tkregister2 --mov brain-crop.nii --regheader --s subj --surfs --reg /dev/null
4. Resample the functional volume
mri_vol2vol --mov func.nii --targ brain_crop.nii --reg reg.dat --o func_xfm.nii
5. Check the output
tkregister2 --mov func_xfm.nii --regheader --s subj --surfs --reg /dev/null
The resulting functional image is shifted superior about ~20cm
What am I missing in my understanding of the bbregister and header transformation matrices?
Thanks! Michael
Alternatively, is it possible to pass bbregister a different target volume that's in register with the surfaces?
On Thu, Aug 17, 2017 at 6:10 PM, Michael Waskom mwaskom@nyu.edu wrote:
Hi Doug,
I'd like to use the registration matrix from bbregister to transform functional data into a cropped FOV that corresponds with the anatomy.
I thought that bbregister outputs a ras2ras transform, so if I could crop the anatomical volume with a correct header vox2ras, things should be fine. Is my thinking here wrong?
Here is roughly what I have done:
- Generate a registration matrix to the full anatomy
bbregister --s subj --mov func.nii --reg reg.dat --t2
- Crop the anatomy:
mri_convert brain.mgz brain.nii fslroi brain.nii brain_crop.nii 50 150 50 150 50 150
(I know this is an fsl tool but I couldn't find an option to do exactly this in mri_convert)
- Check the output -- looks fine so far
tkregister2 --mov brain-crop.nii --regheader --s subj --surfs --reg /dev/null
- Resample the functional volume
mri_vol2vol --mov func.nii --targ brain_crop.nii --reg reg.dat --o func_xfm.nii
- Check the output
tkregister2 --mov func_xfm.nii --regheader --s subj --surfs --reg /dev/null
The resulting functional image is shifted superior about ~20cm
What am I missing in my understanding of the bbregister and header transformation matrices?
Thanks! Michael
OK I think a way around this is to use tkregister2 to generate a registration between the conformed brain image and the cropped one:
tkregister2 --mov brain.nii --targ brain-crop.nii --regheader --reg anat2crop.dat --noedit
I can then convert this to an FSL-style matrix and use convert_xfm to concatenate the func2anat and anat2crop matrix so it can be applied with a single interpolation.
By the way is it possible to combine two tkreg style matrices in that format? I don't see an obvious option in tkregister2. That is I want to combine a2b.dat and b2c.dat into a2c.dat.
Thanks, Michael
On Fri, Aug 18, 2017 at 2:00 PM, Michael Waskom mwaskom@nyu.edu wrote:
Alternatively, is it possible to pass bbregister a different target volume that's in register with the surfaces?
On Thu, Aug 17, 2017 at 6:10 PM, Michael Waskom mwaskom@nyu.edu wrote:
Hi Doug,
I'd like to use the registration matrix from bbregister to transform functional data into a cropped FOV that corresponds with the anatomy.
I thought that bbregister outputs a ras2ras transform, so if I could crop the anatomical volume with a correct header vox2ras, things should be fine. Is my thinking here wrong?
Here is roughly what I have done:
- Generate a registration matrix to the full anatomy
bbregister --s subj --mov func.nii --reg reg.dat --t2
- Crop the anatomy:
mri_convert brain.mgz brain.nii fslroi brain.nii brain_crop.nii 50 150 50 150 50 150
(I know this is an fsl tool but I couldn't find an option to do exactly this in mri_convert)
- Check the output -- looks fine so far
tkregister2 --mov brain-crop.nii --regheader --s subj --surfs --reg /dev/null
- Resample the functional volume
mri_vol2vol --mov func.nii --targ brain_crop.nii --reg reg.dat --o func_xfm.nii
- Check the output
tkregister2 --mov func_xfm.nii --regheader --s subj --surfs --reg /dev/null
The resulting functional image is shifted superior about ~20cm
What am I missing in my understanding of the bbregister and header transformation matrices?
Thanks! Michael
This might be easier to do with lta files, eg, when you run tkregister specify --ltaout file.lta. Once you have both LTAs, You can then use mri_concatenate_lta to multiply them together, eg
mri_concatenate_lta file1.lta file2.lta output.lta
output = file2matrix*file1matrix
mri_concatenate_lta can also invert the matrices before doing the computation
On 08/18/2017 03:23 PM, Michael Waskom wrote:
OK I think a way around this is to use tkregister2 to generate a registration between the conformed brain image and the cropped one:
tkregister2 --mov brain.nii --targ brain-crop.nii --regheader --reg anat2crop.dat --noedit
I can then convert this to an FSL-style matrix and use convert_xfm to concatenate the func2anat and anat2crop matrix so it can be applied with a single interpolation.
By the way is it possible to combine two tkreg style matrices in that format? I don't see an obvious option in tkregister2. That is I want to combine a2b.dat and b2c.dat into a2c.dat.
Thanks, Michael
On Fri, Aug 18, 2017 at 2:00 PM, Michael Waskom <mwaskom@nyu.edu mailto:mwaskom@nyu.edu> wrote:
Alternatively, is it possible to pass bbregister a different target volume that's in register with the surfaces? On Thu, Aug 17, 2017 at 6:10 PM, Michael Waskom <mwaskom@nyu.edu <mailto:mwaskom@nyu.edu>> wrote: Hi Doug, I'd like to use the registration matrix from bbregister to transform functional data into a cropped FOV that corresponds with the anatomy. I thought that bbregister outputs a ras2ras transform, so if I could crop the anatomical volume with a correct header vox2ras, things should be fine. Is my thinking here wrong? Here is roughly what I have done: 1. Generate a registration matrix to the full anatomy bbregister --s subj --mov func.nii --reg reg.dat --t2 2. Crop the anatomy: mri_convert brain.mgz brain.nii fslroi brain.nii brain_crop.nii 50 150 50 150 50 150 (I know this is an fsl tool but I couldn't find an option to do exactly this in mri_convert) 3. Check the output -- looks fine so far tkregister2 --mov brain-crop.nii --regheader --s subj --surfs --reg /dev/null 4. Resample the functional volume mri_vol2vol --mov func.nii --targ brain_crop.nii --reg reg.dat --o func_xfm.nii 5. Check the output tkregister2 --mov func_xfm.nii --regheader --s subj --surfs --reg /dev/null The resulting functional image is shifted superior about ~20cm What am I missing in my understanding of the bbregister and header transformation matrices? Thanks! Michael
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
freesurfer@nmr.mgh.harvard.edu