Commit 5f52593223c438011b8222f137dd5abf6340bf14
1 parent
e1b52082
Exists in
master
ADD marker arrow function to viewer volume
Showing
2 changed files
with
36 additions
and
0 deletions
Show diff stats
invesalius/data/viewer_volume.py
@@ -277,6 +277,7 @@ class Viewer(wx.Panel): | @@ -277,6 +277,7 @@ class Viewer(wx.Panel): | ||
277 | 277 | ||
278 | # Related to marker creation in navigation tools | 278 | # Related to marker creation in navigation tools |
279 | Publisher.subscribe(self.AddMarker, 'Add marker') | 279 | Publisher.subscribe(self.AddMarker, 'Add marker') |
280 | + Publisher.subscribe(self.AddMarkerwithOrientation, 'Add arrow marker') | ||
280 | Publisher.subscribe(self.HideAllMarkers, 'Hide all markers') | 281 | Publisher.subscribe(self.HideAllMarkers, 'Hide all markers') |
281 | Publisher.subscribe(self.ShowAllMarkers, 'Show all markers') | 282 | Publisher.subscribe(self.ShowAllMarkers, 'Show all markers') |
282 | Publisher.subscribe(self.RemoveAllMarkers, 'Remove all markers') | 283 | Publisher.subscribe(self.RemoveAllMarkers, 'Remove all markers') |
@@ -601,6 +602,36 @@ class Viewer(wx.Panel): | @@ -601,6 +602,36 @@ class Viewer(wx.Panel): | ||
601 | self.RemoveTarget() | 602 | self.RemoveTarget() |
602 | 603 | ||
603 | self.UpdateRender() | 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 | def AddMarker(self, ball_id, size, colour, coord): | 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,6 +1597,11 @@ class MarkersPanel(wx.Panel): | ||
1597 | size=new_marker.size, | 1597 | size=new_marker.size, |
1598 | colour=new_marker.colour, | 1598 | colour=new_marker.colour, |
1599 | coord=new_marker.coord[:3]) | 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 | self.markers.append(new_marker) | 1605 | self.markers.append(new_marker) |
1601 | 1606 | ||
1602 | # Add item to list control in panel | 1607 | # Add item to list control in panel |