<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div>Perhaps you are confusing labels and vertices? The desikan atlas contains 68 *labels*, and what the output is telling you is that it loads 34 labels for the left hemisphere, and 34 labels for the right hemisphere, for a total of 68 labels. So that is working as expected. But each individual *label* has different numbers of vertices (depending on the size of the label). Again, your output is telling you this: the variable `label` is for the banks of the superior temporal sulcus - left hemisphere (bankssts-lh), and contains 1265 vertices.<br></div><div><br></div><div>I'm still not 100% clear on what you're trying to do, but one of these might be the right direction:</div><div><br></div><div>1. Use the regexp argument of mne.read_labels_from_annot() to get the label(s) you want (instead of indexing with [0]). If you want, you can run it multiple times with different regexp arguments, and combine several labels with the + operator. From there you can use mne.SourceEstimate.in_label().<br></div><div>2. mne.SourceEstimate.extract_label_time_course() # takes a label or list of labels</div><div>3. mne.Label.center_of_mass() # reduces a label to a single vertex; if what you really want is just 68 vertices, one for each label<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 4, 2019 at 10:12 PM Vivek Sharma <<a href="mailto:vivek.sharma1510@gmail.com">vivek.sharma1510@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>please find my comments marked in red.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 4, 2019 at 11:56 PM Dan McCloy <<a href="mailto:dan.mccloy@gmail.com" target="_blank">dan.mccloy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div>This line:</div><div><i>label = mne.read_labels_from_annot('subject', hemi='both', parc='aparc', subjects_dir=subjects_dir, regexp=None)[0]</i></div><div><i><br></i></div><div>selects the alphabetically first label from the parcellation<i>.</i> Is that really what you want? "<font color="#ff0000">I want all the 68 labels not only the first one...... when I execute this code:</font></div></div></blockquote><div> <i>label = mne.read_labels_from_annot('subject', hemi='both', parc='aparc', subjects_dir=subjects_dir, regexp=None)[0]</i></div><div><font color="#ff0000">it gives the following output</font></div><div><font color="#ff0000"><div>Reading labels from parcellation...</div><div> read 34 labels from /home/vivek/Downloads/freesurfer/subjects/sub-CC721377_T1w/label/lh.aparc.annot</div><div> read 34 labels from /home/vivek/Downloads/freesurfer/subjects/sub-CC721377_T1w/label/rh.aparc.annot</div><div>and the variable label contains: <Label | sub-CC721377_T1w, 'bankssts-lh', lh : 1265 vertices></div><div>if I remove [0] from end in the code, the output changes to lengthy list of labels. but this output I cannot include using code: <i>stc1 = stc.in_label(label). </i>It gives following error: </div><div><div>Traceback (most recent call last):</div><div> File "<stdin>", line 1, in <module></div><div> File "/home/vivek/anaconda3/lib/python3.7/site-packages/mne/source_estimate.py", line 1197, in in_label</div><div> if label.subject is not None and self.subject is not None \</div><div>AttributeError: 'list' object has no attribute 'subject'</div></div></font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>" More clearly: mne.read_labels_from_annot returns a list of labels **sorted by label name (ascending)**. Perhaps you're getting the wrong number of vertices because you're selecting the wrong label?<br><i></i></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 4, 2019 at 1:09 AM Vivek Sharma <<a href="mailto:vivek.sharma1510@gmail.com" target="_blank">vivek.sharma1510@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I'm still not able to reduce the number of vertices to 68.<div>let me again explain my problem with more detail:</div><div>I'm using the following command to generate source estimates...</div><div><br></div><div><i>stc = mne.minimum_norm.apply_inverse_raw(raw, inverse_operator, lambda2, method='eLORETA', label=None, start=60, stop=240, nave=1, time_func=None, pick_ori=None, buffer_size=None, prepared=False, method_params=None, verbose=None)</i><br></div><div><i><br></i></div><div>The output of above command contains 8175 vertices and I want to reduce the number of vertices to 68 which is according to Desikan atlas.</div><div>To reduce the vertices I use the following code:</div><div><br></div><div><i>label = mne.read_labels_from_annot('subject', hemi='both', parc='aparc', subjects_dir=subjects_dir, regexp=None)[0]<br></i></div><div><i>stc1 = stc.in_label(label)</i><br></div><div><i><br></i></div><div><i><br></i></div><div>Now the stc1 contain 35 vertices but I want 68 (Desikan)</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 23, 2019 at 9:40 PM Diptyajit Das <<a href="mailto:bmedasdiptyajit@gmail.com" target="_blank">bmedasdiptyajit@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr"><div>.in_label(label) takes a single argument i.e., single label. Just combine the both labels and continue. For details, see this:</div><div><a href="https://martinos.org/mne/stable/generated/mne.SourceEstimate.html?highlight=in_label#mne.SourceEstimate.in_label" target="_blank">https://martinos.org/mne/stable/generated/mne.SourceEstimate.html?highlight=in_label#mne.SourceEstimate.in_label</a><br> </div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 23, 2019 at 4:59 PM Vivek Sharma <<a href="mailto:vivek.sharma1510@gmail.com" target="_blank">vivek.sharma1510@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr"><div dir="ltr">When I run this command, label = mne.read_labels_from_annot(subject, hemi=hemi, parc='aparc', subjects_dir=subjects_dir, regexp=regexp)[0], with [0] at the end I could run the next command stc = stc.in_label(label), successfully but it reduces the number of vertices to 35, whereas when I do not use '[0]' at the end of command, I could not run the next command, it gives the following error:<div><div><div>>>> label = mne.read_labels_from_annot('sub-CC721377_T1w', hemi='both', parc='aparc', subjects_dir=subjects_dir, regexp=None)</div><div>Reading labels from parcellation...</div><div> read 34 labels from /home/vivek/Downloads/freesurfer/subjects/sub-CC721377_T1w/label/lh.aparc.annot</div><div> read 34 labels from /home/vivek/Downloads/freesurfer/subjects/sub-CC721377_T1w/label/rh.aparc.annot</div></div><div>>>> stc_label.in_label(label)</div><div>Traceback (most recent call last):</div><div> File "<stdin>", line 1, in <module></div><div> File "/home/vivek/anaconda3/lib/python3.7/site-packages/mne/source_estimate.py", line 1197, in in_label</div><div> if label.subject is not None and self.subject is not None \</div><div>AttributeError: 'list' object has no attribute 'subject'</div></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail_attr">On Wed, Jan 23, 2019 at 6:52 PM Diptyajit Das <<a href="mailto:bmedasdiptyajit@gmail.com" target="_blank">bmedasdiptyajit@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr"><div>Follow this:</div><div><a href="https://github.com/mne-tools/mne-python/issues/5850" target="_blank">https://github.com/mne-tools/mne-python/issues/5850</a></div><div><br></div><div>best,<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail-m_8851470572228470334gmail_attr">On Tue, Jan 22, 2019 at 11:18 AM Vivek Sharma <<a href="mailto:vivek.sharma1510@gmail.com" target="_blank">vivek.sharma1510@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr">Hi,<div>Thanks for the code.</div><div>I tried with this method but it reduces the number of vertices to 35, I want it to be 68 according to Desikan atlas.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail-m_8851470572228470334gmail-m_-4390130815623545218gmail_attr">On Thu, Jan 17, 2019 at 5:12 PM Diptyajit Das <<a href="mailto:bmedasdiptyajit@gmail.com" target="_blank">bmedasdiptyajit@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr"><div>Hi, <br></div><div><br></div><div>You do cortical parcellation by using some atlas. I think what you meant is to restrict the dipoles activity to some particular brain regions. For that, you need to pass the 'label' during source estimation or you can do something like this after the source estimate:</div><div><br></div><div>code:<br></div><div>regexp = 'bankssts' # name the brain region that you are interested in</div><div>hemi = 'both' # taking both hemisphere<br></div><div><span></span>label =
mne.read_labels_from_annot(subject, hemi=hemi, parc='aparc',
subjects_dir=subjects_dir, regexp=regexp)[0] # read the label of the particular region based on Desikan atlas (i.e., defined by 'aparc')</div><div>stc =
stc.in_label(label) # restrict the dipoles to that particular label<br><p style="margin-bottom:0in;line-height:100%"><br></p><p style="margin-bottom:0in;line-height:100%">best,</p><p style="margin-bottom:0in;line-height:100%">Dip</p></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail-m_8851470572228470334gmail-m_-4390130815623545218gmail-m_-609284873714973337gmail_attr">On Thu, Jan 17, 2019 at 12:05 PM Vivek Sharma <<a href="mailto:vivek.sharma1510@gmail.com" target="_blank">vivek.sharma1510@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p><div dir="ltr"><div dir="ltr">Okay.<div>The source estimate file I'm getting consists of 8175 vertices (SourceEstimate | 8175 vertices) , I wanted to reduce the number of vertices to the ROIs, in my case I wanted to use Desikan atlas.</div><div>How can I reduce the number of vertices, specific to certain atlases?</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail-m_8851470572228470334gmail-m_-4390130815623545218gmail-m_-609284873714973337gmail-m_5803563496366269002gmail_attr">On Thu, Jan 17, 2019 at 2:10 PM Alexandre Gramfort <<a href="mailto:alexandre.gramfort@inria.fr" target="_blank">alexandre.gramfort@inria.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> External Email - Use Caution <br>
<br>
make_watershed_bem uses an atlas to get a good skull segmentation<br>
<br>
it's not an atlas of the cortical surface as you suggest<br>
<br>
HTH<br>
A<br>
<br>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail-m_8851470572228470334gmail-m_-4390130815623545218gmail-m_-609284873714973337gmail-m_5803563496366269002gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:12.8px">Vivek Sharma</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail-m_8851470572228470334gmail-m_-4390130815623545218gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:12.8px">Vivek Sharma</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail-m_-1336474807705374528gmail-m_3467589676815621040gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:12.8px">Vivek Sharma</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5676149909065686707gmail-m_2615215841463889649gmail-m_-7517698392030315621gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:12.8px">Vivek Sharma</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5676149909065686707gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:12.8px">Vivek Sharma</span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div></div>