-
Notifications
You must be signed in to change notification settings - Fork 4
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
Updating opacity with multiple volumes #5
Comments
Sorry, I am not understanding the issue.
The code in the example does not have any colormap toggle. Could you rephrase? I tried running the example and things are working as-expected on the latest commit, 6bd0a10 5.mp4 |
Initially, I was going to provide colormap toggle example, but found out that this applies to other properties, such as changing the opacity (via slider in the example). To be more specific, when you change the ventricle opacity, the volume render behaves correctly, but when you switch to brain, the opacity does not affect volume render anymore. This is also visible in the video example. |
@jennydaman , do you need any more information? |
oooohhh, i finally understand. You’re talking about the 3D render pane, not the 2D slice views (my mind unconsciously ignores the 3D render pane most of the times). This is indeed a bug but I think it’s an upstream bug. I will investigate further and let the right people know. |
@jennydaman and @hsellik this is a feature not a bug of NiiVue. Slow voxel-based computations are deferred until you call The call updateGLVolume() refreshes everything, calling refreshLayers() for all of the current volumes. If you only want to update a single volume, you can call refreshLayers() directly, e.g. to refresh the background volume call refreshLayers(nv1.volumes[0]). Be aware that updateGLVolume() is the most computationally expensive call in the entire NiiVue API, resynchronizing data on both the CPU and GPU. Due to this reason, for pure html I would call this on slider.onchange() but not on slider.oninput(): oninput → Fires continuously as the slider is being moved. I do not use react, so unsure what the equivalence is. |
@neurolabusc , thank you yet again for a very detailed explanation. It was confusing that it did change the opacity when changing one of the volumes, but didn't change when changing the other volume. There is some additional logic in the React wrapper that looks at the diff and calls For now, I'll try to acquire the NiiVue instance with |
Bug is confirmed and reported upstream. niivue/niivue#1174 |
Note, I was unable to reproduce this bug with |
Having multiple volumes loaded with Niivue React and trying to toggle colormaps. When toggling, the color seems to change only when the last element is modified.
The change is not properly detected in the
NVRVolume
object for some reason.The issue can be reproduced with the example from this repo when changing
draft.vetricle
todraft.brain
in setOpacity , so the opacity of the first element is changed.The text was updated successfully, but these errors were encountered: