[FieldTrip] why the dipole moment is zero?

pooja prabhu prabhuppooja at gmail.com
Fri Oct 30 11:34:41 CET 2020


Hai List,
I was trying to fit the dipole for MEG gradiometers data. I'm registering
MEG and MRI by providing the x, y, z coordinates manually. I am getting the
correct coregistered output.
For localizing the N35 ( at 35 ms) activity, I am using the dipole fitting.
I am getting the position of the dipole but I do not see the dipole moment
(in the code, source_planar.dip.mom=(0,0,0)).
I have pasted the snippet below which is been used to fit the dipole. Can
someone help me in rectifying the problem?
Thank You


%% CO-REGISTER MR-IMAGE TO FIDUCIALS
cfg = [];
cfg.method = 'fiducial';
cfg.fiducial.nas=[x, y, z];
cfg.fiducial.lpa=[a, b, c];
cfg.fiducial.rpa=[l , m, n];
cfg.coordsys = 'neuromag';
mri_realigned_fiducials= ft_volumerealign(cfg, mri);


%% CO-REGISTER TO DIGITIZATION POINTS
meg='path\subject_ssep_avg_tsss.fif';
headshape = ft_read_headshape(meg);
cfg = [];
cfg.method              = 'headshape';
cfg.headshape.headshape = headshape;
cfg.coordsys            = 'neuromag';
mri_realigned_digitization_points = ft_volumerealign(cfg,
mri_realigned_fiducials);

%% SEGMENT IMAGE INTO BRAIN, SKULL AND SCALP
cfg = []; %% initialize
cfg.output = {'brain' 'skull' 'scalp'};
mri_segmented = ft_volumesegment(cfg, mri_realigned_digitization_points);

%% CREATE BRAIN MESH

cfg = []; %% initialize
cfg.method = 'projectmesh';
cfg.tissue = 'brain';
cfg.numvertices = 5000;
brain_mesh = ft_prepare_mesh(cfg, mri_segmented);


%% CREATE HEADMODEL
cfg = []; %% initialize
cfg.method = 'singleshell';
headmodel = ft_prepare_headmodel(cfg, brain_mesh);

%% CREATE GRID WARPED TO STANDARD MNI BRAIN
cfg = []; %% initialize
cfg.grid.warpmni = 'yes';
cfg.grid.template =
'C:\Users\mca\Documents\MATLAB\fieldtrip-20181129\template\sourcemodel\standard_sourcemodel3d10mm.mat';
cfg.grid.nonlinear = 'yes';
cfg.grid.unit = 'mm';
cfg.mri = mri;
warped_grid = ft_prepare_sourcemodel(cfg)



%% CREATE LEADFIELD
cfg = []; %% initialize
cfg.channel = {'MEGGRAD'};
sensors = ft_read_sens((meg), 'senstype', 'meg');
cfg.grad = sensors;
cfg.grid = warped_grid;
cfg.headmodel = headmodel;
% cfg.normalize='yes';
leadfield = ft_prepare_leadfield(cfg);

%% source space
cfg = [];
cfg.dataset = meg;
cfg.continuous    = 'yes';
cfg.bpfilter      = 'no';
cfg.demean        = 'yes';
cfg.baselinewindow = [-inf 0];
cfg.bpfreq       = [1 100];
cfg.channel       = 'MEGGRAD';
cfg.precision     = 'single';
data_meg = ft_preprocessing(cfg);

%selecting the segment of time series after viewing butterfly plot
cfg = [];
cfg.toilim = [0.034 0.036];
data_post = ft_redefinetrial(cfg, data_meg);

 %timelock analysis
cfg             = [];
cfg.channel     = 'MEGGRAD';
cfg.covariance='yes';
% tlck_pre = ft_timelockanalysis(cfg, data_pre);
tlck_post = ft_timelockanalysis(cfg, data_post);


%% ECD

cfg = [];
cfg.resolution = 1;
mri_resliced = ft_volumereslice(cfg, mri_realigned_digitization_points);
mri_resliced_cm = ft_convert_units(mri_resliced, 'cm');

cfg = [];
cfg.latency = [0.035 0.036];
cfg.numdipoles =1;
% cfg.symmetry = 'x';
cfg.grid.resolution = 1;
cfg.grid.unit = 'cm';
cfg.gridsearch = 'yes';
cfg.headmodel = headmodel;
cfg.senstype = 'meg';
 cfg.channel = 'MEGGRAD';
source_planar = ft_dipolefitting(cfg, tlck_post);



%%plotting the dipole
figure
hold on

ft_plot_dipole(source_planar.dip.pos(1,:),
mean(source_planar.dip.mom(1:3,:),2), 'color', 'g')
pos = mean(source_planar.dip.pos,1);
ft_plot_slice(mri_resliced_cm.anatomy, 'transform',
mri_resliced_cm.transform, 'location', pos, 'orientation', [1 0 0],
'resolution', 0.1)
ft_plot_slice(mri_resliced_cm.anatomy, 'transform',
mri_resliced_cm.transform, 'location', pos, 'orientation', [0 1 0],
'resolution', 0.1)
ft_plot_slice(mri_resliced_cm.anatomy, 'transform',
mri_resliced_cm.transform, 'location', pos, 'orientation', [0 0 1],
'resolution', 0.1)
ft_plot_crosshair(pos, 'color', [1 1 1]/2);
axis tight
axis off
view(12, -10)
















-- 
Thank You
Pooja Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201030/0558f6b0/attachment.htm>


More information about the fieldtrip mailing list