-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Rescale image data if outside float32
precision
#6537
Conversation
Rescale image data before send it to vispy if outside rendered working range
_coerce_contrast_limits
function and use itfloat32
precision
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6537 +/- ##
==========================================
- Coverage 92.29% 92.27% -0.03%
==========================================
Files 604 605 +1
Lines 54037 54185 +148
==========================================
+ Hits 49876 49999 +123
- Misses 4161 4186 +25 ☔ View full report in Codecov by Sentry. |
Thanks @Czaki, this method looks like it handles the toy example in the 'Steps to Reproduce' of #6533. However, I am still having trouble with my actual images. An example is this image. |
@jnahlers Your case is different from described in the original issue. In this case, is small contrast limits for big values. But it looks like I could easily fix the code to work with your data. |
It looks like there is still some kind of overflow happening? Check out this array, specifically around index 50 (i.e. [50,:,:]). |
Now It should be better. I forgot to cast infinity to float32. |
@Czaki I think that test fail is real related to the uninitialized float64 |
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
No. The error was the result of mistaking scale and offset. For testability, I move logic to |
@jnahlers It looks like I have made a bug when merging main into this PR. I have fixed it now. |
As far as I could check, the tests are failing now because of Random is bad because its slowdown test suite. |
Even with int could we get something strange, given that fact that it's Going forward, could we make a set of arrays of different size/shapes using random.random and then reuse them everywhere else? |
No. Int cannot be something strange. We could create preset of data using fixtures. |
@Czaki Ping me if you want to me try the branch again, right now I'm still seeing black on the examples. Thanks for you work on this! |
I have removed an important change when removing debug print.... |
This is how it looks on my machine: napari_scale-2024-01-30_11.59.36.mp4I do not understand the source of vertical artifacts. But as it looks like thumbnail do not have such artifacts, maybe rescale up could be done smarter. |
@jnahlers Is it ok now? |
Looks good! |
References and relevant issues
closes #6533
Description
Add check if image data could be visualized using vispy and if not, then rescale data.