Commit cd846ac9fe6fc8e8e5b33f87a6f9ef006493cd60

Authored by tatiana
1 parent cfd1a0b9

ADD: Surface duplication working... :)

Showing 1 changed file with 7 additions and 8 deletions   Show diff stats
invesalius/data/surface.py
... ... @@ -128,11 +128,9 @@ class SurfaceManager():
128 128  
129 129 ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces")
130 130 ps.Publisher().subscribe(self.OnRemove,"Remove surfaces")
131   - ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces")
132 131  
133 132  
134 133 def OnDuplicate(self, pubsub_evt):
135   -
136 134 selected_items = pubsub_evt.data
137 135 proj = prj.Project()
138 136 surface_dict = proj.surface_dict
... ... @@ -151,7 +149,6 @@ class SurfaceManager():
151 149 volume = original_surface.volume)
152 150  
153 151  
154   -
155 152 def OnRemove(self, pubsub_evt):
156 153 selected_items = pubsub_evt.data
157 154 proj = prj.Project()
... ... @@ -230,7 +227,6 @@ class SurfaceManager():
230 227 def CreateSurfaceFromPolydata(self, polydata, overwrite=False,
231 228 name=None, colour=None,
232 229 transparency=None, volume=None):
233   -
234 230 normals = vtk.vtkPolyDataNormals()
235 231 normals.SetInput(polydata)
236 232 normals.SetFeatureAngle(80)
... ... @@ -260,10 +256,7 @@ class SurfaceManager():
260 256 if name:
261 257 surface.name = name
262 258  
263   - # Set actor colour and transparency
264   - actor.GetProperty().SetColor(surface.colour)
265   - actor.GetProperty().SetOpacity(1-surface.transparency)
266   - self.actors_dict[surface.index] = actor
  259 +
267 260  
268 261 # Append surface into Project.surface_dict
269 262 proj = prj.Project()
... ... @@ -274,6 +267,11 @@ class SurfaceManager():
274 267 surface.index = index
275 268 self.last_surface_index = index
276 269  
  270 + # Set actor colour and transparency
  271 + actor.GetProperty().SetColor(surface.colour)
  272 + actor.GetProperty().SetOpacity(1-surface.transparency)
  273 + self.actors_dict[surface.index] = actor
  274 +
277 275 session = ses.Session()
278 276 session.ChangeProject()
279 277  
... ... @@ -569,6 +567,7 @@ class SurfaceManager():
569 567 index, value = pubsub_evt.data
570 568 self.ShowActor(index, value)
571 569  
  570 +
572 571 def ShowActor(self, index, value):
573 572 """
574 573 Show or hide actor, according to given actor index and value.
... ...