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
Fix direct colormap #6461
Fix direct colormap #6461
Conversation
napari/_vispy/layers/image.py
Outdated
None: np.dtype(np.float32), | ||
} | ||
|
||
_DTYPE_TO_VISPY_FORMAT = {v: k for k, v in _VISPY_FORMAT_TO_DTYPE.items()} | ||
|
||
_VISPY_FORMAT_TO_DTYPE[None] = np.dtype(np.float32) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jni, this is a real fix.
As without this change the _DTYPE_TO_VISPY_FORMAT[np.float32]
return None
, not "r32f"
here:
napari/napari/_vispy/layers/labels.py
Line 581 in 8ed7f4c
self._setup_nodes(_DTYPE_TO_VISPY_FORMAT[dtype]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment explaining this just above, it seems easy to overlook this in the future and move it back to the dict declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok now?
@@ -524,6 +524,7 @@ def _on_colormap_change(self, event=None): | |||
interpolation='nearest', | |||
) | |||
self.node.shared_program['LUT_shape'] = key_texture.shape | |||
self.node.shared_program['color_count'] = len(color_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only silence openGL warning
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6461 +/- ##
==========================================
- Coverage 92.21% 92.16% -0.05%
==========================================
Files 601 601
Lines 53135 53167 +32
==========================================
+ Hits 48996 49003 +7
- Misses 4139 4164 +25 ☔ View full report in Codecov by Sentry. |
Well, we have some tests, e.g. napari/napari/layers/labels/_tests/test_labels.py Lines 1446 to 1454 in ef26ef3
but they are bad tests, apparently. 😅 I indeed didn't find any in the vispy or qt tests. Do you want to bring the test over to this PR @Czaki? I think it would be nice to have it here. |
@Czaki weird failures on this...
|
looks fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
@Czaki do you think you can explain in plain terms what the problem was with the Qt tests? I don't really follow the commit. It is probably a good investment to write a developer documentation page that explains the issues with testing Qt, cleanup failures, and how to avoid them...
This should be a later PR. Maybe I'll make an issue?
No. I do not understand. The only difference is to stop using qtbot to manage QtViewers and switch to manually manage. This was to fix leake widget warnings (as But I do not understand how use |
Ok. That's a bummer. 😂 Anyway, thinking about reviewing #6459, I realise now that |
It is an intentional bug... it is part of a bigger problem that I'm working to solve in follow-up PR.
Nope. This solution will show all components mapping to the same color. not only selected label. |
# Description This fixes a bug on the current main implementation of direct color mode in the Labels layer that is required for #6439.
# Description This fixes a bug on the current main implementation of direct color mode in the Labels layer that is required for #6439.
Description
This fixes a bug on the current main implementation of direct color mode in the Labels layer that is required for #6439 grade.