CurveCut models have same number of points as original mesh

Hello,

After using a curve cut on a 3D model, the resulting output model mesh looks fine, but when I check th point number in the output model, it still has the original number of points. Same if I save as .vtk and reimport.

If I do any calculations on the vtk polydata of the resulting model (e.g. sphere fitting), it still uses all of the original points.

If I save as .stl and reimport then the point number is updated and so is the polydata.

Is this expected behaviour?

Thank you,
Eva

If you run a Clean operation in Surface Toolbox on the output mesh does it remove the stray points?

Yes that works!

Thank you.

I can batch run the cleaning on my own files, but it might be nice to incorporate this cleaning directly into the CurveCut module, @cpinter would this be an option?

I think it would make sense. However, this module exists for years now and this has not come up yet. I use it in some of my applications myself, and have not had this problem. Maybe this is specific to your data? It would help if you showed your use case. In the meantime I’ll do some simple tests and see if this issue always happens or not.

Update: a simple test showed that the number of points is not the same after cutting. It really would help if you’d illustrate your application. Thanks

Thanks for running some tests.
I just replicated the issue.
Here is the scapula model, curve cut, inside point, resulting surface mesh (glenoid):

I also tested cleaning the scap input mesh for the curve cut first, still did not fix it.
Thank you very much,
Eva

The same behavior happens with plane cut. All of the the points were left as-is to preserve point IDs: Dynamic modeler plane cut type affecting number of points in output models - #3 by lassoan

Closed PR here: BUG: Remove unused points during plane cut by Sunderlandkyl · Pull Request #60 · Slicer/SlicerSurfaceToolbox · GitHub

We decided to leave the behavior as it was, but if it proves to be a problem then we can update it or add a flag to the relevant tools to clean the output.

@Sunderlandkyl thanks for the response!
Makes sense that it is kept to preserve the same node IDs, but yes it does lead to unexpected behaviour if fitting spheres to the new surface, running SVD etc on it

It would be great to have an option in curveCut to specify if we want cleaning or not.

Thank you!
Eva

Update:

I just uploaded a script to batch clean objects in a scene in case anyone has the same issue.
Maybe it can also be incorporated into the Dynamic Modeler module if you do end up adding the cleaning option.
Script here