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

Fix colormapping nD images #5805

Merged
merged 6 commits into from
May 23, 2023
Merged

Fix colormapping nD images #5805

merged 6 commits into from
May 23, 2023

Conversation

brisvag
Copy link
Contributor

@brisvag brisvag commented May 4, 2023

Description

Colormap mapping of arrays with more than 1 dimension is broken due to stacking along the wrong dimension.

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

@brisvag brisvag changed the title fix mapping of colormap Fix colormapping nD images May 4, 2023
@brisvag brisvag added the bugfix PR with bugfix label May 4, 2023
@github-actions github-actions bot added the tests Something related to our tests label May 4, 2023
@codecov
Copy link

codecov bot commented May 4, 2023

Codecov Report

Merging #5805 (131edba) into main (39b42e6) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #5805      +/-   ##
==========================================
- Coverage   89.96%   89.96%   -0.01%     
==========================================
  Files         615      616       +1     
  Lines       52639    52633       -6     
==========================================
- Hits        47359    47349      -10     
- Misses       5280     5284       +4     
Impacted Files Coverage Δ
napari/utils/colormaps/_tests/test_colormap.py 100.00% <100.00%> (ø)
napari/utils/colormaps/colormap.py 98.07% <100.00%> (ø)

... and 12 files with indirect coverage changes

@brisvag brisvag requested a review from Czaki May 4, 2023 16:16
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.

Thanks for the quick fix. Just had a minor comment that's optional to address.

napari/utils/colormaps/_tests/test_colormap.py Outdated Show resolved Hide resolved
@andy-sweet andy-sweet added the ready to merge Last chance for comments! Will be merged in ~24h label May 16, 2023
@Czaki Czaki added this to the 0.4.18 milestone May 21, 2023
@Czaki Czaki removed the ready to merge Last chance for comments! Will be merged in ~24h label May 22, 2023
Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
@andy-sweet andy-sweet added the ready to merge Last chance for comments! Will be merged in ~24h label May 22, 2023
@andy-sweet
Copy link
Member

Restarting the 24h clock. I'll likely merge this tomorrow.

@andy-sweet andy-sweet merged commit 0bc1adc into napari:main May 23, 2023
34 checks passed
@Czaki Czaki removed the ready to merge Last chance for comments! Will be merged in ~24h label May 24, 2023
@Czaki Czaki mentioned this pull request Jun 7, 2023
Czaki pushed a commit that referenced this pull request Jun 19, 2023
# Description
Colormap mapping of arrays with more than 1 dimension is broken due to stacking along the wrong dimension.

## Type of change
- [x] Bug-fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Czaki pushed a commit that referenced this pull request Jun 21, 2023
# Description
Colormap mapping of arrays with more than 1 dimension is broken due to stacking along the wrong dimension.

## Type of change
- [x] Bug-fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Czaki pushed a commit that referenced this pull request Jun 21, 2023
# Description
Colormap mapping of arrays with more than 1 dimension is broken due to stacking along the wrong dimension.

## Type of change
- [x] Bug-fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
Czaki pushed a commit that referenced this pull request Jun 21, 2023
# Description
Colormap mapping of arrays with more than 1 dimension is broken due to stacking along the wrong dimension.

## Type of change
- [x] Bug-fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Andy Sweet <andrew.d.sweet@gmail.com>
brisvag added a commit that referenced this pull request Jul 23, 2023
# Description
When working with custom colormaps, reader and writers trying to use
that colormap will fail because the only information returned by
`Layer.get_state` is the colormap name. This works fine with builtin
colormaps, but anything custom will fail due to `[unnamed colormap 0]`
not existing.

By returning the full colormap model (in dict form) we can also account
for this.

Plugin writers and readers using `colormap` will likely break (like our
napari-svg) because they assume it to be a string.

Note that this includes #5805. which is a lot smaller and just a bug
fix.

# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

---------

Co-authored-by: Kyle I S Harrington <kephale@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR with bugfix tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants