Commit 5f52593223c438011b8222f137dd5abf6340bf14

Authored by Soto de la Cruz Ana
1 parent e1b52082
Exists in master

ADD marker arrow function to viewer volume

invesalius/data/viewer_volume.py
... ... @@ -277,6 +277,7 @@ class Viewer(wx.Panel):
277 277  
278 278 # Related to marker creation in navigation tools
279 279 Publisher.subscribe(self.AddMarker, 'Add marker')
  280 + Publisher.subscribe(self.AddMarkerwithOrientation, 'Add arrow marker')
280 281 Publisher.subscribe(self.HideAllMarkers, 'Hide all markers')
281 282 Publisher.subscribe(self.ShowAllMarkers, 'Show all markers')
282 283 Publisher.subscribe(self.RemoveAllMarkers, 'Remove all markers')
... ... @@ -601,6 +602,36 @@ class Viewer(wx.Panel):
601 602 self.RemoveTarget()
602 603  
603 604 self.UpdateRender()
  605 + def AddMarkerwithOrientation(self, arrow_marker_id, size, color, coord):
  606 + """
  607 + Markers with orientation created by navigation tools and rendered in volume viewer.
  608 + """
  609 + self.arrow_marker_id = arrow_marker_id
  610 + coord_flip = list(coord)
  611 + coord_flip[1] = -coord_flip[1]
  612 + self.static_arrows.append(self.Add_ObjectArrow(self, coord_flip, coord_flip, color, size))
  613 + # ball_ref = vtk.vtkSphereSource()
  614 + # ball_ref.SetRadius(size)
  615 + # ball_ref.SetCenter(coord_flip)
  616 + #
  617 + # mapper = vtk.vtkPolyDataMapper()
  618 + # mapper.SetInputConnection(ball_ref.GetOutputPort())
  619 + #
  620 + # prop = vtk.vtkProperty()
  621 + # prop.SetColor(colour)
  622 +
  623 + # adding a new actor for the present ball
  624 + #self.static_arrows.append(vtk.vtkActor())
  625 +
  626 + # self.static_arrows[self.arrow_marker_id].SetMapper(mapper)
  627 + # self.static_arrows[self.arrow_marker_id].SetProperty(prop)
  628 +
  629 + self.ren.AddActor(self.static_arrows[self.arrow_marker_id])
  630 + self.arrow_marker_id += 1
  631 +
  632 + #self.UpdateRender()
  633 + self.Refresh()
  634 +
604 635  
605 636 def AddMarker(self, ball_id, size, colour, coord):
606 637 """
... ...
invesalius/gui/task_navigator.py
... ... @@ -1597,6 +1597,11 @@ class MarkersPanel(wx.Panel):
1597 1597 size=new_marker.size,
1598 1598 colour=new_marker.colour,
1599 1599 coord=new_marker.coord[:3])
  1600 + # Publisher.sendMessage('Add arrow marker', ball_id=len(self.markers),
  1601 + # size=new_marker.size,
  1602 + # colour=new_marker.colour,
  1603 + # coord=new_marker.coord[:3])
  1604 +
1600 1605 self.markers.append(new_marker)
1601 1606  
1602 1607 # Add item to list control in panel
... ...