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

Inconsistent handling of nans by WebGL viewer for Vertex vs. VertexRGB objects #455

Open
mvdoc opened this issue Jul 11, 2022 · 2 comments

Comments

@mvdoc
Copy link
Contributor

mvdoc commented Jul 11, 2022

We known that NaNs are not handled well by the WebGL viewer for Vertex objects. However, it seems that the viewer can handle NaNs perfectly fine for RGBVertex objects. We should investigate this difference and possibly figure out a fix for the Vertex objects.

Example:

import cortex
import numpy as np

vtx = cortex.Vertex.random("fsaverage")
# get an roi to mask out 
roi = cortex.get_roi_verts("fsaverage", roi="IPS0")["IPS0"]
vtx.data[roi] = np.nan

cortex.webgl.show({"vertex": vtx, "rgbvertex": vtx.raw})

produces
image
image

@mvdoc
Copy link
Contributor Author

mvdoc commented Jul 12, 2022

Adding a note to myself that

  • NaNs in Vertex objects are displayed as transparent on quickflat, but not on webgl
  • NaNs in VertexRGB objects are not displayed as transparent on quickflat, but they are on webgl

EDIT: there seems to be an interaction with the dtype (obv. nans cannot be cast to uint8). Still investigating...

@mvdoc
Copy link
Contributor Author

mvdoc commented Jul 13, 2022

#458 should fix the problem with VertexRGB objects. However, that PR doesn't fix the problem with Vertex objects. I explored the code for a while, and I think the problem might be in how the JS functions load the data and treat nans. But I'm still unsure about how the JS code works, so we'll have to keep this issue open...

@mvdoc mvdoc changed the title Inconsistent handling of nans by WebGL viewer for Vertex vs. RGBVertex objects Inconsistent handling of nans by WebGL viewer for Vertex vs. VertexRGB objects Jul 13, 2022
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