Calculating the transformation matrix, from the points chosen by the user

How the 4x4 transform, saved as base.vol2tal, is calculated

We calculate the 4×4 transform that takes the volume from the original coordinates to talairach coordinates. This transform is never actually applied to the volume. Rather, it is saved (in the base structure, as base.vol2tal), and used in calculations, both to display Talairach coordinates when viewing the volume on mrLoadRet, and to align ROIs across different subjects.

We keep everything in the base structure, and we don't change the NIFTI headers, e.g., we do not re-set sform code to 3, we do not actually rotate the volume, and we do not change the s-form. Rather, we leave the sform code as 1, and save talXform to the base structure to be used for viewing or aligning.

The basic equation is:

(User-Chosen Points) = (transformation matrix )*(Canonical Talairach Points)


(tranformation matrix) = (User-Chosen Points)/(Canonical Talairach Points)

This is done in mrAlignGui under the Talairach callback, and the code follows these steps:

(1) create Canonical Talairach Matrix:

The Canonical Talairach coordinates are:

tAC = [0 0 0]';
tPC = [0 -24 0]';
tSAC = [0 0 72]';
tIAC = [0 0 -42]';
tPPC = [0 -102 0]';
tAAC = [0 68 0]';
tLAC = [-62 0 0]';
tRAC = [62 0 0]';

These are converted into an 8×4 matrix:

talPoints = [tAC tPC tSAC tIAC tPPC tAAC tLAC tRAC];
talPoints(4, :) = ones(1,size(talPoints,2));
(2) Identify those same points on your volume, using the GUI.
talInfo.filename =  ALIGN.volumePath;
talInfo = talairach(ALIGN.volumePath);
(3) Use the chosen points to create an 8x4 matrix (similar to the Canonical matrix):
points = [talInfo.AC;talInfo.PC;talInfo.SAC;talInfo.IAC;talInfo.PPC;talInfo.AAC;talInfo.LAC;talInfo.RAC]';
points(4, :) = ones(1,size(points,2));
(4) Compute the 4x4 transform that takes volume coordinates to Talairach coordinates:
talTransform = talPoints*pinv(points);
(5) Save that to the base structure
ALIGN.volBase.vol2tal = talTransform;
ALIGN.volBase.talInfo = talInfo;

Return to main Talairach page