Simulations testing MEG planar on Yokogawa system

Sangita Dandekar sangita.dandekar at GMAIL.COM
Fri Sep 10 22:01:37 CEST 2010


Hi,

I've tried to make changes to the megplanar code in FieldTrip so that it can
be used for our Yokogawa (axial gradiometer) MEG system.  I was wondering if
anyone familar with the planar gradient approximation code in megplanar
and/or the Yokogawa system could take a quick look at the changes  that I've
made and the results of simulations that I've done and see if they look
reasonable.
Output images generated by the simulation code (code pasted below) are at:

http://clayspace.psych.nyu.edu/lab-members/sangita-dandekar/planarsims/


The simulation just consisted of pointing dipoles along the major axes and
getting planar approximations for every dipole orientation.  The output
images are at the above link.

Also pasted below are changes to segments of the combineplanar and
planarchannelset functions that I made for the yokogawa system.  (The only
change that I ended up making in the original megplanar.m function was to
comment out the
code that causes an error if the input data is from an MEG system other than
the supported ones)

The original grad struct that I am using the for the unmodified axial
gradiometer data for the yokogawa system looks like this:

ftdata.grad

ans =

      pnt: [314x3 double]
      ori: [314x3 double]
      tra: [157x314 double]
    label: {157x1 cell}
     unit: 'cm'

The hope is that I can use the megplanar code (probably using the 'sincos'
method) to get the planar gradient approximation, then apply freqanalysis to
the horizontal and vertical components separately,  and then finally
recombine/sum the vertical and horizontal components using combineplanar.
Any advice would be appreciated.

Thanks in advance for any help!
Sangita Dandekar

%*******Simulation code to produce axial and planar  x, y, and z images as
shown at link above

cfg.grad=ftdata.grad
cfg.dip.pos=[ftdata.grad.pnt(57,1)   ftdata.grad.pnt(57, 2)
ftdata.grad.pnt(57,3)-5]; %5 cm below lower coil of gradiometer 57
cfg.dip.mom=[0 1 0]; %also varied to point along x ([1 0 0]) and z ([0 0 1])
cfg.vol.r=10;
cfg.vol.o=[mean(ftdata.grad.pnt(:,1)) mean(ftdata.grad.pnt(:,2))
mean(ftdata.grad.pnt(:,3))]
cfg.dip.signal=[ 1 1 1 ];
data=dipolesimulation(cfg);
%get planar approximation:
cfg=[];
cfg.planarmethod='sincos';
cfg.channel=ftdata.grad.label;
[interp]=megplanar_yokogawa(cfg, data)
%recombine horizontal and vertical components:
cfg=[];
cfg.combinegrad='yes';
cfg.combmethod='sum';
[interpcomb]=combineplanar_yokogawa(cfg, interp)

figure;
cfgplot=[];
cfgplot.electrodes='numbers';
avg=timelockanalysis(cfgplot, interpcomb); %plot planar approximation
topoplotER(cfgplot, avg)


figure
avg=timelockanalysis(cfgplot, data);
topoplotER(cfgplot, avg)
avg=timelockanalysis(cfgplot, data); %plot original axial gradiometer output
topoplotER(cfgplot, avg)


%*****************CHANGES TO COMBINEPLANAR (combineplanar_yokogawa.m):


if strcmp(cfg.combinegrad, 'no') && ~isfield(data, 'grad')
  % the planar gradiometer definition was already removed
  % nothing needs to be done here
elseif strcmp(cfg.combinegrad, 'no') && isfield(data, 'grad')
  % remove the planar gradiometer definition since it does not match the
data any more
  data = rmfield(data, 'grad');
elseif strcmp(cfg.combinegrad, 'yes') && ~isfield(data, 'grad')
  % there is no gradiometer definition, impossible to reconstruct it
  error('the planar gradiometer definition is missing, cannot convert it
back to axial');
elseif strcmp(cfg.combinegrad, 'yes') && isfield(data, 'grad')
  warning('trying to convert planar to axial gradiometers, this is
experimental');
  % try to reconstruct the original axial gradiometer array from the planar
gradiometer definition
  orig = data.grad

  if all(size(orig.pnt)==[314 3]) && ...
    all(size(orig.pnt)==[314 3]) && ...
    all(size(orig.tra)==[314 314]) && ...
    length(orig.label)==314 && ...
    all(sum(orig.tra~=0,1)>2)
    % This looks as if it was made using the MEGPLANAR nearest neighbour
approach
    % which means that the coil position and orientation still correspond
    % with those of the original axial gradiometer. Only the label and tra
    % have been modified and have to be restored to their original values.
    axial.pnt = orig.pnt;
    axial.ori = orig.ori;
    for i=1:157
      axial.label{i} = orig.label{i}(1:(end-3));
    end
    if all(orig.ori(1,:)==orig.ori(158,:))
      % orientation is the same, the subtraction should be in "tra"
      axial.tra = [eye(157) -eye(157)];
    else
      % orientation is opposite, the subtraction should not be in "tra"
      axial.tra = [eye(157) eye(157)];
    end
    try
      axial.unit = orig.unit;
    end
  else
    error('cannot convert gradiometer definition back to axial, please
contact Robert');
  end
  data.grad = axial;
end



%*****************CHANGES TO PLANARCHANNELSET
%(planarchannelset_yokogawa.m):**


case 'meg'

   planar={
       '1_dH'    '1_dV'    '1'
    '2_dH'        '2_dV'    '2'
    '3_dH'        '3_dV'    '3'
    '4_dH'        '4_dV'    '4'
    '5_dH'        '5_dV'    '5'
    '6_dH'        '6_dV'    '6'
    '7_dH'        '7_dV'    '7'
    '8_dH'        '8_dV'    '8'
    '9_dH'        '9_dV'    '9'
    '10_dH'        '10_dV'    '10'
    '11_dH'        '11_dV'    '11'
    '12_dH'        '12_dV'    '12'
    '13_dH'        '13_dV'    '13'
    '14_dH'        '14_dV'    '14'
    '15_dH'        '15_dV'    '15'
    '16_dH'        '16_dV'    '16'
    '17_dH'        '17_dV'    '17'
    '18_dH'        '18_dV'    '18'
    '19_dH'        '19_dV'    '19'
    '20_dH'        '20_dV'    '20'
    '21_dH'        '21_dV'    '21'
    '22_dH'        '22_dV'    '22'
    '23_dH'        '23_dV'    '23'
    '24_dH'        '24_dV'    '24'
    '25_dH'        '25_dV'    '25'
    '26_dH'        '26_dV'    '26'
    '27_dH'        '27_dV'    '27'
    '28_dH'        '28_dV'    '28'
    '29_dH'        '29_dV'    '29'
    '30_dH'        '30_dV'    '30'
    '31_dH'        '31_dV'    '31'
    '32_dH'        '32_dV'    '32'
    '33_dH'        '33_dV'    '33'
    '34_dH'        '34_dV'    '34'
    '35_dH'        '35_dV'    '35'
    '36_dH'        '36_dV'    '36'
    '37_dH'        '37_dV'    '37'
    '38_dH'        '38_dV'    '38'
    '39_dH'        '39_dV'    '39'
    '40_dH'        '40_dV'    '40'
    '41_dH'        '41_dV'    '41'
    '42_dH'        '42_dV'    '42'
    '43_dH'        '43_dV'    '43'
    '44_dH'        '44_dV'    '44'
    '45_dH'        '45_dV'    '45'
    '46_dH'        '46_dV'    '46'
    '47_dH'        '47_dV'    '47'
    '48_dH'        '48_dV'    '48'
    '49_dH'        '49_dV'    '49'
    '50_dH'        '50_dV'    '50'
    '51_dH'        '51_dV'    '51'
    '52_dH'        '52_dV'    '52'
    '53_dH'        '53_dV'    '53'
    '54_dH'        '54_dV'    '54'
    '55_dH'        '55_dV'    '55'
    '56_dH'        '56_dV'    '56'
    '57_dH'        '57_dV'    '57'
    '58_dH'        '58_dV'    '58'
    '59_dH'        '59_dV'    '59'
    '60_dH'        '60_dV'    '60'
    '61_dH'        '61_dV'    '61'
    '62_dH'        '62_dV'    '62'
    '63_dH'        '63_dV'    '63'
    '64_dH'        '64_dV'    '64'
    '65_dH'        '65_dV'    '65'
    '66_dH'        '66_dV'    '66'
    '67_dH'        '67_dV'    '67'
    '68_dH'        '68_dV'    '68'
    '69_dH'        '69_dV'    '69'
    '70_dH'        '70_dV'    '70'
    '71_dH'        '71_dV'    '71'
    '72_dH'        '72_dV'    '72'
    '73_dH'        '73_dV'    '73'
    '74_dH'        '74_dV'    '74'
    '75_dH'        '75_dV'    '75'
    '76_dH'        '76_dV'    '76'
    '77_dH'        '77_dV'    '77'
    '78_dH'        '78_dV'    '78'
    '79_dH'        '79_dV'    '79'
    '80_dH'        '80_dV'    '80'
    '81_dH'        '81_dV'    '81'
    '82_dH'        '82_dV'    '82'
    '83_dH'        '83_dV'    '83'
    '84_dH'        '84_dV'    '84'
    '85_dH'        '85_dV'    '85'
    '86_dH'        '86_dV'    '86'
    '87_dH'        '87_dV'    '87'
    '88_dH'        '88_dV'    '88'
    '89_dH'        '89_dV'    '89'
    '90_dH'        '90_dV'    '90'
    '91_dH'        '91_dV'    '91'
    '92_dH'        '92_dV'    '92'
    '93_dH'        '93_dV'    '93'
    '94_dH'        '94_dV'    '94'
    '95_dH'        '95_dV'    '95'
    '96_dH'        '96_dV'    '96'
    '97_dH'        '97_dV'    '97'
    '98_dH'        '98_dV'    '98'
    '99_dH'        '99_dV'    '99'
    '100_dH'        '100_dV'    '100'
    '101_dH'        '101_dV'    '101'
    '102_dH'        '102_dV'    '102'
    '103_dH'        '103_dV'    '103'
    '104_dH'        '104_dV'    '104'
    '105_dH'        '105_dV'    '105'
    '106_dH'        '106_dV'    '106'
    '107_dH'        '107_dV'    '107'
    '108_dH'        '108_dV'    '108'
    '109_dH'        '109_dV'    '109'
    '110_dH'        '110_dV'    '110'
    '111_dH'        '111_dV'    '111'
    '112_dH'        '112_dV'    '112'
    '113_dH'        '113_dV'    '113'
    '114_dH'        '114_dV'    '114'
    '115_dH'        '115_dV'    '115'
    '116_dH'        '116_dV'    '116'
    '117_dH'        '117_dV'    '117'
    '118_dH'        '118_dV'    '118'
    '119_dH'        '119_dV'    '119'
    '120_dH'        '120_dV'    '120'
    '121_dH'        '121_dV'    '121'
    '122_dH'        '122_dV'    '122'
    '123_dH'        '123_dV'    '123'
    '124_dH'        '124_dV'    '124'
    '125_dH'        '125_dV'    '125'
    '126_dH'        '126_dV'    '126'
    '127_dH'        '127_dV'    '127'
    '128_dH'        '128_dV'    '128'
    '129_dH'        '129_dV'    '129'
    '130_dH'        '130_dV'    '130'
    '131_dH'        '131_dV'    '131'
    '132_dH'        '132_dV'    '132'
    '133_dH'        '133_dV'    '133'
    '134_dH'        '134_dV'    '134'
    '135_dH'        '135_dV'    '135'
    '136_dH'        '136_dV'    '136'
    '137_dH'        '137_dV'    '137'
    '138_dH'        '138_dV'    '138'
    '139_dH'        '139_dV'    '139'
    '140_dH'        '140_dV'    '140'
    '141_dH'        '141_dV'    '141'
    '142_dH'        '142_dV'    '142'
    '143_dH'        '143_dV'    '143'
    '144_dH'        '144_dV'    '144'
    '145_dH'        '145_dV'    '145'
    '146_dH'        '146_dV'    '146'
    '147_dH'        '147_dV'    '147'
    '148_dH'        '148_dV'    '148'
    '149_dH'        '149_dV'    '149'
    '150_dH'        '150_dV'    '150'
    '151_dH'        '151_dV'    '151'
    '152_dH'        '152_dV'    '152'
    '153_dH'        '153_dV'    '153'
    '154_dH'        '154_dV'    '154'
    '155_dH'        '155_dV'    '155'
    '156_dH'        '156_dV'    '156'
    '157_dH'        '157_dV'    '157'


   };

----------------------------------
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20100910/9f2a65e7/attachment.html>


More information about the fieldtrip mailing list