Commit 93cfccd2dcedf8bd6e0ed88f7ee04261fc353071
1 parent
51c65c2f
Exists in
master
and in
67 other branches
ENH: Added surface interpolation option
Showing
3 changed files
with
24 additions
and
8 deletions
Show diff stats
invesalius/data/surface.py
... | ... | @@ -128,8 +128,8 @@ class SurfaceManager(): |
128 | 128 | |
129 | 129 | ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces") |
130 | 130 | ps.Publisher().subscribe(self.OnRemove,"Remove surfaces") |
131 | - | |
132 | - | |
131 | + ps.Publisher().subscribe(self.UpdateSurfaceInterpolation, 'Update Surface Interpolation') | |
132 | + | |
133 | 133 | def OnDuplicate(self, pubsub_evt): |
134 | 134 | selected_items = pubsub_evt.data |
135 | 135 | proj = prj.Project() |
... | ... | @@ -508,7 +508,7 @@ class SurfaceManager(): |
508 | 508 | smoother.Update() |
509 | 509 | polydata = smoother.GetOutput() |
510 | 510 | |
511 | - print "Normals" | |
511 | + | |
512 | 512 | normals = vtk.vtkPolyDataNormals() |
513 | 513 | normals.SetInput(polydata) |
514 | 514 | normals.SetFeatureAngle(80) |
... | ... | @@ -537,7 +537,6 @@ class SurfaceManager(): |
537 | 537 | # Represent an object (geometry & properties) in the rendered scene |
538 | 538 | actor = vtk.vtkActor() |
539 | 539 | actor.SetMapper(mapper) |
540 | - | |
541 | 540 | # Create Surface instance |
542 | 541 | if overwrite: |
543 | 542 | surface = Surface(index = self.last_surface_index) |
... | ... | @@ -550,6 +549,13 @@ class SurfaceManager(): |
550 | 549 | actor.GetProperty().SetColor(colour) |
551 | 550 | actor.GetProperty().SetOpacity(1-surface.transparency) |
552 | 551 | |
552 | + prop = actor.GetProperty() | |
553 | + | |
554 | + interpolation = int(ses.Session().surface_interpolation) | |
555 | + | |
556 | + prop.SetInterpolation(interpolation) | |
557 | + #prop.SetInterpolationToPhong() | |
558 | + | |
553 | 559 | # Remove temporary files |
554 | 560 | #if sys.platform == "win32": |
555 | 561 | # try: |
... | ... | @@ -606,6 +612,16 @@ class SurfaceManager(): |
606 | 612 | |
607 | 613 | ps.Publisher().sendMessage('End busy cursor') |
608 | 614 | |
615 | + | |
616 | + def UpdateSurfaceInterpolation(self, pub_evt): | |
617 | + interpolation = int(ses.Session().surface_interpolation) | |
618 | + key_actors = self.actors_dict.keys() | |
619 | + | |
620 | + for key in self.actors_dict: | |
621 | + self.actors_dict[key].GetProperty().SetInterpolation(interpolation) | |
622 | + ps.Publisher().sendMessage('Render volume viewer') | |
623 | + | |
624 | + | |
609 | 625 | def RemoveActor(self, index): |
610 | 626 | """ |
611 | 627 | Remove actor, according to given actor index. |
... | ... | @@ -626,7 +642,6 @@ class SurfaceManager(): |
626 | 642 | index, value = pubsub_evt.data |
627 | 643 | self.ShowActor(index, value) |
628 | 644 | |
629 | - | |
630 | 645 | def ShowActor(self, index, value): |
631 | 646 | """ |
632 | 647 | Show or hide actor, according to given actor index and value. | ... | ... |
invesalius/data/viewer_volume.py
invesalius/gui/frame.py
... | ... | @@ -332,11 +332,10 @@ class Frame(wx.Frame): |
332 | 332 | |
333 | 333 | ses.Session().rendering = values[const.RENDERING] |
334 | 334 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] |
335 | - | |
335 | + | |
336 | 336 | ps.Publisher().sendMessage('Remove Volume') |
337 | 337 | ps.Publisher().sendMessage('Reset Reaycasting') |
338 | - | |
339 | - | |
338 | + ps.Publisher().sendMessage('Update Surface Interpolation') | |
340 | 339 | |
341 | 340 | def ShowAbout(self): |
342 | 341 | """ | ... | ... |