Commit b42ffc1c4434714bfb6ced89ac200427f5e754b8

Authored by tfmoraes
1 parent 8cbb2a51

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 271  
272 272 # The following lines have to be here, otherwise all volumes disappear
273 273 if not volume:
  274 + triangle_filter = vtk.vtkTriangleFilter()
  275 + triangle_filter.SetInput(polydata)
  276 + triangle_filter.Update()
  277 +
274 278 measured_polydata = vtk.vtkMassProperties()
275   - measured_polydata.SetInput(polydata)
  279 + measured_polydata.SetInput(triangle_filter.GetOutput())
276 280 volume = measured_polydata.GetVolume()
277 281 surface.volume = volume
  282 + print ">>>>", surface.volume
278 283 else:
279 284 surface.volume = volume
280 285 self.last_surface_index = surface.index
... ...