<div dir="ltr">I'm hesitant to say impossible, but I'm not sure how to do it off-hand. Also, there may be some other complications, now that I think I understand your situation better.<div><br></div><div>If you're trying to cut based on the buttonpresses, which are inconsistent/unreliable, any large number of trials would make it impractical to define/redefine your epoch for each one, especially since this process would need to be customized for each subject. It might be better to keep it in a larger window, or come up with a few general windows to encompass, for instance 'early', 'on target', and 'late' button press windows.</div>
<div><br></div><div>For all of the experiments I've worked on in which we've used / are using fieldtrip for our data analysis pipeline, we've never used behavioral responses for anything other than a control (as in, lack of response or incorrect response leads to rejecting the trial), so I don't really know if there is a particular systematic way to incorporate behavioral or floating triggers like what you seem to be looking to do.</div>
<div><br></div><div>I might suggest, though keep in mind this is entirely speculative, rather than trying to create a pinpoint window around the response, that instead you use a wide window, and then either by viewing the data, or perhaps using independent component analysis, try to pinpoint for each subject when the button press may have occurred based on some kind of muscle artifact, and then in later timelock/time-frequency/statistical analyses specify that time window. Again, that is just me spitballing, but something post-processing may be a better solution, if the behavioral response is pivotal to the analysis of your experiment and not just for making sure the subject was paying attention / understands the prompt, as in the experiments I've worked on.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 5:02 PM, KatrinH Heimann <span dir="ltr"><<a href="mailto:katrinheimann@gmail.com" target="_blank">katrinheimann@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi! Guys, your help is so much appreciated!<div>So I try to be more clear!: </div><div>So, yeah, Max, you are right! At the end I would like to use two different triggervalues.</div>
<div><br>
</div><div>If I would use twice ft_definetrial then it would look like this:</div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">cfg                     = [];</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cfg.dataset             = <span style="color:rgb(39,42,216)">'1.raw'</span>;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cfg.trialfun            = <span style="color:rgb(39,42,216)">'ft_trialfun_general'</span>; </p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cfg.trialdef.eventtype  = <span style="color:rgb(39,42,216)">'trigger'</span>;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cfg.trialdef.eventvalue = <span style="color:rgb(39,42,216)">'stim'</span>; % the value of the stimulus trigger <font color="#bb2ca2">for the beginning of baseline</font></p>


<p style="margin:0px;font-size:11px;font-family:Menlo">cfg.trialdef.prestim    = <span style="color:rgb(39,42,216)">0.5</span>;  %the time of the fixation cross</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cfg.trialdef.poststim   = 1<span style="color:rgb(39,42,216)">.5</span>; %the time of the baseline (plus 0.5 buffer)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">cfg                = ft_redefinetrial(cfg);</p><p style="margin:0px;font-size:11px;font-family:Menlo"><br></p><p style="margin:0px;font-size:11px;font-family:Menlo">

This baselinedata I could easily baselinecorrect using 100 ms of the fixationcrossperiod:</p><p style="margin:0px"></p><p style="font-family:Menlo;font-size:11px;margin:0px"><br></p>
<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.channel    = <span style="color:rgb(39,42,216)">'all'</span>;</p>
<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.preproc.demean = <span style="color:rgb(39,42,216)">'yes'</span>;</p>
<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.preproc.baselinewindow = [-<span style="color:rgb(39,42,216)">0.1</span> <span style="color:rgb(39,42,216)">0</span>]</p>
<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.preproc.bpfilter = <span style="color:rgb(39,42,216)">'yes'</span>;</p>
<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.preproc.bpfreq = [<span style="color:rgb(39,42,216)">6</span> <span style="color:rgb(39,42,216)">32</span>];</p>
<p style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br></p><p style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px">The stimulusdata would be defined using a trigger that corresponds to a button press:</p>

<p style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br></p><p style="margin:0px;min-height:13px"></p><p style="font-family:Menlo;font-size:11px;margin:0px">cfg                     = [];</p><p style="font-family:Menlo;font-size:11px;margin:0px">

cfg.dataset             = <span style="color:rgb(39,42,216)">'1.raw'</span>;</p><p style="font-family:Menlo;font-size:11px;margin:0px">cfg.trialfun            = <span style="color:rgb(39,42,216)">'ft_trialfun_general'</span>; </p>

<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.trialdef.eventtype  = <span style="color:rgb(39,42,216)">'trigger'</span>;</p><p style="margin:0px"><font face="Menlo"><span style="font-size:11px">cfg.trialdef.eventvalue = </span></font><font color="#272ad8" face="Menlo"><span style="font-size:11px">'resp'</span></font><font face="Menlo"><span style="font-size:11px">; % the value of the stimulus trigger </span></font><font color="#bb2ca2" style="font-family:Menlo;font-size:11px">for the beginning of baseline</font></p>

<p style="font-family:Menlo;font-size:11px;margin:0px">cfg.trialdef.prestim    = <font color="#272ad8">0.5</font>;  % 0.5 sec before button press</p><p style="font-family:Menlo;font-size:11px;margin:0px">cfg.trialdef.poststim   = 1<span style="color:rgb(39,42,216)">.5</span>; % 1.5 sec after button press (time that I wanna analyse)</p>

<p style="font-family:Menlo;font-size:11px;margin:0px">cfg                = ft_redefinetrial(cfg);</p><p style="font-family:Menlo;font-size:11px;margin:0px"><br></p><p style="font-family:Menlo;font-size:11px;margin:0px">
</p>
<p style="font-family:Menlo;font-size:11px;margin:0px">However here I have the problem that I cannot correct with the same baseline than before as the buttonpress is not always at the same time so I don't know when the fixationcrossperiod is located...</p>

<p style="font-family:Menlo;font-size:11px;margin:0px"><br></p><p style="font-family:Menlo;font-size:11px;margin:0px">So I thought I could first "cut" bigger pieces and then redefine trials by cutting again (after the preprocessing), then with different eventvalues ... </p>

<p style="font-family:Menlo;font-size:11px;margin:0px">But you say that is not possible?</p><p style="font-family:Menlo;font-size:11px;margin:0px"><br></p><p style="font-family:Menlo;font-size:11px;margin:0px"><br></p><p style="font-family:Menlo;font-size:11px;margin:0px">

Thanks a lot for your help!!!</p><p style="font-family:Menlo;font-size:11px;margin:0px"><br></p><p style="font-family:Menlo;font-size:11px;margin:0px">Katrin</p><p style="font-family:Menlo;font-size:11px"></p><p></p><p></p>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-27 21:05 GMT+02:00 Max Cantor <span dir="ltr"><<a href="mailto:mcantor@umich.edu" target="_blank">mcantor@umich.edu</a>></span>:<div><div class="h5">
<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Ya, it would definitely help if we could see your code, but I might have another idea.<div><br></div><div>When you say you have a fixation cross trigger, is this trigger being recorded from your EEG recording equipment in such a way that it can be represented as an event value in cfg.trialdef for ft_definetrial? If so, I think you may be right that it can't be changed through ft_redefinetrial (at least, as far as I can tell, no mention of this is made in the help section of the function). That being said, if you run ft_definetrial separately for both event values that should work. </div>


<div><br></div><div>That being said, I may still be slightly confused about what you mean when you say you want to change the trigger. Do you mean you want to create a new trigger for your data off-line? I think it may be possible to create custom triggers off-line through fieldtrip, but it's not something I've tried personally, but if that is what you are trying to do, I could look into it.</div>


</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 2:44 PM, kousik sarathy <span dir="ltr"><<a href="mailto:sarathykousik@gmail.com" target="_blank">sarathykousik@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey Katrin,<div><br></div><div>It seems to me that Max's suggestion would suffice. But you seem to be looking for something else. Could you elaborate a little bit as to what you need? </div>


<div class="gmail_extra">

<br clear="all"><div><div dir="ltr"><div><font color="#000000">--</font></div><div><font color="#000000">Regards,<br></font></div><div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><div style="text-align:left">




<font color="#000000">Kousik Sarathy, S</font></div></span></div><div style="text-align:left"><br></div></div></div><div><div>
<br><br><div class="gmail_quote">On Tue, May 27, 2014 at 8:30 PM, KatrinH Heimann <span dir="ltr"><<a href="mailto:katrinheimann@gmail.com" target="_blank">katrinheimann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">Dear Max, thanks a lot for your prompt answer. Unfortunately this is not what I am looking for (I found an example like this in the tutorial). I would like to change the trigger for one of the two conditions, let it be now the response of the subject, as this is where the stimulus actually starts... Defining two different timewindows is not enough... Can you also help me with that? Thanks a million! Katrin</div>





<div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-27 18:58 GMT+02:00 Max Cantor <span dir="ltr"><<a href="mailto:mcantor@umich.edu" target="_blank">mcantor@umich.edu</a>></span>:<div><div>

<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Katrin,<div><br></div><div>It may help to see your code, but hopefully this will help. It should be as simple as taking your epoched data from ft_definetrial and ft_preprocessing, then creating two configurations for your timewindows and running ft_redefinetrial.</div>






<div><br></div><div>For example (from the fieldtrip tutorial, slightly simplified by me for explanatory purposes):</div><div><br></div><div>***</div><div><br></div><div><div>% find the interesting segments of data</div><div>






<br></div><div>cfg                             = [];                                                      % empty configuration</div><div>cfg.dataset                 = 'Subject01.ds';                                    % name of CTF dataset  </div>






<div>cfg.trialdef.eventtype    = 'backpanel trigger';</div><div>cfg.trialdef.prestim       = 1;</div><div>cfg.trialdef.poststim     = 2;</div><div>cfg.trialdef.eventvalue   = 3;                                                       % event value of FIC</div>






<div>cfg                             = ft_definetrial(cfg);            </div><div>  </div><div>% preprocess the data</div><div><br></div><div>cfg.channel                 = {'MEG'};                     </div><div>





dataFIC                      = ft_preprocessing(cfg);<br>
</div><div><br></div><div>% define time window</div><div><br></div><div>cfg                            = [];                                           </div><div>cfg.toilim                   = [-0.5 0];                       </div>






<div>dataPre                     = ft_redefinetrial(cfg, dataFIC);</div><div>   </div><div>cfg.toilim                   = [0.8 1.3];                       </div><div>dataPost                   = ft_redefinetrial(cfg, dataFIC);</div>






</div><div><br></div><div>***</div><div><br></div><div>So if your code resembles this, you are defining in cfg.trialdef.prestim and cfg.trialdef.poststim a timewindow that encompasses both your baseline period and stimulus period, then for cfg.toilim in the ft_redefinetrial section you are setting one to your baseline period and the other to your stimulus period, and outputting them into separate variables.</div>






<div><br></div><div>Hopefully this helps. Also, if you haven't done so already, I would strongly recommend you run through the tutorial, as it may help answer questions like this in the future (assuming I've properly identified the issue).</div>






<div><br></div><div>Good luck,</div><div><br></div><div>Max</div><div><br></div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Tue, May 27, 2014 at 12:10 PM, KatrinH Heimann <span dir="ltr"><<a href="mailto:katrinheimann@gmail.com" target="_blank">katrinheimann@gmail.com</a>></span> wrote:<br>






</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Dear all,<div><br></div><div>my name is Katrin Heimann, I am phd student at the University of Parma. New to Fieldtrip.</div>






<div>I am doing an EEG analysis, still in the preprocessing phase. </div>
<div>It is a within trials design. I would like to compare a baseline period with an experimental condition (visual stimulus).</div><div><br></div><div> I have a trigger after a fixation cross, then a baseline period (approx 1 sec) , then the period of my stimulus (1 sec- starting with a bottom press (trigger)).</div>







<div><br></div><div> As I would like to apply the same baseline correction for both (the fixationcross period)  I planned to first define my trials as long trials including the timewindows of baseline and the stimulus period, applying filter and baselinecorrection on those long pieces. However, as I do not wanna do the artifact detection on the whole pieces (but seperately for baseline and stimulus, to avoid that I have to throw away too many trials) I would like to redefine my trials then, cutting out only baseline period and only stimulus period (starting with another trigger (triggervalue=resp).. </div>







<div><br></div><div><b>Unfortunately I do not understand how I can change the trigger used with ft redefine trial. </b></div><div><br></div><div>Anybody who could give me an example how that is done?</div>
<div>Thanks a million</div><div>Katrin</div></div>
<br></div></div>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><span><font color="#888888"><br></font></span></blockquote></div>
<span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">
Max Cantor<div>Research Assistant</div><div>Computational Neurolinguistics Lab</div><div>University of Michigan</div></div>
</font></span></div></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">


Max Cantor<div>Research Assistant</div><div>Computational Neurolinguistics Lab</div><div>University of Michigan</div></div>
</div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">
Max Cantor<div>Research Assistant</div><div>Computational Neurolinguistics Lab</div><div>University of Michigan</div></div>
</div>