# how to plot the direction and amplitude of the planar gradient

Jan-Mathijs Schoffelen j.schoffelen at PSY.GLA.AC.UK
Fri Oct 2 11:46:25 CEST 2009

```Dear Jim,

As far as I know, this is not possible in fieldtrip ... yet. Do I read
between the lines that you wouldn't mind giving it a try? I agree that
it's a very useful way to visualize planar gradient data.
First of all, it is indeed important to know the local coordinate
system for each of the planar gradient channels. For megplanar I
always use the 'sincos' method. You can see how the coordinate system
is defined at line 419 and beyond. As far as I can see the local x-
axis is taken as the vector orthogonal to the plane defined by the
coil's orientation, and the vector [0 0 1] (which is the z-axis of the
coordinate system in which your sensors are defined; assuming your
sensors are defined in headspace, this one points to the top of the
head). The local z-axis is the vector perpendicular to the coil's
plane (=orientation), and the y-axis is perpendicular to the local xz-
plane.
I guess that for the other planarmethods it's possible to figure out
the local coordinate systems as well. One think which we could think
of, is to adjust megplanar such that the output data contains
information about the local x and y axes directly.
Of course, it would also be nice if a hypothetical plotting function
would work for data acquired with hardware planar gradiometers. Here
it is usually straightforward to reconstruct the local coordinate
systems from the header-information. Perhaps people working with
Elekta-systems already have some matlab code for the plotting...
Once the local coordinate systems are known (and the angles defined
accordingly), it should be possible to warp these values to a
headspace based coordinate system for plotting (in 3D, or in 2D after
an appropriate projection).

Best,

Jan-Mathijs

On 2 Oct 2009, at 04:07, Jim Li wrote:

> Dear all,
>
> I want to view the direction and amplitude of the planar gradient
> near each
> sensor location and create a plot like what's shown in the  attached
> file (more
> or less).  Is it possible to do it? If so, how?
>
> Our MEG sensors are 248 axial gradiometers. After running
> "megplanar" I got
> A1_dH...A248_dH,A1_dV...A248_dV for my channels. If, say, in the plane
> tangential to a given channel we have the Horizontal (x axis) and
> Vertical (y
> axis) directions. Then for the channel of interest, say A1,  I can
> run sqrt
> (A1_dH^2+A1_dV^2) to get the amplitude of the planar gradient, and I
> can
> run atan2(A1_dV,A1_dH)*180/pi) to get the angle between the field
> vector
> and x-axis. What I'm not sure  about is how fieldtrip defines the
> Horizontal (x
> axis) and Vertical (y axis) for each channel (in a plane tangential
> to that
> channel). So it's hard to create the plot I want...
>
> Thanks a lot.
>
> Jim
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users
> of the FieldTrip  toolbox, to share experiences and to discuss new
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html
>  and http://www.ru.nl/neuroimaging/fieldtrip.
> <PlotGoal.TIF>

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.

```

More information about the fieldtrip mailing list