<html>
<font size=3>Dear Lazlo,<br><br>
I've been struggling with this question myself, so maybe I can help you
out a little bit.<br><br>
> I am trying to write code to digest electrode positions data for a
Polhemus Patriot digitizer. I would like to <br>
> match up results with some standard coordinates, however I am
puzzled with the various location files available. <br>
> The problem is with the origins/axes. Neuroscan sample files seem to
have axes thru preauriculars and nasion. <br><br>
The Neuroscan 3DSpace-DX program, that can be used with a Polhemus device
to localize cap-electrodes, indeed uses a coordinate-system based on the
preauricular points and the nasion (a so-called head-based coordinate
system). If you open the program (if you have access to it of course) and
read in one of the available sample.3DD files, you will see a 3D-plot
(including X-Y-Z- axes) showing all the digitized electrodes. Channels as
Fp1-Fp2-O1-O2 are indeed not on the equator in digitized data, but some
1-2 inches above the equator. However, if you save this .3DD file as a
BESA elp-file (with locations defined in angles from Z-axis and
XY-plane), all electrode-locations are not only converted into theta and
phi (angle) coordinates, but also the whole coordinate-system changes its
centroid from a head-based to a spherical head-model (using an
equator-based centroid; with the equator going through Fp1-Fp2-O1-O2, at
90 degrees from Cz (0,0) at the pole of the sphere). Standard locations
are often described using this system, because of its value in
dipole-fitting. For clearity about BESA assumptions and routines, here is
how it was described in an old BESA (V2.2) manual. It must be said,
however, that more recent BESA versions use a more ellipsoid (more
realistic) than spherical headmodel, and also calculate the sphere
differently. This, however, does not change the placement of the origin
of the sphere, that is, it is still higher than the origin of the
head-based system. <br><br>
</font><font face="Comic Sans MS" size=3>===============================================================================================<br><br>
"In order to understand the use of the angular coordinates we will
refer to Cartesian (x, y, z) coordinates with the origin at the center of
the head, in which the z-axis points to the vertex (through Cz), the
x-axis points to the right (through T4) and the y-axis points forward
(through Fpz).  The center of the equivalent spherical head model is
approximately at the middle of the posterior commissure. 
<b>Theta</b> is the azimuth angle with the vertical z-axis and <b>phi</b>
is the latitude angle in the horizontal x-y-plane (counterclockwise).  The easiest way to understand the coordinate system is to<b> R</b>ead<b> E</b>lectrode file <b>1020</b>.elp and to enter the <b>ELECTRODE</b> menu.  You can see that  positive values of <b>theta</b> indicate right, negative values left hemispheric location.  Within each hemisphere, negative <b>phi</b> indicates clockwise, positive <b>phi</b> counterclockwise displacement from the horizontal x-axis.<br><br>
</font><font face="Comic Sans MS" size=3><b>Defining electrodes from digitized locations</b></font>
<dl>
<dd>Digitized electrode locations form a 3-D cloud that is approximately ellipsoid and follows the contours of the subject’s head. To convert these to a sphere, BESA performs two steps:
<dd>a) finds the best fit sphere to match the electrode cloud, and
<dd>b) rotates the sphere to match as well as possible the locations of named electrodes with its own location table.
<dd>In step <i>a</i>, normally all digitized locations are used. However, locations labelled with an ‘X’ are excluded from the fit, allowing the user to generate the best fit sphere to selected locations (e.g. the back of the head). In step <i>b</i>, only those locations are used for which BESA recognizes the label. By selecting or omitting labels, this allows the user to choose which coordinates should be used for rotating the sphere to fit the user coordinates.
</dl><font face="Comic Sans MS" size=3><b>Transformation parameters</b></font>
<dl>
<dd>Once the electrode coordinates have been converted into internal spherical coordinates, three types of information are available:
<dd>a) the location of the sphere center and the radius of the sphere (from step <i>a</i> above),
<dd>b) the angles through which x, y, and z axes were rotated to get from USER to BESA coordinates (from step <i>b</i> above), and
<dd>c) a generalized transformation matrix that can be used to convert between USER and BESA coordinates for any location in and on the head. This matrix is used to generate source locations in USER coordinates, or to input hypothesized source locations from functional MRI.
<dd>The informations in <i>a</i> and <i>b</i> are obtained directly from the fits described above. The generalized transformation matrix, <b>X</b>, is obtained in an additional step. Let <b>B</b> be the matrix of electrode locations on the BESA sphere (<i>n</i> electrodes x 3 coordinates), and <b>U</b> be the matrix of digitized, user coordinates (also <i>n</i> x 3). Then the transformation is defined by
<dd><x-tab>        </x-tab><x-tab>        </x-tab><b>U</b> = <b>X B</b>
<dd>The 3 x 3 matrix <b>X</b> is defined to give the best possible transformation (in the least squares sense) between <b>U</b> and <b>B</b>.
</dl>Thus, if applied to any location in the head, the transformation matrix does its best to perform the same distortion of the spherical to the ellipsoidal volume that it would do to transform the electrode locations.<font face="Comic Sans MS" size=3>"<br><br>
===============================================================================================<br><br>
</font>> If I understand correctly, the system should not influence the localisation, until it is  coregistered with te <br>
> fiducial points (LE,RE, Nasion), since the head model is getting transformed to the MRI head using the <br>
> coordinates of the fiducials .Anyway, I would like to see a bit more clearly. <br><br>
True. The fiducials are the most crucial locations. Those can be used to transform (using scaling, translation, and rotation) your electrode-data into MRI (MNI or Talairach)-space. In sum, trying to match your results to BESA-standard locations is not recommended, because those are calculated differently and are based on different head-models. <br><br>
You also might find the information on Robert Oostenveld's website useful.<br>
<a href="http://www.smi.auc.dk/~roberto/index.html" eudora="autourl">http://www.smi.auc.dk/~roberto/index.html</a><br><br>
Hope this helps.<br><br>
Best,<br><br>
Tineke Grent-'t-Jong<br>
Department of Psychopharmacology<br>
University Utrecht<br>
The Netherlands<br>
<br>
</html>