Commit bcdbafa48b612c73d73288ad664089a70e117f27

Authored by Thiago Franco de Moraes
1 parent 5311ac77
Exists in surface_area

Copying area when duplicating surface

Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
invesalius/data/surface.py
... ... @@ -170,7 +170,8 @@ class SurfaceManager():
170 170 name = new_name,
171 171 colour = original_surface.colour,
172 172 transparency = original_surface.transparency,
173   - volume = original_surface.volume)
  173 + volume = original_surface.volume,
  174 + area = original_surface.area)
174 175  
175 176 def OnRemove(self, pubsub_evt):
176 177 selected_items = pubsub_evt.data
... ... @@ -246,7 +247,7 @@ class SurfaceManager():
246 247  
247 248 def CreateSurfaceFromPolydata(self, polydata, overwrite=False,
248 249 name=None, colour=None,
249   - transparency=None, volume=None):
  250 + transparency=None, volume=None, area=None):
250 251 normals = vtk.vtkPolyDataNormals()
251 252 normals.SetInputData(polydata)
252 253 normals.SetFeatureAngle(80)
... ... @@ -296,7 +297,7 @@ class SurfaceManager():
296 297 session.ChangeProject()
297 298  
298 299 # The following lines have to be here, otherwise all volumes disappear
299   - if not volume:
  300 + if not volume or not area:
300 301 triangle_filter = vtk.vtkTriangleFilter()
301 302 triangle_filter.SetInputData(polydata)
302 303 triangle_filter.Update()
... ... @@ -311,6 +312,8 @@ class SurfaceManager():
311 312 print ">>>>", surface.volume
312 313 else:
313 314 surface.volume = volume
  315 + surface.area = area
  316 +
314 317 self.last_surface_index = surface.index
315 318  
316 319 Publisher.sendMessage('Load surface actor into viewer', actor)
... ...