Commit 5ae0b7a00fa708245cc1303af0265cb576c41315
1 parent
3185fc2b
Exists in
master
MOD marker to arrow with orientation
Showing
3 changed files
with
24 additions
and
32 deletions
Show diff stats
invesalius/constants.py
@@ -671,7 +671,7 @@ Z_COLUMN = 6 | @@ -671,7 +671,7 @@ Z_COLUMN = 6 | ||
671 | 671 | ||
672 | MARKER_COLOUR = (1.0, 1.0, 0.) | 672 | MARKER_COLOUR = (1.0, 1.0, 0.) |
673 | MARKER_SIZE = 2 | 673 | MARKER_SIZE = 2 |
674 | - | 674 | +ARROW_MARKER_SIZE = 10 |
675 | CALIBRATION_TRACKER_SAMPLES = 10 | 675 | CALIBRATION_TRACKER_SAMPLES = 10 |
676 | FIDUCIAL_REGISTRATION_ERROR_THRESHOLD = 3.0 | 676 | FIDUCIAL_REGISTRATION_ERROR_THRESHOLD = 3.0 |
677 | 677 |
invesalius/data/viewer_volume.py
@@ -71,7 +71,7 @@ class Viewer(wx.Panel): | @@ -71,7 +71,7 @@ class Viewer(wx.Panel): | ||
71 | self.initial_focus = None | 71 | self.initial_focus = None |
72 | 72 | ||
73 | self.staticballs = [] | 73 | self.staticballs = [] |
74 | - | 74 | + self.static_arrows =[] |
75 | self.style = None | 75 | self.style = None |
76 | 76 | ||
77 | interactor = wxVTKRenderWindowInteractor(self, -1, size = self.GetSize()) | 77 | interactor = wxVTKRenderWindowInteractor(self, -1, size = self.GetSize()) |
@@ -602,33 +602,19 @@ class Viewer(wx.Panel): | @@ -602,33 +602,19 @@ class Viewer(wx.Panel): | ||
602 | self.RemoveTarget() | 602 | self.RemoveTarget() |
603 | 603 | ||
604 | self.UpdateRender() | 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 | Markers arrow with orientation created by navigation tools and rendered in volume viewer. | 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 | coord_flip = list(coord) | 611 | coord_flip = list(coord) |
611 | coord_flip[1] = -coord_flip[1] | 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 | #self.UpdateRender() | 618 | #self.UpdateRender() |
633 | self.Refresh() | 619 | self.Refresh() |
634 | 620 |
invesalius/gui/task_navigator.py
@@ -1264,6 +1264,7 @@ class MarkersPanel(wx.Panel): | @@ -1264,6 +1264,7 @@ class MarkersPanel(wx.Panel): | ||
1264 | 1264 | ||
1265 | self.marker_colour = const.MARKER_COLOUR | 1265 | self.marker_colour = const.MARKER_COLOUR |
1266 | self.marker_size = const.MARKER_SIZE | 1266 | self.marker_size = const.MARKER_SIZE |
1267 | + self.arrow_marker_size = const.ARROW_MARKER_SIZE | ||
1267 | self.current_session = 1 | 1268 | self.current_session = 1 |
1268 | 1269 | ||
1269 | # Change marker size | 1270 | # Change marker size |
@@ -1615,7 +1616,8 @@ class MarkersPanel(wx.Panel): | @@ -1615,7 +1616,8 @@ class MarkersPanel(wx.Panel): | ||
1615 | if marker.is_target: | 1616 | if marker.is_target: |
1616 | self.__set_marker_as_target(len(self.markers) - 1) | 1617 | self.__set_marker_as_target(len(self.markers) - 1) |
1617 | 1618 | ||
1618 | - except: | 1619 | + except Exception as e: |
1620 | + print('hereee',e) | ||
1619 | wx.MessageBox(_("Invalid markers file."), _("InVesalius 3")) | 1621 | wx.MessageBox(_("Invalid markers file."), _("InVesalius 3")) |
1620 | 1622 | ||
1621 | def OnMarkersVisibility(self, evt, ctrl): | 1623 | def OnMarkersVisibility(self, evt, ctrl): |
@@ -1681,14 +1683,18 @@ class MarkersPanel(wx.Panel): | @@ -1681,14 +1683,18 @@ class MarkersPanel(wx.Panel): | ||
1681 | new_robot_marker.robot_target_matrix = self.current_robot_target_matrix | 1683 | new_robot_marker.robot_target_matrix = self.current_robot_target_matrix |
1682 | 1684 | ||
1683 | # Note that ball_id is zero-based, so we assign it len(self.markers) before the new marker is added | 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 | self.markers.append(new_marker) | 1699 | self.markers.append(new_marker) |
1694 | self.robot_markers.append(new_robot_marker) | 1700 | self.robot_markers.append(new_robot_marker) |