<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Great! Thanks!</p>
<p>Using the code in the previous email I've extracted the time course of the <span>
Lausanne125 parcellation</span>. I just need to double check it.</p>
<p>Is your code on the mne-hcp github?</p>
<p><br>
</p>
<p>Thanks,</p>
<p>Noam<br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Sheraz Khan, PhD &lt;sheraz@nmr.mgh.harvard.edu&gt;<br>
<b>Sent:</b> Friday, October 20, 2017 6:21:41 PM<br>
<b>To:</b> Discussion and support forum for the users of MNE Software<br>
<b>Cc:</b> Discussion and support forum for the users of MNE Software; Peled, Noam<br>
<b>Subject:</b> Re: [Mne_analysis] extract label time course for resting state data</font>
<div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi Noam,<br>
<br>
Denis and me, work a lot on label representative time series, I have some<br>
adhoc code you might try.<br>
<br>
Thanks<br>
<br>
Sheraz<br>
<br>
<br>
&gt; Hi Noam,<br>
&gt;<br>
&gt; I think you might want to use the utils we engineered with Sheraz earlier<br>
&gt; this year. I will contribute them to MNE over the forthcoming months. But<br>
&gt; the API might change a bit as not everyone agrees that we should use<br>
&gt; mne.io.RawArray as terminal container for source rest time courses.<br>
&gt;<br>
&gt; Denis<br>
&gt; On Fri 20 Oct 2017 at 22:46, Peled, Noam &lt;NPELED@mgh.harvard.edu&gt; wrote:<br>
&gt;<br>
&gt;&gt; I ended up using the following code, instead of<br>
&gt;&gt; stc.extract_label_time_course:<br>
&gt;&gt;<br>
&gt;&gt; label_flip = mne.label_sign_flip(label, src)[:, None].squeeze()<br>
&gt;&gt; label_flip = np.tile(label_flip, (stc.data.shape[1], 1)).T<br>
&gt;&gt; label_tc = np.mean(label_flip * stc.data, axis=0)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; The problem was in the last line. originally it's:<br>
&gt;&gt;<br>
&gt;&gt; np.mean(flip * stc.data[vertidx, :], axis=0)<br>
&gt;&gt; Which doesn't work if the stc was calculated specifically for the label<br>
&gt;&gt; using<br>
&gt;&gt;<br>
&gt;&gt; mne.minimum_norm.apply_inverse_raw(<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; raw, inverse_operator, lambda2, inverse_method, label=label)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Does it make sense?<br>
&gt;&gt; Thanks,<br>
&gt;&gt;<br>
&gt;&gt; Noam<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ------------------------------<br>
&gt;&gt; *From:* mne_analysis-bounces@nmr.mgh.harvard.edu &lt;<br>
&gt;&gt; mne_analysis-bounces@nmr.mgh.harvard.edu&gt; on behalf of Peled, Noam &lt;<br>
&gt;&gt; NPELED@mgh.harvard.edu&gt;<br>
&gt;&gt; *Sent:* Friday, October 20, 2017 4:10:46 PM<br>
&gt;&gt; *To:* mne_analysis@nmr.mgh.harvard.edu<br>
&gt;&gt; *Subject:* [Mne_analysis] extract label time course for resting state<br>
&gt;&gt; data<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; I'm trying to extract the labels time course for a long resting state<br>
&gt;&gt; data<br>
&gt;&gt; (from HCP)<br>
&gt;&gt;<br>
&gt;&gt; What would be a good approach for that?<br>
&gt;&gt;<br>
&gt;&gt; I've tried first to use mne.minimum_norm.apply_inverse_raw, but it was<br>
&gt;&gt; too much for my computer and it crashed because of memory error.<br>
&gt;&gt;<br>
&gt;&gt; Then, I've tried to create an stc file for each label, to extract later<br>
&gt;&gt; the time course. But then I got the error that the stc is not compatible<br>
&gt;&gt; with source space, which it true.<br>
&gt;&gt;<br>
&gt;&gt; Maybe I should use the apply_inverse_raw each time for short windows? I<br>
&gt;&gt; prefer to get the full time course of each label if possible.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt;<br>
&gt;&gt; Noam<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Mne_analysis mailing list<br>
&gt;&gt; Mne_analysis@nmr.mgh.harvard.edu<br>
&gt;&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; The information in this e-mail is intended only for the person to whom<br>
&gt;&gt; it<br>
&gt;&gt; is<br>
&gt;&gt; addressed. If you believe this e-mail was sent to you in error and the<br>
&gt;&gt; e-mail<br>
&gt;&gt; contains patient information, please contact the Partners Compliance<br>
&gt;&gt; HelpLine at<br>
&gt;&gt; <a href="http://www.partners.org/complianceline">http://www.partners.org/complianceline</a> . If the e-mail was sent to you<br>
&gt;&gt; in<br>
&gt;&gt; error<br>
&gt;&gt; but does not contain patient information, please contact the sender and<br>
&gt;&gt; properly<br>
&gt;&gt; dispose of the e-mail.<br>
&gt;&gt;<br>
&gt; _______________________________________________<br>
&gt; Mne_analysis mailing list<br>
&gt; Mne_analysis@nmr.mgh.harvard.edu<br>
&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
<br>
<br>
-------------------------<br>
Sheraz Khan, M.Eng, Ph.D.<br>
Instructor in Neurology<br>
<br>
Athinoula A. Martinos Center for Biomedical Imaging<br>
Massachusetts General Hospital<br>
Harvard Medical School<br>
<br>
McGovern Institute for Brain Research<br>
Massachusetts Institute of Technology<br>
<br>
Tel:&nbsp;&nbsp; &#43;1 617-643-5634<br>
Fax:&nbsp;&nbsp; &#43;1 617-948-5966<br>
Email: sheraz@nmr.mgh.harvard.edu<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sheraz@mit.edu<br>
Web:&nbsp;&nbsp; <a href="http://sheraz.mit.edu">http://sheraz.mit.edu</a><br>
</div>
</span></font>
</body>
</html>