[FieldTrip] simultaneous artifact and ICA viewing in ft_databrowser
Stan van Pelt
s.vanpelt at fcdonders.ru.nl
Mon Oct 6 11:46:55 CEST 2014
For everyone's information, I have found a solution based on a post some 4
years ago related to ft_resampledata
(http://mailman.science.ru.nl/pipermail/fieldtrip/2010-September/003095.ht
ml).
To make the ICA and artifact data align, the trl-field of the ICA-data
needs to be 'resampled', as well as the artifact-samples:
% i. Downsample data
resamplefs = 150;
cfg = [];
cfg.resamplefs = resamplefs;
cfg.detrend = 'no';
data150 = ft_resampledata(cfg, data);
% 'Downsample' trial information to make trial start/end samplenrs
correspond to artifact samplenrs
data150.cfg.previous.trl(:,1:3) =
round(data150.cfg.previous.trl(:,1:3) * (1/fs) * resamplefs);
% ii. run ICA on downsampled data
cfg = [];
cfg.method = 'runica'; % this is the default and uses the
implementation from EEGLAB
cfg.channel = 'MEG';
cfg.runica.maxsteps = 120;
eval(['comp150',num2str(n),'= ft_componentanalysis(cfg, data150);']);
% iii. plot the components for visual inspection and select bad
components
cfg = [];
cfg.component = [1:10]; % components to be plotted
cfg.layout = 'CTF275.lay'; % specify the layout file that should
be used for plotting
% add preveiously manually defined eog and muscle artifacts, to
compare with components
load artifact_eog_all
load artifact_muscle_all
cfg.artfctdef.eog.artifact=ceil(art_eog_all*(resamplefs/fs)); %
'resample' artifact data
cfg.artfctdef.muscle.artifact=ceil(art_muscle_all*(resamplefs/fs)); %
'resample' artifact data
% visual inspection
ft_databrowser(cfg, comp150',num2str(n),');
% 'Upsample' trial information again to original
data150.cfg.previous.trl(:,1:3) = data.cfg.trl(:,1:3);
Best,
Stan
From: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Stan van Pelt
Sent: maandag 6 oktober 2014 9:17
To: 'FieldTrip discussion list'
Subject: [FieldTrip] simultaneous artifact and ICA viewing in
ft_databrowser
Dear fellow FieldTrippers,
For proper artifact removal, I would like to compare the (temporal)
correspondence between the ICA components of my (CTF MEG275) data and the
artifacts that I semi-automatically identified beforehand (eye blinks,
saccades, muscle tension). ft_databrowser in principle allows me to show
this, but I run into some problems that I think have to do with data
resampling. The code I use is:
% iii. plot the components for visual inspection and select bad components
cfg = [];
cfg.component = [1:10]; % components to be plotted
cfg.layout = 'CTF275.lay'; % specify the layout file that should be
used for plotting
% add preveiously manually defined eog and muscle artifacts, to compare
with components
load artifact_eog_all
load artifact_muscle_all
cfg.artfctdef.eog.artifact=art_eog_all;
cfg.artfctdef.muscle.artifact=art_muscle_all;
% visual inspection
ft_databrowser(cfg, comp150);
The problem I have is that the artifacts are not shown at the right
moments in time during the experiment. The data that are ICA-ed are
resampled from 1200->150Hz, but I do not know how I can 'resample' the
artifact definitions, since they are defined in samples, not in time. If I
manually resample (by dividing the values by a factor 8), they are still
not displayed at the correct moments in time.
I have the impression that convert_event (fieltrip/private) could be of
use here, but I cannot figure it out correctly.
Best,
Stan
--
Stan van Pelt, PhD
Donders Institute for Brain, Cognition and Behaviour
Radboud University
Montessorilaan 3, B.01.34
6525 HR Nijmegen, the Netherlands
tel: +31 24 3616288
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141006/164fa326/attachment.html>
More information about the fieldtrip
mailing list