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

Support additional color maps #232

Open
ngehlenborg opened this issue Jul 30, 2020 · 5 comments
Open

Support additional color maps #232

ngehlenborg opened this issue Jul 30, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@ngehlenborg
Copy link
Member

I believe the library that we are using for color maps supports more than we have implemented at the moment. We should consider adding the full set.

@ngehlenborg ngehlenborg added the enhancement New feature or request label Jul 30, 2020
@ilan-gold
Copy link
Collaborator

I think we already support the full range but neither of our demos were coded to use it:

https://github.com/hubmapconsortium/vitessce-image-viewer/blob/d8a0e54a2d732dab81802c9d5cc0e7e892627cc6/src/layers/XRLayer/xr-layer-fragment-colormap.webgl2.glsl#L7-L50

image

@keller-mark
Copy link
Member

keller-mark commented Sep 4, 2020

This paper presents "cividis" which they say is the optimal colormap for imaging mass spectrometry, accounting for color vision deficiency https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239 This was "generated by optimizing the viridis colormap"

A list of the 256 colors in cividis is in a supplementary file https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0199239.s002&type=supplementary

@kylebarron
Copy link

FYI: It looks like you're hardcoding colormap values in shaders via glslify imports. It's not hard to use a texture as a colormap if you want more flexibility.

E.g.:

// Apply colormap texture given value
// Since the texture only varies in the x direction, setting v to 0.5 as a
// constant is fine
// Assumes the input range of value is -1 to 1
vec4 colormap_apply(sampler2D colormap, float value) {
  vec2 uv = vec2(0.5 * value + 0.5, 0.5);
  return texture2D(colormap, uv);
}

And then I converted all the Matplotlib colormaps to PNG files that are 256 pixels wide (doc with name mappings). So I can use any input PNG as a colormap at runtime.

@ilan-gold
Copy link
Collaborator

ilan-gold commented Sep 15, 2020

@kylebarron thanks for sharing - I noticed while working on the pre-print that this way you mentioned was more common but didn't really have hard evidence for it. I'm in favor of updating to do this, especially given the flexibility it would afford us considering what @keller-mark posted recently about a new map.

@manzt
Copy link
Member

manzt commented Nov 12, 2023

This would be great to implement.

@manzt manzt closed this as completed Nov 12, 2023
@manzt manzt reopened this Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants