<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<STYLE type=text/css> <!--@import url(scrollbar.css); --></STYLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>                        body{FONT-SIZE:12pt; FONT-FAMILY:宋体,serif;}                </STYLE>
<META name=GENERATOR content="MSHTML 8.00.7601.18283"><BASE
target=_blank></HEAD>
<BODY
style="LINE-HEIGHT: 1.3; BORDER-RIGHT-WIDTH: 0px; MARGIN: 12px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px"
marginheight="0" marginwidth="0">
<DIV><FONT color=#000000 size=4 face=宋体>Hi Alex, </FONT></DIV>
<DIV>Thank you very much! </DIV>
<DIV>The following link tells us how to define events. Thanks </DIV>
<DIV><A
href="http://martinos.org/mne/stable/manual/browse.html#babdfaha">http://martinos.org/mne/stable/manual/browse.html#babdfaha</A></DIV>
<DIV> </DIV>
<DIV>Best wishes, </DIV>
<DIV>Junpeng</DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana>2014-03-19</FONT></DIV>
<DIV align=left><FONT size=2 face=Verdana>
<HR style="WIDTH: 122px; HEIGHT: 2px" id=SignNameHR align=left SIZE=2>
</FONT></DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana><SPAN
id=_FlashSignName>junpeng.zhang</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Verdana>
<HR>
</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>发件人:</STRONG>Alexandre Gramfort
<alexandre.gramfort@telecom-paristech.fr></FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>发送时间:</STRONG>2014-03-19 20:07</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>主题:</STRONG>Re: Re: [Mne_analysis] how to
extract the label time series using MNE-toolbox</FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>收件人:</STRONG>"junpeng.zhang"<junpeng.zhang@gmail.com></FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>抄送:</STRONG>"mne_analysis@nmr.mgh.harvard.edu"<mne_analysis@nmr.mgh.harvard.edu></FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT> </DIV>
<DIV><FONT size=2 face=Verdana>
<DIV>hi Junpeng, </DIV>
<DIV> </DIV>
<DIV>you need to define events visually/manually in mne_browse_raw </DIV>
<DIV> </DIV>
<DIV>HTH </DIV>
<DIV>A </DIV>
<DIV> </DIV>
<DIV>On Wed, Mar 19, 2014 at 12:47 PM, junpeng.zhang <junpeng.zhang@gmail.com> wrote: </DIV>
<DIV>> Hi Alex, </DIV>
<DIV>> </DIV>
<DIV>> Thank you for kind response. </DIV>
<DIV>> I still have a question. Please see the highlighted fonts. </DIV>
<DIV>> </DIV>
<DIV>> </DIV>
<DIV>>> Recently I am conducting an epilepy MEG analysis project. </DIV>
<DIV>>> I used MNE toolbox to create a cortex constrained source space (5891 </DIV>
<DIV>>> sources) and calculated the lead fead matrix (free orientaion, 5891 </DIV>
<DIV>>> (sources) x 3 (directions xyz) x 306 (channels) matrix ). </DIV>
<DIV>>> By on house code, I applied the inverse problem (beamformer) operator to </DIV>
<DIV>>> a </DIV>
<DIV>>> segment of epileptiform MEG and then got a 5891 (sources) x 3 (directions) </DIV>
<DIV>>> x </DIV>
<DIV>>> 500 (time points) matrix (SDTM), which is source time series. </DIV>
<DIV>> </DIV>
<DIV>> so you have 3 time series per location. Which is not make stc contain. </DIV>
<DIV>> </DIV>
<DIV>>> My questions are as, </DIV>
<DIV>>> 1) how to get the information on which source belong to which regions by </DIV>
<DIV>>> label operations (for example source A is included in temporal cortex). </DIV>
<DIV>>> If </DIV>
<DIV>>> I got such information, I can get a collective time series for a region by </DIV>
<DIV>>> averaging (or other ways to get a representative time series) all the </DIV>
<DIV>>> source </DIV>
<DIV>>> time series in this region. anyone have a quick code to share it to me? </DIV>
<DIV>> </DIV>
<DIV>> if you use instances of SourceEstimates (stc objects) you can use labels. </DIV>
<DIV>> I assume you use a surface source space. You can look at the code </DIV>
<DIV>> of the in_label method. </DIV>
<DIV>> </DIV>
<DIV>> http://martinos.org/mne/stable/generated/mne.SourceEstimate.html#mne.SourceEstimate.in_label </DIV>
<DIV>> </DIV>
<DIV>>> 2) epileptiform MEG is difficult to average. and for such MEG, we have </DIV>
<DIV>>> only </DIV>
<DIV>>> one "trial". MNE python is quite suitable to process multiple trials MEG </DIV>
<DIV>>> data. How to use the several functions to process single "trials" </DIV>
<DIV>>> epileptiform MEG? </DIV>
<DIV>>> for example, </DIV>
<DIV>>> if I know SDTM in matlab format, how to use it as the input of the </DIV>
<DIV>>> function </DIV>
<DIV>>> mne.extract_label_time_course? </DIV>
<DIV>>> The stcs para equals to the SDTM? </DIV>
<DIV>> </DIV>
<DIV>> you can get an Evoked instance by average a single Epoch. </DIV>
<DIV>> I ever tried to create a instance but in the epilepy raw data, there is no </DIV>
<DIV>> any events writed in the file. </DIV>
<DIV>> When I import a .eve file, the error will be no event to average... </DIV>
<DIV>> How to transform a raw.fif into a ave.fif when the raw file has no events </DIV>
<DIV>> indicated? </DIV>
<DIV>> My epilepsy raw file info: 11s ----702s. </DIV>
<DIV>> </DIV>
<DIV>> Best wishes, </DIV>
<DIV>> Junpeng Zhang </DIV>
<DIV>> </DIV>
<DIV>> </DIV>
<DIV>>> The following is the three examples for the functions extracted from </DIV>
<DIV>>> </DIV>
<DIV>>> http://martinos.org/mne/stable/auto_examples/connectivity/plot_mne_inverse_label_connectivity.html#example-connectivity-plot-mne-inverse-label-connectivity-py </DIV>
<DIV>>> </DIV>
<DIV>>> stcs = apply_inverse_epochs(epochs, inverse_operator, lambda2, method, </DIV>
<DIV>>> pick_ori="normal", return_generator=True) </DIV>
<DIV>>> </DIV>
<DIV>>> # Get labels for FreeSurfer 'aparc' cortical parcellation with 34 </DIV>
<DIV>>> labels/hemi </DIV>
<DIV>>> labels, label_colors = mne.labels_from_parc('sample', parc='aparc', </DIV>
<DIV>>> subjects_dir=subjects_dir) </DIV>
<DIV>>> </DIV>
<DIV>>> # Average the source estimates within each label using sign-flips to </DIV>
<DIV>>> reduce </DIV>
<DIV>>> # signal cancellations, also here we return a generator </DIV>
<DIV>>> src = inverse_operator['src'] </DIV>
<DIV>>> label_ts = mne.extract_label_time_course(stcs, labels, src, </DIV>
<DIV>>> mode='mean_flip', </DIV>
<DIV>>> return_generator=True) </DIV>
<DIV>> </DIV>
<DIV>> it does not make sense to you mean_flip unless you have fixed orient </DIV>
<DIV>> source space </DIV>
<DIV>> or used pick_ori='normal'. You can just average you have positive </DIV>
<DIV>> values in the stc. </DIV>
<DIV>> </DIV>
<DIV>> Hope this helps, </DIV>
<DIV>> </DIV>
<DIV>> Alex </DIV></FONT></DIV></BODY></HTML>