Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py
index 8845085..79ba515 100644
--- a/invesalius/data/surface.py
+++ b/invesalius/data/surface.py
@@ -774,16 +774,16 @@ class SurfaceManager():
session = ses.Session()
session.ChangeProject()
- # The following lines have to be here, otherwise all volumes disappear
- measured_polydata = vtk.vtkMassProperties()
- # measured_polydata.ReleaseDataFlagOn()
- measured_polydata.SetInputData(to_measure)
- volume = float(measured_polydata.GetVolume())
- area = float(measured_polydata.GetSurfaceArea())
- surface.volume = volume
- surface.area = area
- self.last_surface_index = surface.index
- del measured_polydata
+ if wx.GetApp() is not None:
+ measured_polydata = vtk.vtkMassProperties()
+ # measured_polydata.ReleaseDataFlagOn()
+ measured_polydata.SetInputData(to_measure)
+ volume = float(measured_polydata.GetVolume())
+ area = float(measured_polydata.GetSurfaceArea())
+ surface.volume = volume
+ surface.area = area
+ self.last_surface_index = surface.index
+ del measured_polydata
del to_measure
Publisher.sendMessage('Load surface actor into viewer', actor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment