Commit 5ae0b7a00fa708245cc1303af0265cb576c41315

Authored by sotodela
1 parent 3185fc2b
Exists in master

MOD marker to arrow with orientation

invesalius/constants.py
... ... @@ -671,7 +671,7 @@ Z_COLUMN = 6
671 671  
672 672 MARKER_COLOUR = (1.0, 1.0, 0.)
673 673 MARKER_SIZE = 2
674   -
  674 +ARROW_MARKER_SIZE = 10
675 675 CALIBRATION_TRACKER_SAMPLES = 10
676 676 FIDUCIAL_REGISTRATION_ERROR_THRESHOLD = 3.0
677 677  
... ...
invesalius/data/viewer_volume.py
... ... @@ -71,7 +71,7 @@ class Viewer(wx.Panel):
71 71 self.initial_focus = None
72 72  
73 73 self.staticballs = []
74   -
  74 + self.static_arrows =[]
75 75 self.style = None
76 76  
77 77 interactor = wxVTKRenderWindowInteractor(self, -1, size = self.GetSize())
... ... @@ -602,33 +602,19 @@ class Viewer(wx.Panel):
602 602 self.RemoveTarget()
603 603  
604 604 self.UpdateRender()
605   - def AddMarkerwithOrientation(self, arrow_marker_id, size, color, coord):
  605 + def AddMarkerwithOrientation(self, arrow_id, size, color, coord):
606 606 """
607 607 Markers arrow with orientation created by navigation tools and rendered in volume viewer.
608 608 """
609   - self.arrow_marker_id = arrow_marker_id
  609 +
  610 + self.arrow_marker_id = arrow_id
610 611 coord_flip = list(coord)
611 612 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 613  
  614 + arrow_actor = self.Add_ObjectArrow(coord_flip[:3], coord_flip[3:6], color, size)
  615 + self.staticballs.append(arrow_actor)
  616 + self.ren.AddActor(self.staticballs[self.arrow_marker_id])
  617 + self.arrow_marker_id +=1
632 618 #self.UpdateRender()
633 619 self.Refresh()
634 620  
... ...
invesalius/gui/task_navigator.py
... ... @@ -1264,6 +1264,7 @@ class MarkersPanel(wx.Panel):
1264 1264  
1265 1265 self.marker_colour = const.MARKER_COLOUR
1266 1266 self.marker_size = const.MARKER_SIZE
  1267 + self.arrow_marker_size = const.ARROW_MARKER_SIZE
1267 1268 self.current_session = 1
1268 1269  
1269 1270 # Change marker size
... ... @@ -1615,7 +1616,8 @@ class MarkersPanel(wx.Panel):
1615 1616 if marker.is_target:
1616 1617 self.__set_marker_as_target(len(self.markers) - 1)
1617 1618  
1618   - except:
  1619 + except Exception as e:
  1620 + print('hereee',e)
1619 1621 wx.MessageBox(_("Invalid markers file."), _("InVesalius 3"))
1620 1622  
1621 1623 def OnMarkersVisibility(self, evt, ctrl):
... ... @@ -1681,14 +1683,18 @@ class MarkersPanel(wx.Panel):
1681 1683 new_robot_marker.robot_target_matrix = self.current_robot_target_matrix
1682 1684  
1683 1685 # Note that ball_id is zero-based, so we assign it len(self.markers) before the new marker is added
1684   - Publisher.sendMessage('Add marker', ball_id=len(self.markers),
1685   - size=new_marker.size,
1686   - colour=new_marker.colour,
1687   - coord=new_marker.coord[:3])
1688   - # Publisher.sendMessage('Add arrow marker', ball_id=len(self.markers),
1689   - # size=new_marker.size,
1690   - # colour=new_marker.colour,
1691   - # coord=new_marker.coord[:3])
  1686 + if label not in self.__list_fiducial_labels():
  1687 + Publisher.sendMessage('Add arrow marker', arrow_id=len(self.markers),
  1688 + size=self.arrow_marker_size,
  1689 + color=new_marker.colour,
  1690 + coord=new_marker.coord)
  1691 + else:
  1692 + Publisher.sendMessage('Add marker', ball_id=len(self.markers),
  1693 + size=new_marker.size,
  1694 + colour=new_marker.colour,
  1695 + coord=new_marker.coord[:3])
  1696 + print("marker marker",new_marker.size)
  1697 +
1692 1698  
1693 1699 self.markers.append(new_marker)
1694 1700 self.robot_markers.append(new_robot_marker)
... ...