[Neuroimaging] Combined surface plot using plotting.view_surf function

Michiel Cottaar michiel.cottaar at ndcn.ox.ac.uk
Mon Nov 18 07:08:00 EST 2019


Hi Makis,

Note that the faces contain the indices of the vertices. So, when you change the order of the vertices, you also have to change these indices accordingly. In this case that means that if the left surface has 3,000 vertices, then the vertices with index 10 or the right surface will have an index of 3,010 in the combined surface. So when we create the combined_faces array we have to update the indices of the right hemisphere:
combined_faces = np.concatenate([left[1], right[1] + left[0].shape[0]])

Best wishes,

Michiel

On 18 Nov 2019, at 11:59, serafim loukas <seralouk at hotmail.com<mailto:seralouk at hotmail.com>> wrote:

Dear Nilearn community,

First of all thanks for this beautiful python module.

I am trying to use the “plotting.view_surf” function but instead of plotting only one hemisphere, I want to plot both hemispheres combined.
To do so, I load the individual surfaces (left and right) and I combine them in order to plot them.
However, the surface plot only shows one hemisphere.

Any tip?

My code is:

from nilearn import datasets, plotting
from nilearn.surface import load_surf_data
import numpy as np

fsaverage = datasets.fetch_surf_fsaverage()

left = load_surf_data(fsaverage['pial_left'])
right = load_surf_data(fsaverage['pial_right'])

combined_vertices = np.concatenate([left[0], right[0]])
assert(left[0].shape[0] + right[0].shape[0]== combined_vertices.shape[0])

combined_faces = np.concatenate([left[1], right[1]])
assert(left[1].shape[0] + right[1].shape[0]== combined_faces.shape[0])

combined_surface= [combined_vertices, combined_faces]
view = plotting.view_surf(combined_surface)
view.open_in_browser()

Bests,
Makis
_______________________________________________
Neuroimaging mailing list
Neuroimaging at python.org<mailto:Neuroimaging at python.org>
https://mail.python.org/mailman/listinfo/neuroimaging

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20191118/64972115/attachment.html>


More information about the Neuroimaging mailing list