You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then there is the fact that the automatically computed scale_factor value is really small in my experiment. This variable influences the scaling of the glyphs:
Yes, the scale_factor does seem to improve things. Although it is still a bit hard to see the arrows depending on how you rotate the brain. Not sure if that's expected. If the automatic logic is not so reliable, maybe one option is to add it as an option to tweak in the time_viewer ?
At the moment, the automatic scaling for plot_vector_source_estimates still relies on PySurfer. If we make a fix in MNE, the patch would be PySurfer-specific right?
On the MNE side, I could suggest something which is in the order of magnitude of:
I haven't looked at how this is currently handled in the code, so maybe this is a dumb idea, but it seems to me that you will never want your longest arrow to be longer than, say, 1/5 the width of a cerebral hemisphere at most. Would it be enough to always scale such that the longest arrow ends up that size?
On November 5, 2019 8:24:08 AM PST, Mainak Jas ***@***.***> wrote:
Yes, the `scale_factor` does seem to improve things. Although it is
still a bit hard to see the arrows depending on how you rotate the
brain. Not sure if that's expected. If the automatic logic is not so
reliable, maybe one option is to add it as an option to tweak in the
`time_viewer` ?
@GuillaumeFavelier we can implement the fix on the MNE side, then we don't break people's independent PySurfer code. Or you can try to backport the fix.
We'll probably want it for the PyVista implementation anyway.
Regarding which heuristic to use (e.g., @drammock's comment) it's probably worth trying a few options to see what tends to work. But instead of using max another option is to use a percentile (other than effectively 100%) to help deal with outliers.
The current state of #7030 might have found a satisfying value for the scale_factor. Could you maybe try it out on your examples @jasmainak ?
Although it is still a bit hard to see the arrows depending on how you rotate the brain.
This is maybe because the type of glyph is 2D? It's cheap to compute but it doesn't improve the vector information conveyed so much in my opinion especially with many of them. We could experiment with another type of glyph, maybe 3D arrows. What do you think?
hmmm ... I thought it was 3D? Why are the glyphs 2D? also maybe if you plotted on an inflated brain, it might look better -- why is the default for vector source estimates not an inflated surface?
See @GuillaumeFavelier's comment above, efficiency probably. (Also in my experience the 3D ones can be harder to see depending on how they're plotted.)
why is the default for vector source estimates not an inflated surface?
Imagine for a minute all the vectors happened to be normal to the cortical surface (i.e., landed in perfectly fixed orientation even though you had a loose or free inv). They are normal to the white matter surface. If you plotted these vectors on the inflated surface it would both be conceptually misleading, and probably look pretty strange.
sorry I had a more basic question -- I guess I should have asked "what are 2D glyphs"? :) if it's 2D, is it on a plane perpendicular to my viewing angle? Because some arrows disappear and appear depending on what angle I am looking from. It's a bit confusing.
I agree that the white matter surface might be better to plot to avoid misinterpretation on but currently I can't see much from the plot.
Also are the arrows scaled according to the magnitude of the stc at the vertex?
The 2D glyphs indeed belong to a plan, this small animation hopefully demonstrates what I couldn't explain by 2D glyphs (made with PyVista):
Also are the arrows scaled according to the magnitude of the stc at the vertex?
Looking at the code of PySurfer, the function _add_vector_data which uses Mayavi to plot the glyphs uses the option scalars=vector_values. So for short, the answer is yes, the arrows are scaled by the magnitude (you can look here if you want more details), #7030 just tries to find a satisfying value for the length of the maximum glyph.
@GuillaumeFavelier feel free to try out the 3D version to see if you can get something satisfying. We can have an option for glyph='arrow2d' | 'arrow3d' or so if it ends up looking good
Activity
agramfort commentedon Nov 5, 2019
@GuillaumeFavelier maybe can you have a look? thanks
GuillaumeFavelier commentedon Nov 5, 2019
Okay, first good news: I'm able to reproduce. Thanks for reporting @jasmainak
GuillaumeFavelier commentedon Nov 5, 2019
Then there is the fact that the automatically computed
scale_factorvalue is really small in my experiment. This variable influences the scaling of the glyphs:My results using the gist:
Which gives
scale_factor_norm=1.07521615940585e-11, this is too small I think.For reference: https://github.com/nipy/PySurfer/blob/master/surfer/viz.py#L1098-L1105
agramfort commentedon Nov 5, 2019
GuillaumeFavelier commentedon Nov 5, 2019
Apparently using
scale_factor=20instead ofscale_factor=Nonealready helps in my case but there is maybe more to it.GuillaumeFavelier commentedon Nov 5, 2019
could you try it out @jasmainak ?
larsoner commentedon Nov 5, 2019
If the scale factor logic can be improved we could consider it a bug fix
jasmainak commentedon Nov 5, 2019
Yes, the
scale_factordoes seem to improve things. Although it is still a bit hard to see the arrows depending on how you rotate the brain. Not sure if that's expected. If the automatic logic is not so reliable, maybe one option is to add it as an option to tweak in thetime_viewer?GuillaumeFavelier commentedon Nov 5, 2019
At the moment, the automatic scaling for
plot_vector_source_estimatesstill relies on PySurfer. If we make a fix in MNE, the patch would be PySurfer-specific right?On the MNE side, I could suggest something which is in the order of magnitude of:
drammock commentedon Nov 5, 2019
larsoner commentedon Nov 5, 2019
@GuillaumeFavelier we can implement the fix on the MNE side, then we don't break people's independent PySurfer code. Or you can try to backport the fix.
We'll probably want it for the PyVista implementation anyway.
Regarding which heuristic to use (e.g., @drammock's comment) it's probably worth trying a few options to see what tends to work. But instead of using
maxanother option is to use a percentile (other than effectively 100%) to help deal with outliers.GuillaumeFavelier commentedon Nov 7, 2019
The current state of #7030 might have found a satisfying value for the
scale_factor. Could you maybe try it out on your examples @jasmainak ?This is maybe because the type of glyph is 2D? It's cheap to compute but it doesn't improve the vector information conveyed so much in my opinion especially with many of them. We could experiment with another type of glyph, maybe 3D arrows. What do you think?
jasmainak commentedon Nov 7, 2019
hmmm ... I thought it was 3D? Why are the glyphs 2D? also maybe if you plotted on an inflated brain, it might look better -- why is the default for vector source estimates not an inflated surface?
larsoner commentedon Nov 7, 2019
See @GuillaumeFavelier's comment above, efficiency probably. (Also in my experience the 3D ones can be harder to see depending on how they're plotted.)
Imagine for a minute all the vectors happened to be normal to the cortical surface (i.e., landed in perfectly fixed orientation even though you had a loose or free inv). They are normal to the
whitematter surface. If you plotted these vectors on theinflatedsurface it would both be conceptually misleading, and probably look pretty strange.jasmainak commentedon Nov 7, 2019
sorry I had a more basic question -- I guess I should have asked "what are 2D glyphs"? :) if it's 2D, is it on a plane perpendicular to my viewing angle? Because some arrows disappear and appear depending on what angle I am looking from. It's a bit confusing.
I agree that the white matter surface might be better to plot to avoid misinterpretation on but currently I can't see much from the plot.
Also are the arrows scaled according to the magnitude of the
stcat the vertex?GuillaumeFavelier commentedon Nov 8, 2019
The 2D glyphs indeed belong to a plan, this small animation hopefully demonstrates what I couldn't explain by 2D glyphs (made with PyVista):

Looking at the code of PySurfer, the function
_add_vector_datawhich uses Mayavi to plot the glyphs uses the optionscalars=vector_values. So for short, the answer is yes, the arrows are scaled by the magnitude (you can look here if you want more details), #7030 just tries to find a satisfying value for the length of the maximum glyph.larsoner commentedon Nov 8, 2019
@GuillaumeFavelier feel free to try out the 3D version to see if you can get something satisfying. We can have an option for
glyph='arrow2d' | 'arrow3d'or so if it ends up looking goodGuillaumeFavelier commentedon Nov 8, 2019
I opened #7038 to keep track of the progress to fix this issue.