[MNE-analysis] stc files to text/csv

Dear MNE users,

I'm attempting to run source localisation on evoked MEG data from multiple subjects, however I'm relatively new to MNE so in need of guidance. So far I've computed LCMV beamformer on each subject, and generated a .stc file for each. Next I morphed each .stc file to an average brain surface.

I would like to somehow read/extract amplitudes from the .stc files into a text/csv format for group analysis purposes - ideally in a way which specifies timecourse, ROI (I already have .label files ready) and condition. I'd be grateful if someone can point me towards an existing Python script / offer any advice on how to proceed.

Thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170227/90c5535a/attachment.html

hi,

to go from label to a single time course you can use:

http://martinos.org/mne/stable/generated/mne.extract_label_time_course.html#mne.extract_label_time_course

to access time courses from stc use stc.data

to write an array to text or .csv use numpy.savetxt

https://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html

HTH
Alex

Thanks for the help!

I've extracted the time course for the label using mne.extract_label_time_course, and I can write the resulting stc.data to a text file using np.savetxt

So currently this gives me a huge array of values (each one, I believe, representing a different timepoint). Is there a way to specify the 'time step' between successive values in the extracted timecourse? For example, if I only wanted to sample values at 100ms, 200ms and 300ms?

Regards

Lyam

You can always do something like this

label_times =
np.array([stc.copy().crop(.1,.1).extract_label_time_course(label, src,
mode='pca_flip'),stc.copy().crop(.2,.2).extract_label_time_course(label,
src, mode='pca_flip')])

np.savetxt('label_times.txt',label_times)

HTH

Sheraz