[Mne_analysis] how to save source estamates from sphere label generated by mne.label.grow_labels
David Leitman
leitman at mail.med.upenn.edu
Tue Jan 14 13:03:43 EST 2014
Hi Alex,
sorry to keep on pestering but, in trying to grow my label i do the following and get the following result:
# read inverse solution
stc = mne.read_source_estimate(fname_meeg_stc)
# load the anatomical ROI
anat_label1 = mne.labels_from_parc(subject, parc='aparc',
subjects_dir=data_path,
regexp='superiortemporal-rh')[0][0]
# extract the anatomical time course for each label
stc_anat_label1 = stc.in_label(anat_label1)
# calculate center of mass and transform to mni coordinates
vtx, _, t_anat_label1 = stc_anat_label1.center_of_mass(subject)
mni_anat_label1 = mne.vertex_to_mni(vtx, 1, subject)[0]
#make 3mm radius sphere around vertex
anat_label1_sphere=mne.label.grow_labels(subject=subject, seeds=vtx, extents=3.0, hemis=1, subjects_dir=data_path, n_jobs=1)
# extract the vertex-sphere time course for label
stc_anat_label1_sphere=stc.in_label(anat_label1_sphere)
i get the following error:
/home/leitman/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.7.1-py2.7.egg/mne/source_estimate.pyc in in_label(self, label)
1089 """
1090 # make sure label and stc are compatible
-> 1091 if label.subject is not None and self.subject is not None \
1092 and label.subject != self.subject:
1093 raise RuntimeError('label and stc must have same subject names, '
AttributeError: 'list' object has no attribute 'subject'
It does not seem that I can add the subject attribute mannually as there is no __dict__ object
so what should I do?
dave
----- Original Message -----
From: "Alexandre Gramfort" <alexandre.gramfort at telecom-paristech.fr>
To: "David I Leitman" <leitman at mail.med.upenn.edu>
Sent: Tuesday, January 14, 2014 5:32:40 AM
Subject: Re: [Mne_analysis] how to save source estamates from epoched data set with multiple events
> thanks I have been using this example as a base but I was curious about the
> following:
> 1. can stc.extract_label_time_course work on a epoched data . fif file
> containing all my event condtions
no. You will need individual STCs and lose track of event conditions.
Maybe we could do better ...
> 2. lets say I want to extract as a time course just the vertices with the
> center of mass or perhaps an roi reflecting this vertices and a small number
> of neighboring vertices instead of the mean of a whole anatomic roi label.
> how could I do that?
you can grow labels given a seed but you'll need to define a label.
stc.data contains the time course of all vertices in the label. It's a plain
numpy array so you can manipulate it as you want.
> 3 ) with np.save can I also ad a vector that corresponds to the event type
> that each epoch represents?
to save multiple arrays in one file use scipy.io.savemat (to write a
matlab file)
HTH
Alex
More information about the Mne_analysis
mailing list