[Mne_analysis] Source space interpolation
Rockhill, Alexander P.
AROCKHILL at mgh.harvard.edu
Tue Sep 18 15:51:27 EDT 2018
I was am using MMVT to visualize ultimately.
Is there a way to save out the automatic interpolation to the stc?
Thanks,
Alex
Translational NeuroEngineering Laboratory
Division of Neurotherapeutics, Department of Psychiatry
Massachusetts General Hospital, Martinos Center
149 13th St Charlestown #2301, Boston, MA 02129
________________________________________
From: mne_analysis-bounces at nmr.mgh.harvard.edu [mne_analysis-bounces at nmr.mgh.harvard.edu] on behalf of Sheraz Khan, PhD [sheraz at nmr.mgh.harvard.edu]
Sent: Tuesday, September 18, 2018 3:27 PM
To: Discussion and support forum for the users of MNE Software
Subject: Re: [Mne_analysis] Source space interpolation
what are you using to visualize ?
pysurfer do an automatic interpolation, which I am using
> Hi all,
>
> Is there a way to interpolate sources using built in MNE functions?
>
> The context is I did a source space TFR decomposition by label for all
> the labels in aparc subdivided into four sections, and I am putting
> them back together but approximately 5% of source vertices are not
> within any of the labels using the stc.in_label function. I visualized
> the brain and it appears the sources not covered are in a roughly
> uniform distribution, suggesting that interpolating them may not be a
> bad idea. The relevant code is reproduced below as well.
>
> Any help would be appreciated.
>
> if tfr:
> labels = read_labels_from_annot(self.subject,parc='aparc',hemi='both',
> surf_name='white',
> subjects_dir=self.subjects_dir)
> if splits is not None: #splits = 4
> labels = [split_label(label,parts=splits,subject=self.subject,
> subjects_dir=self.subjects_dir,freesurfer=True)
> for label in labels]
> labels = [l2 for l in labels for l2 in l]
> tfrs = np.memmap('sb_tfr_%s_%s_%s_workfile' %(event,ar,keyword_out),
> dtype='float64', mode='w+',
> shape=(batch,steps,fwd['nsource'],len(epochs.times)))
> else:
> tfrs = None
> mins = range(0,Nboot-batch +1,batch)
> maxs = range(batch,Nboot+1,batch)
> for i_min,i_max in zip(mins,maxs):
> fname2 = self._fname('sources','bootstrap','.npz','%i-%i'
> %(i_min,i_max),
> ar and not keyword_out,keyword_out,method,
> pick_ori,tfr,Nboot,Nave,seed,fmin,fmax,nmin,
> nmax,steps)
> if os.path.isfile(fname2):
> continue
> for i,k in enumerate(range(i_min,i_max)):
> indices = bootstrap_indices[i]
> bl_indices = [bl_events.index(j) for j in events[indices]]
> inv =
> self._generate_inverse(epochs,fwd,bl_epochs[bl_indices],lambda2,method,
> pick_ori)
> evoked = epochs[indices].average()
> stc = apply_inverse(evoked,inv,lambda2=lambda2,method=method,
> pick_ori=pick_ori)
> stcs[k] = stc.data[:]
> if tfr:
> tfr_stcs = []
> for _ in range(steps):
> stc_new = stc.copy()
> stc_new.data.fill(0)
> tfr_stcs.append(stc_new)
> for label in tqdm(labels):
> power,_ = source_induced_power(epochs[indices],inv,freqs,
> label=label,lambda2=lambda2,
> nave=Nave,n_cycles=n_cycles,
> n_jobs=n_jobs,prepared=True)
> ver = stc.in_label(label).vertices
> assigned = [[],[]]
> if 'lh' in label.name:
> inds = np.array([np.where(v==stc.vertices[0])[0][0]
> for v in ver[0]])
> assigned[0] += list(inds)
> elif 'rh' in label.name:
> inds = np.array([np.where(v==stc.vertices[1])[0][0]
> for v in ver[1]])
> assigned[1] += list(inds)
> inds += fwd['nsource']/2
> else:
> raise ValueError('Unidentified label')
> for j in range(steps):
> tfr_stcs[j].data[inds] = power[:,j]
> unassigned = [np.setdiff1d(stc.vertices[0],ind[0]),
> np.setdiff1d(stc.vertices[1],ind[1])]
> for j in range(steps):
> tfrs[k,j] = tfr_stcs[j].data
>
>
> Thanks,
>
> Alex
>
> Translational NeuroEngineering Laboratory
> Division of Neurotherapeutics, Department of Psychiatry
> Massachusetts General Hospital, Martinos Center
> 149 13th St Charlestown #2301, Boston, MA 02129
> _______________________________________________
> 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 Radiology
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
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
More information about the Mne_analysis
mailing list