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

reducing coordinate opacity makes black dots on the image layer #143

Open
McHaillet opened this issue Aug 2, 2023 · 12 comments
Open

reducing coordinate opacity makes black dots on the image layer #143

McHaillet opened this issue Aug 2, 2023 · 12 comments

Comments

@McHaillet
Copy link
Contributor

Here, a short video of the issue (recorded directly after I opened Blik):

Screencast.from.02-08-23.16.49.56.webm
@brisvag
Copy link
Owner

brisvag commented Aug 3, 2023

Confirm I can't reproduce on my machine. Can you paste the output of napari --info?

@McHaillet
Copy link
Contributor Author

Voila:

napari: 0.4.18
Platform: Linux-5.14.0-1050-oem-x86_64-with-glibc2.35
System: Ubuntu 22.04.2 LTS
Python: 3.10.12 (main, Jul  5 2023, 18:54:27) [GCC 11.2.0]
Qt: 5.15.2
PyQt5: 5.15.9
NumPy: 1.25.1
SciPy: 1.11.1
Dask: 2023.7.1
VisPy: 0.12.2
magicgui: 0.7.2
superqt: unknown
in-n-out: 0.1.8
app-model: 0.2.0
npe2: 0.7.2

OpenGL:
  - GL version:  4.6.0 NVIDIA 535.86.10
  - MAX_TEXTURE_SIZE: 32768

Screens:
  - screen 1: resolution 1920x1080, scale 1.0
  - screen 2: resolution 1920x1080, scale 1.0

Settings path:
  - /home/marten/.config/napari/blik_env_4f55b458f76e0e18212ea2a8e7f36b42c679bdf4/settings.yaml
Plugins:
  - blik: 0.4.1.dev18+ga13c049 (22 contributions)
  - napari: 0.4.18 (77 contributions)
  - napari-console: 0.0.8 (0 contributions)
  - napari-label-interpolator: 0.1.0 (2 contributions)
  - napari-properties-plotter: 0.2.2 (2 contributions)
  - napari-properties-viewer: 0.0.2 (2 contributions)
  - napari-svg: 0.1.10 (2 contributions)

@brisvag
Copy link
Owner

brisvag commented Aug 3, 2023

This sounds like a napari issue... If you run this in ipython, do you see the same issue instead of a half-transparent point?

import napari
import numpy as np
v = napari.Viewer()
v.add_image(np.random.rand(100, 100))
v.add_points(np.array([50, 50]), opacity=0.4)

I see this, for reference:
image

@McHaillet
Copy link
Contributor Author

Seems like here it does work. Would it help to run napari with --debug mode or something? Maybe I could get some additional info there

Screenshot from 2023-08-04 10-59-14

@brisvag
Copy link
Owner

brisvag commented Aug 4, 2023

For now we just need to find a minimal reproducer; I think it's an openGL issue, so it's unlikely to come out of napari code specifically, I'll probably have to dig into vispy.

Try this:

import napari
import numpy as np
v = napari.Viewer()
v.add_image(np.random.rand(100, 100))
v.add_points(np.array([50, 50]), opacity=0.4, shading='spherical')

and if it's still fine, change the point colors to 'teal'?

@McHaillet
Copy link
Contributor Author

This also works fine, as well as changing colors to teal.

@brisvag
Copy link
Owner

brisvag commented Aug 13, 2023

Nasty bug :P some other things to try:

  • change layer order (image above points) and see if it's affected
  • change image blending mode to translucent from translucent no depth

@McHaillet
Copy link
Contributor Author

will try it tomorrow morning!

@McHaillet
Copy link
Contributor Author

I tried those things but don't get the issue. Also tried making it 3D and using the out_of_slice_display (as below), but also does not reproduce it.

v.add_image(np.random.rand(10, 100, 100))
v.add_points(np.array([5, 50, 50]), opacity=0.4, shading='spherical', out_of_slice_display=True)

@brisvag
Copy link
Owner

brisvag commented Aug 18, 2023

Ok, I actually got it to reproduce. In my case, it's indeed because of the layer order. Basically, if you have the image above the points and make the points transparent, the thing you see behind the points is the canvas (black). This is actually kind of unsolvable because of how opengl blending works (unless we break other things). Here's a comment mentioning this exact issue (and approrpiately, it was me who said "let's cross that bridge when we get to it" xD).

So for you the solution should be: move the points layer above the images. Does that work?

@McHaillet
Copy link
Contributor Author

McHaillet commented Sep 1, 2023

It's a been while, sorry for that.

That indeed solves the problem haha
Maybe you could switch the default order of the layers in Blik to prevent the issue?

@brisvag
Copy link
Owner

brisvag commented Sep 1, 2023

I already have a little trick like that in fact (sorting layers before adding them), the problem is, it doesn'y work xD napari gives the files to readers one by one instead of as a list... Not sure there's a solution to that other than writing my own entry point script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants