statebuilder.shaders
Classes:
Functions:
-
color_to_vec3–Convert a color to a string representation of an RGB triple.
-
shader_base–Set a skeleton vertex attribute in the shader code.
-
simple_point_shader–Generate a simple point shader with a specified color.
PointShader(colors=None, colormap=None, n_colors=None, many_label_color='white', no_label_color='grey', markersize=5, markerslider=True)
Create a point shader with customizable colors and properties. See https://jiffyclub.github.io/palettable/ for available colormaps.
Parameters:
-
colors(list, default:None) –List of colors (strings, hex, or RGB tuples/lists)
-
colormap(str, default:None) –Name of a palettable colormap (ignoring category) (e.g., 'Set1') Not used if colors is specified.
-
n_colors(int, default:None) –Number of colors to extract from colormap. Cannot be more than the available numbers in the colormap. Only used if a colormap is specified.
-
many_label_color(str, default:'white') –Color for points with multiple labels, by default 'white'
-
no_label_color(str, default:'grey') –Color for points with no labels, by default 'grey'
-
markersize(int, default:5) –Default marker size, by default 5
-
markerslider(bool, default:True) –Whether to include marker size slider, by default True
Methods:
-
make_properties–Return property configuration for neuroglancer.
make_properties()
Return property configuration for neuroglancer.
color_to_vec3(clr)
Convert a color to a string representation of an RGB triple.
:param clr: Color in various formats (string, tuple, list). :return: String representation of the RGB triple.
shader_base(vertex_attributes=None, checkbox_controls=None, sliders=None, defined_colors=None, uicontrols=None, body=None)
Set a skeleton vertex attribute in the shader code.
Parameters:
-
vertex_attributes(list[str], default:None) –The names of the vertex attribute to set.
-
checkbox_controls(dict or list, default:None) –Dictionary of checkbox controls with names as keys and default values as values. If a list is provided, it will be converted to a dictionary with True as default value.
-
sliders(dict, default:None) –Dictionary of slider controls with names as keys and a tuple of (type, min, max, default) as values. If a list is provided, it will be converted to a dictionary with default values of float, 0, 1, 0.5.
-
defined_colors(dict, default:None) –Dictionary of defined colors with names as keys and color values as values. If a list is provided, it will be converted to a dictionary with colors from the Tableau-10 palette.
-
body(str, default:None) –The body of the shader code to execute in the main function. If none is provided, a simple emitRGB is given.
Returns:
-
str–The shader code to set the vertex attribute.