Skip to content

Add collision check when set colors for labels layer#6193

Merged
Czaki merged 5 commits intonapari:mainfrom
Czaki:validate_color_collision
Sep 5, 2023
Merged

Add collision check when set colors for labels layer#6193
Czaki merged 5 commits intonapari:mainfrom
Czaki:validate_color_collision

Conversation

@Czaki
Copy link
Copy Markdown
Collaborator

@Czaki Czaki commented Aug 28, 2023

Description

This PR adds a check if two user-defined colors for labels above 2*23 collide in the same value after being cast to float32.

We need to cast values to this type because of the texture mechanism currently used.

References and relevant issues

extracted from #6182 requested in #6182 (comment)

@github-actions github-actions bot added the tests Something related to our tests label Aug 28, 2023
@Czaki Czaki added this to the 0.4.19 milestone Aug 28, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 28, 2023

Codecov Report

Merging #6193 (0859002) into main (bc3c1e3) will increase coverage by 0.01%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #6193      +/-   ##
==========================================
+ Coverage   91.66%   91.68%   +0.01%     
==========================================
  Files         582      582              
  Lines       51064    51095      +31     
==========================================
+ Hits        46810    46844      +34     
+ Misses       4254     4251       -3     
Files Changed Coverage Δ
napari/layers/labels/_tests/test_labels.py 100.00% <100.00%> (ø)
napari/layers/labels/labels.py 97.81% <100.00%> (+0.05%) ⬆️

... and 2 files with indirect coverage changes

Copy link
Copy Markdown
Contributor

@brisvag brisvag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice speedup changes! LGTM.

@Czaki Czaki added the ready to merge Last chance for comments! Will be merged in ~24h label Aug 30, 2023
@Czaki Czaki merged commit d58ff84 into napari:main Sep 5, 2023
@Czaki Czaki deleted the validate_color_collision branch September 5, 2023 11:20
@melonora melonora removed the ready to merge Last chance for comments! Will be merged in ~24h label Sep 14, 2023
kne42 added a commit to kne42/napari that referenced this pull request Sep 19, 2023
* main: (26 commits)
  Fix some typing in napari.components (napari#6203)
  Use class name for object that does not have qt name (napari#6222)
  test: [Automatic] Constraints upgrades: `hypothesis`, `magicgui`, `psygnal`, `tensorstore`, `tifffile`, `tqdm`, `virtualenv` (napari#6143)
  Replace more np.all( ... = ...) with np.array_equal (napari#6213)
  remove np.all(... == ...) in test_surface.py (napari#6218)
  Ensure pandas Series is initialized with a list as data (napari#6226)
  Stop using temporary directory for store array for paint test (napari#6191)
  Bugfix: ensure thumbnail represents canvas when multiscale (napari#6200)
  cleanup np.all(... == ...) from test_points.py (napari#6217)
  [pre-commit.ci] pre-commit autoupdate (napari#6221)
  use app-model for file menu (napari#4865)
  Add tests to cover slicing behavior when changing layers and data (napari#4819)
  [pre-commit.ci] pre-commit autoupdate (napari#6128)
  Add test coverage for async slicing of labels (napari#5325)
  Add collision check when set colors for labels layer (napari#6193)
  Update "toggle ndview" text (napari#6192)
  Prevent layer controls buttons changing layout while taking screenshots with flash effect on (napari#6194)
  Fix typing in napari.utils.perf (napari#6132)
  Add GUI test coverage for changes to Labels.show_selected_label (napari#5372)
  Fix types in 'napari.utils.colormaps.categorical_colormap' (napari#6154)
  ...
Czaki added a commit that referenced this pull request Oct 17, 2023
This PR adds a check if two user-defined colors for labels above 2*23
collide in the same value after being cast to float32.

We need to cast values to this type because of the texture mechanism
currently used.

extracted from #6182 requested in
#6182 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement tests Something related to our tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants