Add IndexedStackColorMapper for ImageStack glyph #13316
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an early-stage WIP to add an
IndexedStackColorMapper
which is an alternative use ofImageStack
glyph that color maps and displays a single 2D array of the 3DImageStack
data.The data displayed is controlled by an
index
property, which will causedata[:, :, index]
to be displayed. The actual colormapping is controlled by a containedsingle_color_mapper
so that it can be linear, logarithmic or eq_hist. There is a boolean propertymap_all
(maybe should bescan_all
but I don't like either much) that controls whether the colormap limits/properties are calculated from the all of the 3D data or just the 2D data displayed.Example script:
and video of this:
https://github.com/bokeh/bokeh/assets/580326/ccfcc2cf-7c58-425e-9023-2019bf4bec9c
One problem with this approach is that both the
LinearColorMapper
andIndexedStackColorMapper
must have apalette
specified (None
is not allowed forColorMapper
s) but only one is used.Also, I have had to reimplement part of
ContinuousColorMapper._v_compute
withinIndexedStackColorMapper
when it scans all of the data but only displays one 2D slice of it. Probably a better approach would be a refactor of the various_v_compute
functions to accept the scanned data rather than scan it themselves.