nipy / PySurfer

Cortical neuroimaging visualization in Python
https://pysurfer.github.io/
BSD 3-Clause "New" or "Revised" License
240 stars 97 forks source link

Q: contour from data #153

Closed kingjr closed 8 years ago

kingjr commented 8 years ago

Hi,

I'm trying to plot the contour of an activation map.

I'm struggling to understand how I can convert my data array whose shape is n_vertices=20484 (10242 per hemisphere of fsaverage with oct=5) to an overlay array of shape 163842, (which seems to relate to brain._geo.curv?)

Any idea on how to do this?

larsoner commented 8 years ago

stc.morph with the "None" grade designed to fill the high-density mesh

larsoner commented 8 years ago

Oh sorry though this was MNE, heh.

Take a look at how STCs would be plotted using PySurfer, it would use the same code. You need to upsample it using smoothing steps. If you can't find it in the docs I'll look.

kingjr commented 8 years ago

Nope, I'm getting stuck. I don't know the package well enough :/

Are you saying we can plot activation contours in MNE?

larsoner commented 8 years ago

What do you mean by "activation contours"? You mean STCs? Yes stc.plot() wraps to PySurfer.

larsoner commented 8 years ago

For non-STCs look at the STC example, it upsamples from the decimated mesh to the high-resolution one:

https://github.com/nipy/PySurfer/blob/master/examples/plot_meg_inverse_solution.py#L60

kingjr commented 8 years ago

I would like to add a contour overlay on top of activation map similar. The contour would be similar to this, but using a single line: plot_topographic_contours

This would be to show the effect size (color coded) and surround the significant clusters with a line analogous to this: contour

larsoner commented 8 years ago
  1. Do stc.morph in MNE-Python with grade=None to fill the high-resolution mesh
  2. Find a PySurfer example of contour plots
  3. Tweak the properties of the underlying Mayavi object if necessary to get the single contour to be at the right value
larsoner commented 8 years ago

(after morph you can use stc.lh_data and stc.rh_data or similar to get the left and right hemi data, which PySurfer will want)

kingjr commented 8 years ago

Works nicely, thanks.