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

MAINT: remove vendored colorconv from skimage. #5180

Merged
merged 1 commit into from
Nov 1, 2022
Merged

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Oct 5, 2022

As it seem skimage is a dependency, I don't think we need to vendor this anymore.

if we vendor it, then we likely want to have a script that automatically check for updates – or make sure this file is not modified manually.

Also if vendored, it is likely better placed in napari/_vendor, where everything is vendored.

Description

Type of change

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

References

How has this been tested?

  • example: the test suite for my feature covers cases x, y, and z
  • example: all tests pass with my change
  • example: I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • If I included new strings, I have used trans. to make them localizable.
    For more information see our translations guide.

@Carreau Carreau marked this pull request as ready for review October 5, 2022 13:21
@codecov
Copy link

codecov bot commented Oct 5, 2022

Codecov Report

Merging #5180 (0e81e31) into main (ef66089) will increase coverage by 0.17%.
The diff coverage is 100.00%.

❗ Current head 0e81e31 differs from pull request most recent head 2272623. Consider uploading reports for the commit 2272623 to get more accurate results

@@            Coverage Diff             @@
##             main    #5180      +/-   ##
==========================================
+ Coverage   88.76%   88.94%   +0.17%     
==========================================
  Files         579      571       -8     
  Lines       49113    48629     -484     
==========================================
- Hits        43596    43253     -343     
+ Misses       5517     5376     -141     
Impacted Files Coverage Δ
napari/utils/colormaps/colormap_utils.py 93.13% <100.00%> (+0.03%) ⬆️
napari/utils/_appdirs.py 55.55% <0.00%> (-3.07%) ⬇️
napari/utils/key_bindings.py 93.24% <0.00%> (-2.65%) ⬇️
napari/utils/validators.py 93.33% <0.00%> (-2.50%) ⬇️
napari/utils/interactions.py 72.09% <0.00%> (-2.44%) ⬇️
napari/components/dims.py 97.71% <0.00%> (-1.71%) ⬇️
napari/_app_model/constants/_menus.py 94.11% <0.00%> (-1.34%) ⬇️
napari/_qt/qt_main_window.py 75.23% <0.00%> (-1.15%) ⬇️
napari/_app_model/constants/_commands.py 97.36% <0.00%> (-0.78%) ⬇️
napari/settings/_yaml.py 90.90% <0.00%> (-0.76%) ⬇️
... and 71 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@andy-sweet andy-sweet left a comment

Choose a reason for hiding this comment

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

Looks good to me. Looks like this was added a while back, so this was probably just forgotten.

As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
@Carreau
Copy link
Contributor Author

Carreau commented Nov 1, 2022

Thanks.

@psobolewskiPhD
Copy link
Member

@Carreau
On main I'm getting a warning when making a Labels layer:

/Users/piotrsobolewski/Dev/miniforge3/envs/napari-dev/lib/python3.10/site-packages/skimage/_shared/utils.py:394: UserWarning: Color data out of range: Z < 0 in 20 pixels!

Bisect pointed to this PR.
Seems like lab2xyz was changed in skimage vs. the vendored version, see:
https://github.com/scikit-image/scikit-image/blob/6a38eac250a6f905edfd62c301b47a0957248ac8/skimage/color/colorconv.py#L1023

@Carreau
Copy link
Contributor Author

Carreau commented Nov 7, 2022

Yeah, I sent the PR upstream that modified the warning stacklevel as the warning was silent.
So this warning has been here for a looong time, but invisible.

@psobolewskiPhD
Copy link
Member

I see, so maybe we should open an issue here in napari to track down the source of the issue in labels and fix it.

@Carreau
Copy link
Contributor Author

Carreau commented Nov 8, 2022

I see, so maybe we should open an issue here in napari to track down the source of the issue in labels and fix it.

Yes, I think that would be a good thing, I will try to re-trigger it with main of skimage to actually find the correct place where incorrect data is passed in, and scikit-image/scikit-image#6613 will make it much easier.

Unless you get to it first...

@Carreau
Copy link
Contributor Author

Carreau commented Nov 8, 2022

So the warning in napari emanates from this line:

raw_rgb = colorconv.lab2rgb(random * LABRNG + LABMIN)

I'm not familiar enough with lab and XYZ colorspace to understand why this is a problem, and what to do about it.

jni pushed a commit that referenced this pull request Dec 14, 2022
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
melissawm pushed a commit to melissawm/napari that referenced this pull request Jan 11, 2023
…ates (napari#5386)

Closes napari#5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in napari#175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
napari#5180) we removed the vendored code, which caused the warning to be
issued (napari#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
@Czaki Czaki mentioned this pull request Jun 7, 2023
@Czaki Czaki added this to the 0.4.18 milestone Jun 7, 2023
@Czaki Czaki added maintenance PR with maintance changes, triaged-0.4.18 To mark PR that is triaged in 0.4.18 release process labels Jun 7, 2023
Czaki pushed a commit that referenced this pull request Jun 16, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
Czaki pushed a commit that referenced this pull request Jun 17, 2023
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
Czaki pushed a commit that referenced this pull request Jun 17, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
Czaki pushed a commit that referenced this pull request Jun 18, 2023
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
Czaki pushed a commit that referenced this pull request Jun 18, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
Czaki pushed a commit that referenced this pull request Jun 19, 2023
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
Czaki pushed a commit that referenced this pull request Jun 19, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
…ates (#5386)

Closes #5311

Our default Labels colormap is generated by sampling uniformly at random
from the unit cube. These 3-tuples are intended to be coordinates in the
CIELAB colorspace, but some of those coordinates may not be valid since
that space is not linear. We then convert those coordinates to their
corresponding RGB vectors. The scikit-image color conversion function
handles this by projecting those invalid vectors, but it also issues a
warning when doing so. This whole process approximates sampling
uniformly at random over the CIELAB colorspace and the projection adds a
little more error to the approximation, but overall it's good enough.

Originally (in #175), we vendored code from scikit-image to handle color
space conversion and removed this warning in our copy (see d1bb715).
Later, we brought in scikit-image as a dependency. Then recently (in
#5180) we removed the vendored code, which caused the warning to be
issued (#5311).

This PR specifically suppresses that warning.

It also expands on the explanatory comment describing how the min and
max values in the LAB and LUV spaces were precomputed.
Czaki pushed a commit that referenced this pull request Jun 21, 2023
As it seem skimage is a dependency, I don't think we need to vendor this
anymore.

_if_ we vendor it, then we likely want to have a script that
automatically check for updates – or make sure this file is not modified
manually.

Also if vendored, it is likely better placed in napari/_vendor, where
everything is vendored.
@Carreau Carreau deleted the vdr branch October 2, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance PR with maintance changes, triaged-0.4.18 To mark PR that is triaged in 0.4.18 release process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants