napari: Additive blending mode requires black canvas (broken in light theme)
š Bug
Originally posted at napari-aicsimageio: https://github.com/AllenCellModeling/napari-aicsimageio/issues/22
When using Light theme in Napari, the napari-aicsimageio plugin results in wierd behavior: drag-n-dropping a LIF results in a blank image, regardless of colormap, etc.
However, switching to Dark theme shows that the image was properly loaded.
Light theme:
There is no error message. Note that the tiny preview icon in the layer list does properly show the image.
Dark theme:
To Reproduce
Drag-and-drop a LIF onto napari with napari-aicsimageio v 0.3.3 or 0.3.5 in napari 4.10 or 4.11. Change theme between Light and Dark. Hereās the smallest LIF I have handy: https://www.dropbox.com/s/7201v0ae0f3iiy8/2021040_H33342_L929_24w_A3_tilescan.lif?dl=0
Expected behavior
Image should be visible regardless of theme. Perhaps the colormap needs to be adjusted for optimal viewing, but it should not be a blank canvas.
Environment
napari: 0.4.11
Platform: macOS-11.5.2-arm64-arm-64bit
System: MacOS 11.5.2
Python: 3.9.6 | packaged by conda-forge | (default, Jul 6 2021, 08:51:19) [Clang 11.1.0 ]
Qt: 5.15.2
PyQt5: 5.15.4
NumPy: 1.21.0
SciPy: 1.7.0
Dask: 2021.06.2
VisPy: 0.7.0
OpenGL:
- GL version: 2.1 Metal - 71.7.1
- MAX_TEXTURE_SIZE: 16384
Screens:
- screen 1: resolution 1680x1050, scale 2.0
Plugins:
- Measurements (Plot profile): 0.1.5
- Measurements (skimage regionprops): 0.1.6
- Utilities (skimage regionprops): 0.1.6
- aicsimageio-out-of-memory: 0.3.5
- animation: 0.0.2
- clEsperanto: 0.10.0
- console: 0.0.4
- ome-types: 0.2.6
- scikit-image: 0.4.11
- svg: 0.1.5
(Note: I also tested 4.10 and v. 0.3.3 of the plugin)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (15 by maintainers)
That looks sweet @kevinyamauchi Thereās an apropos thread on image.sc regarding inverted LUTs and compositing multichannel images. The whole thread has a lot of info and examples: https://forum.image.sc/t/multi-channel-composite-view-with-inverted-luts-in-imagej-fiji/61163 And starting about here some discussion of subtractive blending: https://forum.image.sc/t/multi-channel-composite-view-with-inverted-luts-in-imagej-fiji/61163/23?u=psobolewskiphd
Hey everyone. I have a prototype of subtractive blending working and I have a couple questions about what we should do about the colormaps.
https://user-images.githubusercontent.com/1120672/147909940-cd52f300-d1c7-4cc4-977b-1c420c58a6dd.mov
As @jni mentioned above, subtractive blending āinvertsā the colors. For example, the magenta colormap appears green since it is being āsubtractedā from the white canvas:
*_sub
colormaps)? For example, we could make the magenta_sub colormap go from [0, 0, 0] -> [0, 1, 0], which would appear to go from white to magenta in the subtractive blending mode.Does it seem worth it to make a small PR to add the subtractive blending mode?
I donāt think gray solves anything, it just brings us closer to saturation. (I also donāt love having gray outside of the image region⦠that would look weird eg when displaying non overlapping tiles, or points/shapes that might exist outside of an overlaid image.)
imho we should:
Thanks for the links to the thread, @psobolewskiPhD ! Very useful.
Agreed. As nicely shown in that thread, the colors interact are composed differently in additive and subtractlive blending. Thus, I donāt think we should automatically swapping colormaps or blending mode.
If we compose multiple layers with different colormaps in subtractive blending mode on a white background, the behavior is similar to additive blending on a black background, but there are some subtle differences as shown in the thread linked by @psobolewskiPhD . The example I posted above is two layers with subtractive blending. I will make a PR later today so you can play around with it.
Just make the canvas in both light and dark neutral gray? 𤷠Solves https://github.com/napari/napari/issues/3313 as well! š¤£