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:

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