<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=NL link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>For everyone’s information, I have found a solution based on a post some 4 years ago related to ft_resampledata (<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2010-September/003095.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2010-September/003095.html</a>).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>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:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> % i. Downsample data<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> resamplefs = 150;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg = [];<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.resamplefs = resamplefs;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.detrend = 'no';<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> data150 = ft_resampledata(cfg, data);<o:p></o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='color:#1F497D'> % ‘Downsample’ trial information to make trial start/end samplenrs correspond to artifact samplenrs <o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='color:#1F497D'> data150.cfg.previous.trl(:,1:3) = round(data150.cfg.previous.trl(:,1:3) * (1/fs) * resamplefs); <o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> % ii. run ICA on downsampled data<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg = [];<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.method = 'runica'; % this is the default and uses the implementation from EEGLAB<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.channel = 'MEG';<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.runica.maxsteps = 120;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> eval(['comp150',num2str(n),'= ft_componentanalysis(cfg, data150);']);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> % iii. plot the components for visual inspection and select bad components<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg = [];<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.component = [1:10]; % components to be plotted<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> cfg.layout = 'CTF275.lay'; % specify the layout file that should be used for plotting<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> % add preveiously manually defined eog and muscle artifacts, to compare with components<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> load artifact_eog_all<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> load artifact_muscle_all<o:p></o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='color:#1F497D'> cfg.artfctdef.eog.artifact=ceil(art_eog_all*(resamplefs/fs)); % ‘resample’ artifact data<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='color:#1F497D'> cfg.artfctdef.muscle.artifact=ceil(art_muscle_all*(resamplefs/fs)); % ‘resample’ artifact data<o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> % visual inspection<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> ft_databrowser(cfg, comp150',num2str(n),');<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='color:#1F497D'> % ‘Upsample’ trial information again to original <o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-US style='color:#1F497D'> data150.cfg.previous.trl(:,1:3) = data.cfg.trl(:,1:3);<o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Stan<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> fieldtrip-bounces@science.ru.nl [mailto:fieldtrip-bounces@science.ru.nl] <b>On Behalf Of </b>Stan van Pelt<br><b>Sent:</b> maandag 6 oktober 2014 9:17<br><b>To:</b> 'FieldTrip discussion list'<br><b>Subject:</b> [FieldTrip] simultaneous artifact and ICA viewing in ft_databrowser<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>Dear fellow FieldTrippers,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>% iii. plot the components for visual inspection and select bad components<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>cfg = [];<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>cfg.component = [1:10]; % components to be plotted<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>cfg.layout = 'CTF275.lay'; % specify the layout file that should be used for plotting<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>% add preveiously manually defined eog and muscle artifacts, to compare with components <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>load artifact_eog_all<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>load artifact_muscle_all <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>cfg.artfctdef.eog.artifact=art_eog_all;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>cfg.artfctdef.muscle.artifact=art_muscle_all;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>% visual inspection<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ft_databrowser(cfg, comp150);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I have the impression that convert_event (fieltrip/private) could be of use here, but I cannot figure it out correctly.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Stan<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>--<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Stan van Pelt, PhD<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Donders Institute for Brain, Cognition and Behaviour<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Radboud University<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Montessorilaan 3, B.01.34<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>6525 HR Nijmegen, the Netherlands<o:p></o:p></span></p><p class=MsoNormal>tel: +31 24 3616288 <o:p></o:p></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>