google / google/neuroglancer

Select Shaders/Colormaps In ImageLayer UI Panel

Open
#243 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
389
Avg merge
3d 21h
Merged PRs (30d)
3

Description

I am using Neuroglancer's Python wrapper and I have several of my own colormaps/shaders for an ImageLayer.
I would like to add a drop-down menu (or something similar) to the rendering tab of the layer's UI panel, where the user can see the names of colormaps/shaders and easily pick the one they want.

Some colormaps/shaders may hide or show different information, so having an easy way to pick from existing ones would be great.

I have thought of two ways to change between these colormaps, but neither are quite what I want:
1. create an Action that, on keypress, will cycle through several shaders that each implement a colormap.
2. Give each colormap some ID and use the #uicontrol slider to set the ID corresponding to the desired colormap. All colormaps are defined in the single shader. Something like this:
~~~~
#uicontrol int colormapId slider(min=0, max=5,step=1)
vec4 colormap(float x) {
if (colormapId == 0) return colormap0(x);
if (colormapId == 1) return colormap1(x);
....
}
....
~~~~

These work, but hide some details from the user, like which shader is currently being used and what the options actually are.

I spent a while looking and couldn't find anything, but is there currently a way to pick named shaders from the neuroglancer UI that's similar to what I want? If so, is it possible to set this from the python wrapper?
If not possible, any recommendations on how to add a feature like this would be appreciated!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.