-
Notifications
You must be signed in to change notification settings - Fork 4
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 vedo api #88
base: main
Are you sure you want to change the base?
Fix vedo api #88
Conversation
@@ -42,7 +42,7 @@ | |||
smooth_pointcloud_moving_least_squares_2d_radius, | |||
smooth_pointcloud_moving_least_squares_2d, | |||
reconstruct_surface_from_pointcloud, | |||
connected_component_labeling | |||
split_mesh |
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.
This change seems unrelated to the PR title. Also does it break backwards compatibility?
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.
@haesleinhuepf Thanks for looking at this. I thought about it for a while and came to the conclusion that it really is a breaking change, already from the vedo side. The original compute_connectivity
function allowed to retrieve a per-vertex label which indicated to which object it belonged, which we could then nicely display as the vertex color.
In the new version, the id
of each vertex isn't public anymore and vedo just returns a list [mesh1, mesh2, ...]
of the connected components :/
To answer your question: The function mesh.compute_connectivity()
has been renamed in vedo to mesh.split()
so I'd consider that as part of an API change, and it has been done so in a breaking way.
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.
But we could use the split function to implement what has been there before, correct? I'm asking because I'm using this stuff in projects. Removing it is no option
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.
But we could use the split function to implement what has been there before, correct? I'm asking because I'm using this stuff in projects. Removing it is no option
I'm not sure, tbh. The split function never exposes which vertex belongs to which object. -_-
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.
But it gives lists of vertices grouped, no?
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.
It returns a list of meshes. Each mesh consists of vertices [0, n_mesh_i]
napari_process_points_and_surfaces/_tests/test_vedo_functions.py
Outdated
Show resolved
Hide resolved
Hey Johannes @jo-mueller , thanks for working on this! Before merging this, it would be great to turn backwards compatibility breaking changes into deprecations. This reduces bugs in scripts which use our library. In general I tend to avoid backwards compatibility breaking changes whenever possible. Furthermore, could you please specify the vedo version this is compatible with here: Thanks! Best, |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
==========================================
+ Coverage 72.91% 73.08% +0.17%
==========================================
Files 8 8
Lines 1115 1137 +22
==========================================
+ Hits 813 831 +18
- Misses 302 306 +4 ☔ View full report in Codecov by Sentry. |
Hi @haesleinhuepf , I think keeping the
Let me know what you think |
Yes, that sounds great! Does the code-snippet work already? |
Just pulled it out of my fingers, not really ^^" I think editing the list of which is being iterated may become a bit of a mess. Using a while-loop instead that checks whether there are still elements left in I'll write it clean in the coming days 👍 |
@haesleinhuepf , I re-implemented the deprecated |
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.
Thanks for working on this @jo-mueller . Just two minor clean up requests. We're almost there.
Thanks!
napari_process_points_and_surfaces/_tests/test_vedo_functions.py
Outdated
Show resolved
Hide resolved
@haesleinhuepf Thanks for the review, here goes. Sorry about the |
Give |
I know, I do use it, but in case a test fails find it very helpful to step through the test with the debugger line by line, for which you need a |
@haesleinhuepf so....can this go in? 👼 Happy new year btw :) Edit: I think with this going through, tests for #83 should also pass. |
I have to find the time to test this carefully... Will not happen before February I presume... |
Hi @haesleinhuepf , pinging you here again - do you mind if I merge this? The bug with the changed API in the |
Fixes #87
Changes
mesh.points()
withmesh.vertices
mesh.faces()
withmesh.cells
mesh.CenterOfMass
withmesh.center_of_mass
mesh.origin
connected_components_labeling
in vtk since it is deprecated on the vedo sidesplit_mesh
and_split_mesh
.SurfaceTuple
, which render nicely in notebooks and which is exposed to the nppas APILayerDataTuple
and is only visible through napari.About the latter one: It's a bit unfortunate that the previous
compute_connectivity
, which assigned a label to each vertex doesn't exist anymore. The newmesh.split()
function returns a list of vedo meshes, for which I don't know any better way to return them to napari other than returning aList[LayerDataTuple]
. An option could be to additionally pass an index of a mesh to extract from the split, but the downside is that selecting the index would be a bit ambiguous since you wouldn't know from looking at the mesh which index you'd have to select in order to get the desired object from the mesh 🤔