Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obtain vertex index from webgl #328

Open
MICA-MNI opened this issue May 28, 2019 · 1 comment
Open

Obtain vertex index from webgl #328

MICA-MNI opened this issue May 28, 2019 · 1 comment

Comments

@MICA-MNI
Copy link

MICA-MNI commented May 28, 2019

Hello pycortex team!

Quite amazed by your beautiful software, we are currently trying to build a pycortex webgl viewer that shows different types of connectivity data and interactively updates the maps shown based on the vertices that are clicked. Would there be an easy way to implement this? I saw one can define a pickerfun but was not sure how to utilize this. The script we're using is shown below.

Cheers & many thanks,
Boris

import cortex
import cortex.polyutils
import numpy as np
import scipy.io as si


# downsampled fsaverage data 
subject = "S1_ds"

# load the matrices 
deep        = si.loadmat('/Users/boris/Desktop/pycortex-master/filestore/db/S1_ds/surface-info/dd_fs4s.mat')
deep        = deep['a']
mpc         = si.loadmat('/Users/boris/Desktop/pycortex-master/filestore/db/S1_ds/surface-info/mc_fs4s.mat')
mpc         = mpc['a']
gd          = si.loadmat('/Users/boris/Desktop/pycortex-master/filestore/db/S1_ds/surface-info/gd_fs4s.mat')
gd          = gd['a']
sc          = si.loadmat('/Users/boris/Desktop/pycortex-master/filestore/db/S1_ds/surface-info/sc_fs4s.mat')
sc          = sc['a']


# ideally we would like to get recalculate these maps every time the user clicks 
# on a given vertex i.e. reassign the 'vert' variable below interactively
vert        = 800
deep_map    = cortex.Vertex(deep[vert,], subject, cmap="plasma")
mpc_map     = cortex.Vertex(mpc[vert,], subject, cmap="Greys_r")
gd_map      = cortex.Vertex(gd[vert,], subject, cmap="hot")
sc_map      = cortex.Vertex(sc[vert,], subject, cmap="PuBu_r")


maps        =  {'GEODESIC': gd_map, 'MPC': mpc_map, 'SC': sc_map, 'DEEP': deep_map}

cortex.webgl.show(data=maps, recache=True, title='Wiring', 
                  overlays_visible=(''),
                  labels_visible=('')) 
@marcoaqil
Copy link

up: on a more general note, I also cannot make pickerfun work even for an extremely simple application, like printing the vertex index. If anyone knows how to make it work, by all means let know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant