From 5f52593223c438011b8222f137dd5abf6340bf14 Mon Sep 17 00:00:00 2001 From: Soto de la Cruz Ana Date: Fri, 5 Nov 2021 09:23:53 +0200 Subject: [PATCH] ADD marker arrow function to viewer volume --- invesalius/data/viewer_volume.py | 31 +++++++++++++++++++++++++++++++ invesalius/gui/task_navigator.py | 5 +++++ 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index 9ffeb62..337da1f 100644 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -277,6 +277,7 @@ class Viewer(wx.Panel): # Related to marker creation in navigation tools Publisher.subscribe(self.AddMarker, 'Add marker') + Publisher.subscribe(self.AddMarkerwithOrientation, 'Add arrow marker') Publisher.subscribe(self.HideAllMarkers, 'Hide all markers') Publisher.subscribe(self.ShowAllMarkers, 'Show all markers') Publisher.subscribe(self.RemoveAllMarkers, 'Remove all markers') @@ -601,6 +602,36 @@ class Viewer(wx.Panel): self.RemoveTarget() self.UpdateRender() + def AddMarkerwithOrientation(self, arrow_marker_id, size, color, coord): + """ + Markers with orientation created by navigation tools and rendered in volume viewer. + """ + self.arrow_marker_id = arrow_marker_id + coord_flip = list(coord) + coord_flip[1] = -coord_flip[1] + self.static_arrows.append(self.Add_ObjectArrow(self, coord_flip, coord_flip, color, size)) + # ball_ref = vtk.vtkSphereSource() + # ball_ref.SetRadius(size) + # ball_ref.SetCenter(coord_flip) + # + # mapper = vtk.vtkPolyDataMapper() + # mapper.SetInputConnection(ball_ref.GetOutputPort()) + # + # prop = vtk.vtkProperty() + # prop.SetColor(colour) + + # adding a new actor for the present ball + #self.static_arrows.append(vtk.vtkActor()) + + # self.static_arrows[self.arrow_marker_id].SetMapper(mapper) + # self.static_arrows[self.arrow_marker_id].SetProperty(prop) + + self.ren.AddActor(self.static_arrows[self.arrow_marker_id]) + self.arrow_marker_id += 1 + + #self.UpdateRender() + self.Refresh() + def AddMarker(self, ball_id, size, colour, coord): """ diff --git a/invesalius/gui/task_navigator.py b/invesalius/gui/task_navigator.py index e7cb64e..a1f4c11 100644 --- a/invesalius/gui/task_navigator.py +++ b/invesalius/gui/task_navigator.py @@ -1597,6 +1597,11 @@ class MarkersPanel(wx.Panel): size=new_marker.size, colour=new_marker.colour, coord=new_marker.coord[:3]) + # Publisher.sendMessage('Add arrow marker', ball_id=len(self.markers), + # size=new_marker.size, + # colour=new_marker.colour, + # coord=new_marker.coord[:3]) + self.markers.append(new_marker) # Add item to list control in panel -- libgit2 0.21.2