extract label time course for resting state data

Hi all,

I'm trying to extract the labels time course for a long resting state data (from HCP)

What would be a good approach for that?

I've tried first to use mne.minimum_norm.apply_inverse_raw, but it was too much for my computer and it crashed because of memory error.

Then, I've tried to create an stc file for each label, to extract later the time course. But then I got the error that the stc is not compatible with source space, which it true.

Maybe I should use the apply_inverse_raw each time for short windows? I prefer to get the full time course of each label if possible.

Thanks,

Noam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171020/40630ef3/attachment.html

I ended up using the following code, instead of stc.extract_label_time_course:

label_flip = mne.label_sign_flip(label, src)[:, None].squeeze()
label_flip = np.tile(label_flip, (stc.data.shape[1], 1)).T
label_tc = np.mean(label_flip * stc.data, axis=0)

The problem was in the last line. originally it's:

np.mean(flip * stc.data[vertidx, :], axis=0)

Which doesn't work if the stc was calculated specifically for the label using

mne.minimum_norm.apply_inverse_raw(
    raw, inverse_operator, lambda2, inverse_method, label=label)

Does it make sense?
Thanks,

Noam

Hi Noam,

I think you might want to use the utils we engineered with Sheraz earlier
this year. I will contribute them to MNE over the forthcoming months. But
the API might change a bit as not everyone agrees that we should use
mne.io.RawArray as terminal container for source rest time courses.

Denis

Hey Denis!

Do you mean the mne-hcp? Of course I'm using it, you saved my life!

I found a very helpful example for analyzing task data, but not the rest data. Is there something like that? I kinda browsed most of the code ?

Thanks,

Noam

Hi Noam,

Denis and me, work a lot on label representative time series, I have some
adhoc code you might try.

Thanks

Sheraz

Great! Thanks!

Using the code in the previous email I've extracted the time course of the Lausanne125 parcellation. I just need to double check it.

Is your code on the mne-hcp github?

Thanks,

Noam

Its on GitHub but in private repository :slight_smile:

I can email you the relevant sections.

Thanks

Sheraz