Skip to content

Commit

Permalink
EXA make path visible in fix_geodesic_path example (#487)
Browse files Browse the repository at this point in the history
* FIX: make path visible

* EXA some small fixes to plot_geodesic_path

---------

Co-authored-by: Matteo Visconti di Oleggio Castello <[email protected]>
  • Loading branch information
marklescroart and mvdoc authored Jul 20, 2023
1 parent 57e5f9c commit 38788b5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/surface_analyses/plot_geodesic_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
surfs = [cortex.polyutils.Surface(*d)
for d in cortex.db.get_surf(subject, "fiducial")]
numl = surfs[0].pts.shape[0]
numr = surfs[1].pts.shape[0]
num_vertices = numl + numr

# Now we need to pick the start and end points of the line we will draw
pt_a = 100
Expand All @@ -33,12 +35,12 @@
path = surfs[0].geodesic_path(pt_a, pt_b)

# In order to plot this on the cortical surface, we need an array that is the
# same size as the number of vertices in the left hemisphere
path_data = np.zeros(numl)
# same size as the number of vertices
path_data = np.zeros(num_vertices) * np.nan
for v in path:
path_data[v] = 1

# And now plot these distances onto the cortical surface
path_verts = cortex.Vertex(path_data, subject, cmap="Blues_r")
cortex.quickshow(path_verts, with_colorbar=False)
path_verts = cortex.Vertex(path_data, subject, cmap="Reds", vmin=0, vmax=1)
cortex.quickshow(path_verts, with_colorbar=False, with_curvature=True)
plt.show()

0 comments on commit 38788b5

Please sign in to comment.