-
-
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
Bugfix: IndexError slicing Surface with higher-dimensional vertex_values #5635
Conversation
for more information, see https://pre-commit.ci
Actually, one thing I haven't checked: how does it behave with higher dimensional vertex data, if at all? |
The limits for the slider for the vertex data are calculated separately (just above this) and appended. So I think it just works? I have tested and it seemed okay to me but again I'm not too familiar with this code and want to make sure it is working as expected with multiple layers. |
Codecov Report
@@ Coverage Diff @@
## main #5635 +/- ##
=======================================
Coverage 89.85% 89.86%
=======================================
Files 611 611
Lines 51669 51669
=======================================
+ Hits 46428 46432 +4
+ Misses 5241 5237 -4
... and 3 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hmm - even on |
Okay I spent some time and understand the extra dims on the vertices a bit more. I think this is ready for review. Here's some sample code that will split a cow in half and assign (3, 3) random sets of from vispy.io import imread, load_data_file, read_mesh
import numpy as np
mesh_path = load_data_file('spot/spot.obj.gz')
vertices, faces, *_ = read_mesh(mesh_path)
v = np.pad(vertices, ((0, 0), (2, 0)))
v[np.where(vertices[:, 0] < 0), 0] = 1
values = np.random.random((3, 3, len(v)))
viewer.add_surface((v, faces, values)) So in this screenshot slider 2 is the extra dim on the vertices, and sliders 1 and 0 are the extra dims on the values. Edit: #4334 I think would be really useful here |
There was a problem hiding this 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 then :) pity that black is doing one of its weird refactors :/
Yes I was tempted to reformat that, but oh well :/ |
Sorry @aganders3 , forgot about this one. Failures may be unrelated, but I'm not sure. Rerunning tests. |
This one (pyside6, 3.10 ubuntu) |
Thanks @psobolewskiPhD for checking; let's mark as ready to merge then :) |
Thanks to both of you for following up! |
…ues (napari#5635) # Description This fixes an off-by-one error on Surface layers extent data, which was causing an IndexError slicing that dimension. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # References closes napari#5620 Disussed in [community meeting on 2023-03-15](https://hackmd.io/BXWDZ3i8Q6OAEASrkaSNIQ?view#2023-03-15) # How has this been tested? - [x] all tests pass with my change (though I had to change two of them) - [x] thanks to @brisvag who [tested to make sure the mesh was in the correct spot wrt an image](napari#5620 (comment)) ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have added tests that prove my fix is effective or that my feature works - [x] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html). --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ues (#5635) # Description This fixes an off-by-one error on Surface layers extent data, which was causing an IndexError slicing that dimension. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # References closes #5620 Disussed in [community meeting on 2023-03-15](https://hackmd.io/BXWDZ3i8Q6OAEASrkaSNIQ?view#2023-03-15) # How has this been tested? - [x] all tests pass with my change (though I had to change two of them) - [x] thanks to @brisvag who [tested to make sure the mesh was in the correct spot wrt an image](#5620 (comment)) ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have added tests that prove my fix is effective or that my feature works - [x] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html). --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ues (#5635) # Description This fixes an off-by-one error on Surface layers extent data, which was causing an IndexError slicing that dimension. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # References closes #5620 Disussed in [community meeting on 2023-03-15](https://hackmd.io/BXWDZ3i8Q6OAEASrkaSNIQ?view#2023-03-15) # How has this been tested? - [x] all tests pass with my change (though I had to change two of them) - [x] thanks to @brisvag who [tested to make sure the mesh was in the correct spot wrt an image](#5620 (comment)) ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have added tests that prove my fix is effective or that my feature works - [x] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html). --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ues (#5635) # Description This fixes an off-by-one error on Surface layers extent data, which was causing an IndexError slicing that dimension. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # References closes #5620 Disussed in [community meeting on 2023-03-15](https://hackmd.io/BXWDZ3i8Q6OAEASrkaSNIQ?view#2023-03-15) # How has this been tested? - [x] all tests pass with my change (though I had to change two of them) - [x] thanks to @brisvag who [tested to make sure the mesh was in the correct spot wrt an image](#5620 (comment)) ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have added tests that prove my fix is effective or that my feature works - [x] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html). --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ues (#5635) # Description This fixes an off-by-one error on Surface layers extent data, which was causing an IndexError slicing that dimension. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # References closes #5620 Disussed in [community meeting on 2023-03-15](https://hackmd.io/BXWDZ3i8Q6OAEASrkaSNIQ?view#2023-03-15) # How has this been tested? - [x] all tests pass with my change (though I had to change two of them) - [x] thanks to @brisvag who [tested to make sure the mesh was in the correct spot wrt an image](#5620 (comment)) ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have added tests that prove my fix is effective or that my feature works - [x] If I included new strings, I have used `trans.` to make them localizable. For more information see our [translations guide](https://napari.org/developers/translations.html). --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Description
This fixes an off-by-one error on Surface layers extent data, which was causing an IndexError slicing that dimension.
Type of change
References
closes #5620
Disussed in community meeting on 2023-03-15
How has this been tested?
Final checklist:
trans.
to make them localizable.For more information see our translations guide.