eXTReMe Tracker
Oct 242012
 

1. Convert the brain.mgz volume to analyze:

mri_convert $SUBJECTS_DIR/bert/mri/brain.mgz brain.img

2. Align brain.img with your functional data in spm (eg, func.img)

3. Create your spm statistical output (eg, t.img)

4. Create the registration file:

tkregister2 --s subjectname --mov meanswaf.img --regheader --reg  register.dat --surf orig

This will bring up the tkregister window with the orig volume. Hit the “Compare” button to see the functional. The green line will be the surface. Make sure the alignment is good (ie, the green line follows the bright intensity patterns in the functional). Hit the “Save” button to save the registration. This will create a file called register.dat. If you make modifications to the registration and then want to view or edit it later, re-run the above command WITHOUT –regheader. This requires a lot of manual tweaking to get the functional brain aligned with Bert brain.

5. View your functional data in the volume:

tkmedit subjectname orig.mgz -overlay spmT_0001.img -overlay-reg register.dat

6. View your functional data on the surface:

tksurfer subjectname lh inflated -overlay spmT_0001.img -overlay-reg register.dat

Adopted from spmPainting

Apr 142011
 

Assuming the nifti toolbox is in Matlab path, we can get the 91x109x91 mask to have the same dimensions as the normalized images generated with bounding boxes.

If we are making a mask for hippocampus, first we save that mask from WFU Pickatlas. Then to make it 79x95x68 voxels, run the following small script.

x=load_untouch_nii(‘hipp.img’);
x=x.img;xdim=[1:6 86:91]; ydim=[1:6 102:109]; zdim=[1:11 80:91];
origin=[40 57 26]; datatype=16;
x(xdim,:,:)=[]; x(:,ydim,:)=[]; x(:,:,zdim)=[];
nii=make_nii(x, [2 2 2], origin, datatype);
save_nii(nii, ‘boxedhippo.nii’)

We can then use these masks for signal extraction or any further processing.