MRIreg: MRI-to-miniBird Registration

New: now works with Polhemus Fastrak as well as Ascension position trackers.

It is often useful to coregister a MRI scan with the subject's real head geometry - for example, with Transcranial Magnetic Stimulation, it is useful to have a precise idea of which region of the brain is being stimulated. MRIreg is a free tool that allows you to identify which region of the scalp is near a particular brain region. To use MRIreg you will need:

  1. MRIreg for Windows [free, shift+click here to download version 0.995].
  2. MRIcro for Windows [free from the MRIcro home page].
  3. A MRI scan for the person you want to register.
  4. An Ascension Flock-Of-Birds/MiniBird or Polhemus Fastrak magnetic position tracker.

It is easiest to get good results from coregistration by using MRI scans where you have marked easy-to find landmarks on the individuals face or scalp (e.g. place liquid-vitamin gel-capsules on their facial beauty marks during scanning). You will need to find at least 5 anatomic landmarks.

Start MRIcro, and make sure the 'Yoke' and 'XBars' controls are checked [outlined in purple on the picture to the right]. It is generally easiest to find landmarks in the 'projection' view that shows the Axial, Sagittal and Coronal views simultaneously [click on the 3D-cube button outlined in blue]. Load the MRI scan and find your landmarks (regions that you can identify on both the MRI scan as well as the individual's head [e.g. bones, nose, ears, etc]). If there are any anatomical regions of the brain you wish to locate (e.g. the motor hand area), you will also want to work out these coordinates. For all the landmarks, you will want to know where they appear in the X,Y and Z coordinates (outlined in green).

Start the MRIreg software. Switch on your Bird and switch it to 'Fly' when the sftware asks you to. If your Bird is connected correctly, the XYZ position of the bird sensor should appear at the bottom-right of the MRIreg window (e.g. 'FOB -742 139 892'); this value should change when the Bird sensor is moved. If this does not work, try adjusting the serial-port speed (the 'FOB' menu allows you to choose a speed between 9600 and 57600 baud, as well as letting you select either a bird or Fastrak system). Likewise, for Fastrak systems, make sure the tracker on and is connected to your laptop, and that MRIreg FOB menu is set for the proper port speed and tracker type.

You are now ready to add in coordinates to MRIreg. At this point, MRIcro should be displaying the MRI scan, and MRIreg should be displaying the position of the bird sensor (at the bottom right of the window) and the MRI scan coordinates (at the bottom left).

Step 1: Calibration
  1. With MRIcro, click on the projection view to select an anatomical position. (You want to select the location where the sensor will be, e.g. instead of the tip of the nose, select a few millimeters anterior to the tip).
  2. Move the magnet sensor to the location displayed in MRIcro.
  3. Press the MRIreg '+' button (or press F1). A new spreadsheet row appears in MRIreg, showing the MRI position (left) and the corresponding magnet position (right).
  4. Repeat steps 1-3 until you have entered all of your anatomical landmarks.You must enter at least 5 positions, more positions give better accuracy during magnet tracking. Pick well-separated points (e.g. select regions on the face, the ears, the back of the head and the top of the head; instead of only points on the face).
Step 2.Magnet Tracking
  1. Once you have entered all of your anatomical landmarks in step one, press the 'correlation line' button on the bottom left corner of MRIreg to switch from calibration to tracking mode. This will have several effects:
    • The spreadsheet disappears. In its place you see the magnet-to-MRI transform function and the current magnet-to-desired MRI coordinate distance.
    • The MRI position in MRIcro will now change depending on the location of the magnet.
  2. You can now enter the coordinates of your desired anatomical target (e.g. the motor hand area) in the 'desired MRI' boxes. MRIreg will estimate the current distance of the magnet from this point.
    • Note: The magnet-to-target distance is reported in voxels. For images where the voxels are not cubic (e.g. 1x1x3mm scans instead of 1x1x1mm scans), this can be confusing. Note that the bottom left shows the estimated voxel positions, so you can calculate the true distance yourself.
Magnetic sensor on scalp After calibration the location of the magnet track can be observed: Default location of FOB base unit:
all scalp locations within one meter
all scalp locations in single hemisphere of base unit


Normalization refers to strecthing, rotating and warping brains from different people so that the resulting images are aligned in standard space. Once an image has been normalized, its shape roughly matches other normalized images. This allows you to use Talairach coordinates to describe different brain locations, and eases making group comparisons. There are two ways you can use normalization with MRIreg:

  1. Conduct MRIreg positioning on the raw MRI scan. Then normalize the image and convert the locations you stimulated with the same transfroms you applied to the raw MRI scan. This allows you to describe the locations you stimulated in stereotaxic space. The advantage of this method is that you can apply both linear as well as nonlinear normalization transfroms, so you get a better fit. However, it is also more complicated.
  2. Transform a linear-only normalization on the MRI scan. Use MRIreg with this normalized image. The benefits of this method is that it is simpler, you can directly target locations in Talairach/MNI space, and if your raw data is anisotropic (e.g. voxel sizes are 1x1x1.5mm, so they appear squished) the normalized image can be isotropic (e.g. 1x1x1mm).

If you decide to use normalized images with MRIreg, do NOT use nonlinear transforms. MRIreg automatically adjusts for linear differences between MRI scans and coordinates measured by the FasTrack/FoB systems, however it can not correct for nonlinear distortions. You can use several tools to normalize you images. Popular tools include AIR, FLIRT, MNI_AutoReg and SPM2. Here I script that I use to apply a linear normalization using SPM2. To run this script: first install Matlab and SPM2. Put the .m file below in your Matlab path and then type 'norm_lin_1mm_mask_tms' from the Matlab command line.

contents for norm_lin_1mm_mask_tms.m: place in spm folder %green text are comments, not code
%Use norm_lin_1mm_mask_tms to conduct linear normalization on a series of T1 mri scans

fprintf(['Use norm_lin_1mm_mask_tms to conduct linear normalization on a series of T1 mri scans \n' ]);
spm_defaults %initialize spm variables
global defaults %initialize variables
dnrm = defaults.normalise; %normalization is based on SPM defaults
dnrm.write.vox = [1 1 1]; %set resilcing of high resolution images for 1mm isotropic
dnrm.estimate.cutoff = Inf; %nonlinear normalization ONLY
dnrm.estimate.weight = ''; %use a mask for the template image
dnrm.estimate.weight = fullfile(spm('Dir'),'apriori','brainmask.mnc'); %use a mask for the template image = [[-91 -125 -71];[89 91 109]]; %set bounding box to match ch2bet = [[-101 -135 -129];[99 101 109]]; %set large bounding box
VG0 = spm_vol(fullfile(spm('Dir'),'templates','T1.mnc')); %match scans to the T1-weighted template
V = spm_vol(spm_get(Inf,'*.IMAGE','Select images')); %have the user select image
for i=1:length(V), %repeat for each image the user selected
   [pth,nam,ext] = fileparts(V(i).fname); %segment file path/file name and extension
   VF = spm_vol(V(i)); %select the MRI scan
   prm = spm_normalise(VG0,VF,'',dnrm.estimate.weight, '' ,dnrm.estimate); %normalize an image
   spm_write_sn(V(i),prm,dnrm.write); %reslice the image to new coordinates and save to disk
end; %repeat for each image

A few important notes: