Commit b42ffc1c4434714bfb6ced89ac200427f5e754b8
1 parent
8cbb2a51
Exists in
master
and in
5 other branches
FIX: When the user split, select the largest, or various surface, the vtkMassPro…
…perties because the resulting was not a homogenic triangle surface, so it is necessary to apply the vtkTriangleFilter
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
invesalius/data/surface.py
@@ -271,10 +271,15 @@ class SurfaceManager(): | @@ -271,10 +271,15 @@ class SurfaceManager(): | ||
271 | 271 | ||
272 | # The following lines have to be here, otherwise all volumes disappear | 272 | # The following lines have to be here, otherwise all volumes disappear |
273 | if not volume: | 273 | if not volume: |
274 | + triangle_filter = vtk.vtkTriangleFilter() | ||
275 | + triangle_filter.SetInput(polydata) | ||
276 | + triangle_filter.Update() | ||
277 | + | ||
274 | measured_polydata = vtk.vtkMassProperties() | 278 | measured_polydata = vtk.vtkMassProperties() |
275 | - measured_polydata.SetInput(polydata) | 279 | + measured_polydata.SetInput(triangle_filter.GetOutput()) |
276 | volume = measured_polydata.GetVolume() | 280 | volume = measured_polydata.GetVolume() |
277 | surface.volume = volume | 281 | surface.volume = volume |
282 | + print ">>>>", surface.volume | ||
278 | else: | 283 | else: |
279 | surface.volume = volume | 284 | surface.volume = volume |
280 | self.last_surface_index = surface.index | 285 | self.last_surface_index = surface.index |