[Mne_analysis] [MNE-analysis] stc files to text/csv

Sheraz Khan, PhD sheraz at nmr.mgh.harvard.edu
Thu Mar 2 13:10:46 EST 2017
Search archives:

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



> 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
>
> ________________________________
> From: alexandre.gramfort at gmail.com <alexandre.gramfort at gmail.com> on
> behalf of Alexandre Gramfort <alexandre.gramfort at telecom-paristech.fr>
> Sent: Tuesday, February 28, 2017 10:55:49 AM
> To: Discussion and support forum for the users of MNE Software
> Cc: Lyam Bailey
> Subject: Re: [Mne_analysis] [MNE-analysis] stc files to text/csv
>
> 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
>
> On Mon, Feb 27, 2017 at 10:29 PM, Lyam Bailey <Lyam.Bailey at dal.ca> wrote:
>> 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!
>>
>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> The information in this e-mail is intended only for the person to whom
>> it is
>> addressed. If you believe this e-mail was sent to you in error and the
>> e-mail
>> contains patient information, please contact the Partners Compliance
>> HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you
>> in
>> error
>> but does not contain patient information, please contact the sender and
>> properly
>> dispose of the e-mail.
>>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis


-------------------------
Sheraz Khan, M.Eng, Ph.D.
Instructor in Neurology

Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Harvard Medical School

McGovern Institute for Brain Research
Massachusetts Institute of Technology

Tel:   +1 617-643-5634
Fax:   +1 617-948-5966
Email: sheraz at nmr.mgh.harvard.edu
       sheraz at mit.edu
Web:   http://sheraz.mit.edu


More information about the Mne_analysis mailing list