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 casting uint32 to vispy dtype for image layers #6456

Merged
merged 3 commits into from Nov 17, 2023

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Nov 15, 2023

References and relevant issues

extracted from #6439

Description

Before this PR

Zrzut ekranu z 2023-11-15 10-13-11

After this PR

Zrzut ekranu z 2023-11-15 10-20-24

Script to reproduce:

import numpy as np

import napari

# Set the number of steps
nb_steps = 2**17

base = np.linspace(start=1, stop=nb_steps, num=nb_steps).astype('uint32')
label_img = np.repeat(
        base.reshape([1, base.shape[0]]), int(nb_steps/1000), axis=0
        )

viewer = napari.Viewer()
viewer.add_image(label_img, colormap='viridis', contrast_limits=(0, nb_steps), scale=(100, 1))

napari.run()

@Czaki Czaki requested a review from jni November 15, 2023 09:22
@Czaki Czaki added this to the 0.4.19 milestone Nov 15, 2023
@github-actions github-actions bot added tests Something related to our tests qt Relates to qt labels Nov 15, 2023
@Czaki Czaki added bugfix PR with bugfix and removed tests Something related to our tests qt Relates to qt labels Nov 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2fc6124) 92.23% compared to head (0a34176) 92.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6456      +/-   ##
==========================================
- Coverage   92.23%   92.16%   -0.07%     
==========================================
  Files         601      601              
  Lines       53167    53174       +7     
==========================================
- Hits        49037    49009      -28     
- Misses       4130     4165      +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Carreau Carreau added the ready to merge Last chance for comments! Will be merged in ~24h label Nov 15, 2023
Copy link
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

@Czaki what do you think about adding the script to examples/dev or examples/dev/issues? We could make a habit of that because sometimes our tests don't capture the final behavior that we see in the canvas (see #6411 breaking direct color mode). So it would be nice to have a set of scripts that we can go back to to figure out when something untested broke.

@github-actions github-actions bot added tests Something related to our tests qt Relates to qt labels Nov 17, 2023
@jni jni changed the title Fix casting uint32 to vispy dtype Fix casting uint32 to vispy dtype for image layers Nov 17, 2023
@jni jni merged commit 384cf68 into napari:main Nov 17, 2023
32 checks passed
@jni jni deleted the bugfix/casting_big_images branch November 17, 2023 23:34
@jni jni removed the ready to merge Last chance for comments! Will be merged in ~24h label Nov 17, 2023
Czaki added a commit that referenced this pull request Nov 22, 2023
extracted from #6439

Before this PR

![Zrzut ekranu z 2023-11-15
10-13-11](https://github.com/napari/napari/assets/3826210/34d16d83-5e36-4c95-8fd2-0527aae61370)

After this PR

![Zrzut ekranu z 2023-11-15
10-20-24](https://github.com/napari/napari/assets/3826210/90f7f2ca-55dd-405b-9d22-05f6d79ddb77)

Script to reproduce:

```python
import numpy as np

import napari

nb_steps = 2**17

base = np.linspace(start=1, stop=nb_steps, num=nb_steps).astype('uint32')
label_img = np.repeat(
        base.reshape([1, base.shape[0]]), int(nb_steps/1000), axis=0
        )

viewer = napari.Viewer()
viewer.add_image(label_img, colormap='viridis', contrast_limits=(0, nb_steps), scale=(100, 1))

napari.run()
```

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Czaki added a commit that referenced this pull request Nov 24, 2023
extracted from #6439

Before this PR

![Zrzut ekranu z 2023-11-15
10-13-11](https://github.com/napari/napari/assets/3826210/34d16d83-5e36-4c95-8fd2-0527aae61370)

After this PR

![Zrzut ekranu z 2023-11-15
10-20-24](https://github.com/napari/napari/assets/3826210/90f7f2ca-55dd-405b-9d22-05f6d79ddb77)

Script to reproduce:

```python
import numpy as np

import napari

nb_steps = 2**17

base = np.linspace(start=1, stop=nb_steps, num=nb_steps).astype('uint32')
label_img = np.repeat(
        base.reshape([1, base.shape[0]]), int(nb_steps/1000), axis=0
        )

viewer = napari.Viewer()
viewer.add_image(label_img, colormap='viridis', contrast_limits=(0, nb_steps), scale=(100, 1))

napari.run()
```

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR with bugfix qt Relates to qt tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants