Commit bfb7466961ff928209afe4641c56f002373d6c06

Authored by Victor Hugo Souza
Committed by Thiago Franco de Moraes
1 parent a76ce758
Exists in master

Update GUI defaults in navigation and improved functionalities (#196)

* ENH:Update GUI navigation defaults for better workflow

* ENH: Improved visualization in navigation
- Larger distance text in target interface
- Better colors for coil objects and aim
- Update defaults in navigation tab

* ENH: Save last used NDI markers filenames to config.json
invesalius/constants.py
... ... @@ -62,6 +62,7 @@ TEXT_SIZE_SMALL = 11
62 62 TEXT_SIZE = 12
63 63 TEXT_SIZE_LARGE = 16
64 64 TEXT_SIZE_EXTRA_LARGE = 20
  65 +TEXT_SIZE_DIST_NAV = 32
65 66 TEXT_COLOUR = (1,1,1)
66 67  
67 68 (X,Y) = (0.03, 0.97)
... ...
invesalius/data/viewer_volume.py
... ... @@ -165,6 +165,7 @@ class Viewer(wx.Panel):
165 165 self.obj_state = None
166 166 self.obj_actor_list = None
167 167 self.arrow_actor_list = None
  168 + #self.pTarget = [0., 0., 0.]
168 169  
169 170 # self.obj_axes = None
170 171  
... ... @@ -623,6 +624,7 @@ class Viewer(wx.Panel):
623 624 self.distthreshold = dist_threshold
624 625  
625 626 def ActivateTargetMode(self, evt=None, target_mode=None):
  627 + vtk_colors = vtk.vtkNamedColors()
626 628 self.target_mode = target_mode
627 629 if self.target_coord and self.target_mode:
628 630 self.CreateTargetAim()
... ... @@ -646,21 +648,33 @@ class Viewer(wx.Panel):
646 648 mapper = vtk.vtkPolyDataMapper()
647 649 mapper.SetInputData(normals.GetOutput())
648 650 mapper.ScalarVisibilityOff()
649   - mapper.ImmediateModeRenderingOn() # improve performance
  651 + #mapper.ImmediateModeRenderingOn() # improve performance
650 652  
651 653 obj_roll = vtk.vtkActor()
652 654 obj_roll.SetMapper(mapper)
  655 + obj_roll.GetProperty().SetColor(1, 1, 1)
  656 + # obj_roll.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
  657 + # obj_roll.GetProperty().SetSpecular(30)
  658 + # obj_roll.GetProperty().SetSpecularPower(80)
653 659 obj_roll.SetPosition(0, 25, -30)
654 660 obj_roll.RotateX(-60)
655 661 obj_roll.RotateZ(180)
656 662  
657 663 obj_yaw = vtk.vtkActor()
658 664 obj_yaw.SetMapper(mapper)
  665 + obj_yaw.GetProperty().SetColor(1, 1, 1)
  666 + # obj_yaw.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
  667 + # obj_yaw.GetProperty().SetSpecular(30)
  668 + # obj_yaw.GetProperty().SetSpecularPower(80)
659 669 obj_yaw.SetPosition(0, -115, 5)
660 670 obj_yaw.RotateZ(180)
661 671  
662 672 obj_pitch = vtk.vtkActor()
663 673 obj_pitch.SetMapper(mapper)
  674 + obj_pitch.GetProperty().SetColor(1, 1, 1)
  675 + # obj_pitch.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
  676 + # obj_pitch.GetProperty().SetSpecular(30)
  677 + # obj_pitch.GetProperty().SetSpecularPower(80)
664 678 obj_pitch.SetPosition(5, -265, 5)
665 679 obj_pitch.RotateY(90)
666 680 obj_pitch.RotateZ(180)
... ... @@ -717,6 +731,9 @@ class Viewer(wx.Panel):
717 731 self.DisableCoilTracker()
718 732  
719 733 def OnUpdateObjectTargetGuide(self, m_img, coord):
  734 +
  735 + vtk_colors = vtk.vtkNamedColors()
  736 +
720 737 if self.target_coord and self.target_mode:
721 738  
722 739 target_dist = distance.euclidean(coord[0:3],
... ... @@ -734,10 +751,10 @@ class Viewer(wx.Panel):
734 751  
735 752 if target_dist <= self.distthreshold:
736 753 thrdist = True
737   - self.aim_actor.GetProperty().SetColor(0, 1, 0)
  754 + self.aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
738 755 else:
739 756 thrdist = False
740   - self.aim_actor.GetProperty().SetColor(1, 1, 1)
  757 + self.aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Yellow'))
741 758  
742 759 coordx = self.target_coord[3] - coord[3]
743 760 if coordx > const.ARROW_UPPER_LIMIT:
... ... @@ -765,9 +782,11 @@ class Viewer(wx.Panel):
765 782  
766 783 if self.anglethreshold * const.ARROW_SCALE > coordx > -self.anglethreshold * const.ARROW_SCALE:
767 784 thrcoordx = True
  785 + # self.obj_actor_list[0].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
768 786 self.obj_actor_list[0].GetProperty().SetColor(0, 1, 0)
769 787 else:
770 788 thrcoordx = False
  789 + # self.obj_actor_list[0].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
771 790 self.obj_actor_list[0].GetProperty().SetColor(1, 1, 1)
772 791  
773 792 offset = 5
... ... @@ -784,9 +803,11 @@ class Viewer(wx.Panel):
784 803  
785 804 if self.anglethreshold * const.ARROW_SCALE > coordz > -self.anglethreshold * const.ARROW_SCALE:
786 805 thrcoordz = True
  806 + # self.obj_actor_list[1].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
787 807 self.obj_actor_list[1].GetProperty().SetColor(0, 1, 0)
788 808 else:
789 809 thrcoordz = False
  810 + # self.obj_actor_list[1].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
790 811 self.obj_actor_list[1].GetProperty().SetColor(1, 1, 1)
791 812  
792 813 offset = -35
... ... @@ -803,9 +824,11 @@ class Viewer(wx.Panel):
803 824  
804 825 if self.anglethreshold * const.ARROW_SCALE > coordy > -self.anglethreshold * const.ARROW_SCALE:
805 826 thrcoordy = True
  827 + #self.obj_actor_list[2].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
806 828 self.obj_actor_list[2].GetProperty().SetColor(0, 1, 0)
807 829 else:
808 830 thrcoordy = False
  831 + #self.obj_actor_list[2].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
809 832 self.obj_actor_list[2].GetProperty().SetColor(1, 1, 1)
810 833  
811 834 offset = 38
... ... @@ -823,9 +846,9 @@ class Viewer(wx.Panel):
823 846 arrow_pitch_y2.GetProperty().SetColor(1, 0, 0)
824 847  
825 848 if thrdist and thrcoordx and thrcoordy and thrcoordz:
826   - self.dummy_coil_actor.GetProperty().SetColor(0, 1, 0)
  849 + self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
827 850 else:
828   - self.dummy_coil_actor.GetProperty().SetColor(1, 1, 1)
  851 + self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('DarkOrange'))
829 852  
830 853 self.arrow_actor_list = arrow_roll_x1, arrow_roll_x2, arrow_yaw_z1, arrow_yaw_z2, \
831 854 arrow_pitch_y1, arrow_pitch_y2
... ... @@ -833,7 +856,6 @@ class Viewer(wx.Panel):
833 856 for ind in self.arrow_actor_list:
834 857 self.ren2.AddActor(ind)
835 858  
836   -
837 859 self.Refresh()
838 860  
839 861 def OnUpdateTargetCoordinates(self, coord):
... ... @@ -853,6 +875,8 @@ class Viewer(wx.Panel):
853 875 self.RemoveTargetAim()
854 876 self.aim_actor = None
855 877  
  878 + vtk_colors = vtk.vtkNamedColors()
  879 +
856 880 a, b, g = np.radians(self.target_coord[3:])
857 881 r_ref = tr.euler_matrix(a, b, g, 'sxyz')
858 882 t_ref = tr.translation_matrix(self.target_coord[:3])
... ... @@ -885,8 +909,10 @@ class Viewer(wx.Panel):
885 909  
886 910 aim_actor = vtk.vtkActor()
887 911 aim_actor.SetMapper(mapper)
888   - aim_actor.GetProperty().SetColor(1, 1, 1)
889   - aim_actor.GetProperty().SetOpacity(0.6)
  912 + aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Yellow'))
  913 + aim_actor.GetProperty().SetSpecular(.2)
  914 + aim_actor.GetProperty().SetSpecularPower(100)
  915 + aim_actor.GetProperty().SetOpacity(1.)
890 916 self.aim_actor = aim_actor
891 917 self.ren.AddActor(aim_actor)
892 918  
... ... @@ -909,11 +935,14 @@ class Viewer(wx.Panel):
909 935 obj_mapper = vtk.vtkPolyDataMapper()
910 936 obj_mapper.SetInputData(normals.GetOutput())
911 937 obj_mapper.ScalarVisibilityOff()
912   - obj_mapper.ImmediateModeRenderingOn() # improve performance
  938 + #obj_mapper.ImmediateModeRenderingOn() # improve performance
913 939  
914 940 self.dummy_coil_actor = vtk.vtkActor()
915 941 self.dummy_coil_actor.SetMapper(obj_mapper)
916   - self.dummy_coil_actor.GetProperty().SetOpacity(0.15)
  942 + self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('DarkOrange'))
  943 + self.dummy_coil_actor.GetProperty().SetSpecular(0.5)
  944 + self.dummy_coil_actor.GetProperty().SetSpecularPower(10)
  945 + self.dummy_coil_actor.GetProperty().SetOpacity(.3)
917 946 self.dummy_coil_actor.SetVisibility(1)
918 947 self.dummy_coil_actor.SetUserMatrix(m_img_vtk)
919 948  
... ... @@ -928,9 +957,9 @@ class Viewer(wx.Panel):
928 957  
929 958 def CreateTextDistance(self):
930 959 tdist = vtku.Text()
931   - tdist.SetSize(const.TEXT_SIZE_LARGE)
  960 + tdist.SetSize(const.TEXT_SIZE_DIST_NAV)
932 961 tdist.SetPosition((const.X, 1.03-const.Y))
933   - tdist.ShadowOff()
  962 + #tdist.ShadowOff()
934 963 tdist.BoldOn()
935 964  
936 965 self.ren.AddActor(tdist.actor)
... ... @@ -1162,7 +1191,7 @@ class Viewer(wx.Panel):
1162 1191 """
1163 1192 Coil for navigation rendered in volume viewer.
1164 1193 """
1165   -
  1194 + vtk_colors = vtk.vtkNamedColors()
1166 1195 obj_polydata = self.CreateObjectPolyData(obj_name)
1167 1196  
1168 1197 transform = vtk.vtkTransform()
... ... @@ -1182,11 +1211,14 @@ class Viewer(wx.Panel):
1182 1211 obj_mapper = vtk.vtkPolyDataMapper()
1183 1212 obj_mapper.SetInputData(normals.GetOutput())
1184 1213 obj_mapper.ScalarVisibilityOff()
1185   - obj_mapper.ImmediateModeRenderingOn() # improve performance
  1214 + #obj_mapper.ImmediateModeRenderingOn() # improve performance
1186 1215  
1187 1216 self.obj_actor = vtk.vtkActor()
1188 1217 self.obj_actor.SetMapper(obj_mapper)
1189   - self.obj_actor.GetProperty().SetOpacity(0.9)
  1218 + self.obj_actor.GetProperty().SetAmbientColor(vtk_colors.GetColor3d('GhostWhite'))
  1219 + self.obj_actor.GetProperty().SetSpecular(30)
  1220 + self.obj_actor.GetProperty().SetSpecularPower(80)
  1221 + self.obj_actor.GetProperty().SetOpacity(.4)
1190 1222 self.obj_actor.SetVisibility(0)
1191 1223  
1192 1224 self.ren.AddActor(self.obj_actor)
... ...
invesalius/gui/default_viewers.py
... ... @@ -488,9 +488,11 @@ class VolumeToolPanel(wx.Panel):
488 488 if not self.button_target.IsPressed() and evt is not False:
489 489 self.button_target._pressed = True
490 490 Publisher.sendMessage('Target navigation mode', target_mode=self.button_target._pressed)
  491 + Publisher.sendMessage('Change camera checkbox', status=self.button_target._pressed)
491 492 elif self.button_target.IsPressed() or evt is False:
492 493 self.button_target._pressed = False
493 494 Publisher.sendMessage('Target navigation mode', target_mode=self.button_target._pressed)
  495 + Publisher.sendMessage('Change camera checkbox', status=self.button_target._pressed)
494 496  
495 497 def OnSavePreset(self, evt):
496 498 d = wx.TextEntryDialog(self, _("Preset name"))
... ...
invesalius/gui/dialogs.py
... ... @@ -3326,7 +3326,7 @@ class ObjectCalibrationDialog(wx.Dialog):
3326 3326  
3327 3327 self.tracker_id = nav_prop[0]
3328 3328 self.trk_init = nav_prop[1]
3329   - self.obj_ref_id = 0
  3329 + self.obj_ref_id = 2
3330 3330 self.obj_name = None
3331 3331  
3332 3332 self.obj_fiducials = np.full([5, 3], np.nan)
... ... @@ -3354,7 +3354,7 @@ class ObjectCalibrationDialog(wx.Dialog):
3354 3354 tooltip = wx.ToolTip(_(u"Choose the object reference mode"))
3355 3355 choice_ref = wx.ComboBox(self, -1, "", size=wx.Size(90, 23),
3356 3356 choices=const.REF_MODE, style=wx.CB_DROPDOWN | wx.CB_READONLY)
3357   - choice_ref.SetSelection(self.obj_ref_id)
  3357 + choice_ref.SetSelection(1)
3358 3358 choice_ref.SetToolTip(tooltip)
3359 3359 choice_ref.Bind(wx.EVT_COMBOBOX, self.OnChoiceRefMode)
3360 3360 choice_ref.Enable(0)
... ... @@ -3368,7 +3368,10 @@ class ObjectCalibrationDialog(wx.Dialog):
3368 3368 choice_sensor.SetSelection(0)
3369 3369 choice_sensor.SetToolTip(tooltip)
3370 3370 choice_sensor.Bind(wx.EVT_COMBOBOX, self.OnChoiceFTSensor)
3371   - choice_sensor.Show(False)
  3371 + if self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK:
  3372 + choice_sensor.Show(True)
  3373 + else:
  3374 + choice_sensor.Show(False)
3372 3375 self.choice_sensor = choice_sensor
3373 3376  
3374 3377 # Buttons to finish or cancel object registration
... ... @@ -3487,7 +3490,7 @@ class ObjectCalibrationDialog(wx.Dialog):
3487 3490 mapper = vtk.vtkPolyDataMapper()
3488 3491 mapper.SetInputData(normals.GetOutput())
3489 3492 mapper.ScalarVisibilityOff()
3490   - mapper.ImmediateModeRenderingOn()
  3493 + #mapper.ImmediateModeRenderingOn()
3491 3494  
3492 3495 obj_actor = vtk.vtkActor()
3493 3496 obj_actor.SetMapper(mapper)
... ... @@ -3563,16 +3566,19 @@ class ObjectCalibrationDialog(wx.Dialog):
3563 3566 if evt.GetSelection():
3564 3567 self.obj_ref_id = 2
3565 3568 if self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK:
3566   - self.choice_sensor.Show(True)
3567   - self.Layout()
  3569 + self.choice_sensor.Show(self.obj_ref_id)
3568 3570 else:
3569 3571 self.obj_ref_id = 0
  3572 + self.choice_sensor.Show(self.obj_ref_id)
3570 3573 for m in range(0, 5):
3571 3574 self.obj_fiducials[m, :] = np.full([1, 3], np.nan)
3572 3575 self.obj_orients[m, :] = np.full([1, 3], np.nan)
3573 3576 for n in range(0, 3):
3574 3577 self.txt_coord[m][n].SetLabel('-')
3575 3578  
  3579 + # Used to update choice sensor controls
  3580 + self.Layout()
  3581 +
3576 3582 def OnChoiceFTSensor(self, evt):
3577 3583 if evt.GetSelection():
3578 3584 self.obj_ref_id = 3
... ... @@ -3786,20 +3792,33 @@ class GoToDialogScannerCoord(wx.Dialog):
3786 3792 wx.Dialog.Close(self)
3787 3793 self.Destroy()
3788 3794  
  3795 +
3789 3796 class SetNDIconfigs(wx.Dialog):
3790 3797 def __init__(self, title=_("Setting NDI polaris configs:")):
3791   - wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, title, style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP)
  3798 + wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, title, size=wx.Size(1000, 200),
  3799 + style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP|wx.RESIZE_BORDER)
3792 3800 self._init_gui()
3793 3801  
3794 3802 def serial_ports(self):
3795   - """ Lists serial port names
  3803 + """ Lists serial port names and pre-select the description containing NDI
3796 3804 """
3797 3805 import serial.tools.list_ports
  3806 +
  3807 + ports = serial.tools.list_ports.comports()
3798 3808 if sys.platform.startswith('win'):
3799   - ports = ([comport.device for comport in serial.tools.list_ports.comports()])
  3809 + port_list = []
  3810 + count = 0
  3811 + for port, desc, hwid in sorted(ports):
  3812 + port_list.append(port)
  3813 + if 'NDI' in desc:
  3814 + port_selec = port, count
  3815 + count += 1
3800 3816 else:
3801 3817 raise EnvironmentError('Unsupported platform')
3802   - return ports
  3818 +
  3819 + #print("Here is the chosen port: {} with id {}".format(port_selec[0], port_selec[1]))
  3820 +
  3821 + return port_list, port_selec
3803 3822  
3804 3823 def _init_gui(self):
3805 3824 self.com_ports = wx.ComboBox(self, -1, style=wx.CB_DROPDOWN|wx.CB_READONLY)
... ... @@ -3807,30 +3826,42 @@ class SetNDIconfigs(wx.Dialog):
3807 3826 row_com.Add(wx.StaticText(self, wx.ID_ANY, "Select the COM port"), 0, wx.TOP|wx.RIGHT,5)
3808 3827 row_com.Add(self.com_ports, 0, wx.EXPAND)
3809 3828  
3810   - ports = self.serial_ports()
3811   - self.com_ports.Append(ports)
  3829 + port_list, port_selec = self.serial_ports()
3812 3830  
3813   - self.dir_probe = wx.FilePickerCtrl(self, path=inv_paths.NDI_MAR_DIR_REF, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
  3831 + self.com_ports.Append(port_list)
  3832 + self.com_ports.SetSelection(port_selec[1])
  3833 +
  3834 + session = ses.Session()
  3835 + last_ndi_probe_marker = session.get('paths', 'last_ndi_probe_marker', '')
  3836 + last_ndi_ref_marker = session.get('paths', 'last_ndi_ref_marker', '')
  3837 + last_ndi_obj_marker = session.get('paths', 'last_ndi_obj_marker', '')
  3838 +
  3839 + if not last_ndi_probe_marker:
  3840 + last_ndi_probe_marker = inv_paths.NDI_MAR_DIR_PROBE
  3841 + if not last_ndi_ref_marker:
  3842 + last_ndi_ref_marker = inv_paths.NDI_MAR_DIR_REF
  3843 + if not last_ndi_obj_marker:
  3844 + last_ndi_obj_marker = inv_paths.NDI_MAR_DIR_OBJ
  3845 +
  3846 + self.dir_probe = wx.FilePickerCtrl(self, path=last_ndi_probe_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
3814 3847 wildcard="Rom files (*.rom)|*.rom", message="Select probe's rom file")
3815 3848 row_probe = wx.BoxSizer(wx.VERTICAL)
3816 3849 row_probe.Add(wx.StaticText(self, wx.ID_ANY, "Set probe's rom file"), 0, wx.TOP|wx.RIGHT, 5)
3817 3850 row_probe.Add(self.dir_probe, 0, wx.EXPAND|wx.ALIGN_CENTER)
3818 3851  
3819   - self.dir_ref = wx.FilePickerCtrl(self, path=inv_paths.NDI_MAR_DIR_REF, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
3820   - wildcard="Rom files (*.rom)|*.rom", message="Select reference's rom file")
  3852 + self.dir_ref = wx.FilePickerCtrl(self, path=last_ndi_ref_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
  3853 + wildcard="Rom files (*.rom)|*.rom", message="Select reference's rom file")
3821 3854 row_ref = wx.BoxSizer(wx.VERTICAL)
3822 3855 row_ref.Add(wx.StaticText(self, wx.ID_ANY, "Set reference's rom file"), 0, wx.TOP | wx.RIGHT, 5)
3823 3856 row_ref.Add(self.dir_ref, 0, wx.EXPAND|wx.ALIGN_CENTER)
3824 3857  
3825   - self.dir_obj = wx.FilePickerCtrl(self, path=inv_paths.NDI_MAR_DIR_OBJ, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
3826   - wildcard="Rom files (*.rom)|*.rom", message="Select object's rom file")
  3858 + self.dir_obj = wx.FilePickerCtrl(self, path=last_ndi_obj_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
  3859 + wildcard="Rom files (*.rom)|*.rom", message="Select object's rom file")
3827 3860 #self.dir_probe.Bind(wx.EVT_FILEPICKER_CHANGED, self.Selected)
3828 3861 row_obj = wx.BoxSizer(wx.VERTICAL)
3829 3862 row_obj.Add(wx.StaticText(self, wx.ID_ANY, "Set object's rom file"), 0, wx.TOP|wx.RIGHT, 5)
3830 3863 row_obj.Add(self.dir_obj, 0, wx.EXPAND|wx.ALIGN_CENTER)
3831 3864  
3832   - # self.goto_orientation.SetSelection(cb_init)
3833   -
3834 3865 btn_ok = wx.Button(self, wx.ID_OK)
3835 3866 btn_ok.SetHelpText("")
3836 3867 btn_ok.SetDefault()
... ... @@ -3863,10 +3894,19 @@ class SetNDIconfigs(wx.Dialog):
3863 3894 self.CenterOnParent()
3864 3895  
3865 3896 def GetValue(self):
3866   - return self.com_ports.GetString(self.com_ports.GetSelection()).encode(const.FS_ENCODE), \
3867   - self.dir_probe.GetPath().encode(const.FS_ENCODE),\
3868   - self.dir_ref.GetPath().encode(const.FS_ENCODE), \
3869   - self.dir_obj.GetPath().encode(const.FS_ENCODE)
  3897 + fn_probe = self.dir_probe.GetPath().encode(const.FS_ENCODE)
  3898 + fn_ref = self.dir_ref.GetPath().encode(const.FS_ENCODE)
  3899 + fn_obj = self.dir_obj.GetPath().encode(const.FS_ENCODE)
  3900 +
  3901 + if fn_probe and fn_ref and fn_obj:
  3902 + session = ses.Session()
  3903 + session['paths']['last_ndi_probe_marker'] = self.dir_probe.GetPath()
  3904 + session['paths']['last_ndi_ref_marker'] = self.dir_ref.GetPath()
  3905 + session['paths']['last_ndi_obj_marker'] = self.dir_obj.GetPath()
  3906 + session.WriteSessionFile()
  3907 +
  3908 + return self.com_ports.GetString(self.com_ports.GetSelection()).encode(const.FS_ENCODE), fn_probe, fn_ref, fn_obj
  3909 +
3870 3910  
3871 3911 class SetCOMport(wx.Dialog):
3872 3912 def __init__(self, title=_("Select COM port")):
... ...
invesalius/gui/task_navigator.py
... ... @@ -229,18 +229,16 @@ class InnerFoldPanel(wx.Panel):
229 229 def __bind_events(self):
230 230 Publisher.subscribe(self.OnCheckStatus, 'Navigation status')
231 231 Publisher.subscribe(self.OnShowObject, 'Update track object state')
232   - Publisher.subscribe(self.OnVolumeCamera, 'Target navigation mode')
  232 + Publisher.subscribe(self.OnVolumeCamera, 'Change camera checkbox')
233 233 Publisher.subscribe(self.OnShowDbs, "Active dbs folder")
234 234 Publisher.subscribe(self.OnHideDbs, "Deactive dbs folder")
235 235  
236 236 def OnShowDbs(self):
237 237 self.dbs_item.Show()
238 238  
239   -
240 239 def OnHideDbs(self):
241 240 self.dbs_item.Hide()
242 241  
243   -
244 242 def OnCheckStatus(self, status):
245 243 if status:
246 244 self.checktrigger.Enable(False)
... ... @@ -257,6 +255,7 @@ class InnerFoldPanel(wx.Panel):
257 255 if not evt:
258 256 if flag:
259 257 self.checkobj.Enable(True)
  258 + self.checkobj.SetValue(True)
260 259 self.track_obj = True
261 260 Publisher.sendMessage('Status target button', status=True)
262 261 else:
... ... @@ -267,12 +266,12 @@ class InnerFoldPanel(wx.Panel):
267 266  
268 267 Publisher.sendMessage('Update show object state', state=self.checkobj.GetValue())
269 268  
270   - def OnVolumeCamera(self, evt=None, target_mode=None):
  269 + def OnVolumeCamera(self, evt=None, status=None):
271 270 if not evt:
272   - if target_mode is True:
273   - self.checkcamera.SetValue(0)
  271 + self.checkcamera.SetValue(status)
274 272 Publisher.sendMessage('Update volume camera state', camera_state=self.checkcamera.GetValue())
275 273  
  274 +
276 275 class NeuronavigationPanel(wx.Panel):
277 276 def __init__(self, parent):
278 277 wx.Panel.__init__(self, parent)
... ... @@ -890,6 +889,10 @@ class ObjectRegistrationPanel(wx.Panel):
890 889 data=(self.obj_fiducials, self.obj_orients, self.obj_ref_mode, self.obj_name))
891 890 Publisher.sendMessage('Update status text in GUI',
892 891 label=_("Ready"))
  892 + # Enable automatically Track object, Show coil and disable Vol. Camera
  893 + self.checktrack.SetValue(True)
  894 + Publisher.sendMessage('Update track object state', flag=True, obj_name=self.obj_name)
  895 + Publisher.sendMessage('Change camera checkbox', status=False)
893 896  
894 897 except wx._core.PyAssertionError: # TODO FIX: win64
895 898 pass
... ... @@ -916,6 +919,9 @@ class ObjectRegistrationPanel(wx.Panel):
916 919 Publisher.sendMessage('Update object registration',
917 920 data=(self.obj_fiducials, self.obj_orients, self.obj_ref_mode, self.obj_name))
918 921 Publisher.sendMessage('Update status text in GUI', label=_("Ready"))
  922 + self.checktrack.SetValue(True)
  923 + Publisher.sendMessage('Update track object state', flag=True, obj_name=self.obj_name)
  924 + Publisher.sendMessage('Change camera checkbox', status=False)
919 925 wx.MessageBox(_("Object file successfully loaded"), _("Load"))
920 926  
921 927 def ShowSaveObjectDialog(self, evt):
... ... @@ -963,8 +969,8 @@ class MarkersPanel(wx.Panel):
963 969 self.tgt_flag = self.tgt_index = None
964 970 self.nav_status = False
965 971  
966   - self.marker_colour = (0.0, 0.0, 1.)
967   - self.marker_size = 4
  972 + self.marker_colour = (1.0, 1.0, 0.)
  973 + self.marker_size = 3
968 974  
969 975 # Change marker size
970 976 spin_size = wx.SpinCtrl(self, -1, "", size=wx.Size(40, 23))
... ... @@ -1058,9 +1064,7 @@ class MarkersPanel(wx.Panel):
1058 1064 self.nav_status = True
1059 1065  
1060 1066 def OnMouseRightDown(self, evt):
1061   - self.OnListEditMarkerId(self.nav_status)
1062   -
1063   - def OnListEditMarkerId(self, status):
  1067 + # TODO: Enable the "Set as target" only when target is created with registered object
1064 1068 menu_id = wx.Menu()
1065 1069 edit_id = menu_id.Append(0, _('Edit ID'))
1066 1070 menu_id.Bind(wx.EVT_MENU, self.OnMenuEditMarkerId, edit_id)
... ... @@ -1070,7 +1074,7 @@ class MarkersPanel(wx.Panel):
1070 1074 target_menu = menu_id.Append(1, _('Set as target'))
1071 1075 menu_id.Bind(wx.EVT_MENU, self.OnMenuSetTarget, target_menu)
1072 1076  
1073   - target_menu.Enable(status)
  1077 + target_menu.Enable(True)
1074 1078 self.PopupMenu(menu_id)
1075 1079 menu_id.Destroy()
1076 1080  
... ...