Commit 65aff1e95b1c0d4b25c355fed8e0cc8ede1ee2f4

Authored by rmatsuda
1 parent d5fab576
Exists in master

ENH: Improve user interface

invesalius/gui/dialogs.py
... ... @@ -3550,7 +3550,7 @@ class ICPCorregistrationDialog(wx.Dialog):
3550 3550 self.obj_fiducials = np.full([5, 3], np.nan)
3551 3551 self.obj_orients = np.full([5, 3], np.nan)
3552 3552  
3553   - wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, _(u"Refine Corregistration"), size=(450, 440),
  3553 + wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, _(u"Refine Corregistration"), size=(380, 440),
3554 3554 style=wx.DEFAULT_DIALOG_STYLE | wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP)
3555 3555  
3556 3556 self.proj = prj.Project()
... ... @@ -3569,9 +3569,13 @@ class ICPCorregistrationDialog(wx.Dialog):
3569 3569 self.ren = vtk.vtkRenderer()
3570 3570 self.interactor.GetRenderWindow().AddRenderer(self.ren)
3571 3571  
  3572 + self.timer = wx.Timer(self)
  3573 + self.Bind(wx.EVT_TIMER, self.OnUpdate, self.timer)
  3574 +
3572 3575 txt_surface = wx.StaticText(self, -1, _('Select the surface:'))
  3576 + txt_mode = wx.StaticText(self, -1, _('Registration mode:'))
3573 3577  
3574   - combo_surface_name = wx.ComboBox(self, -1, size=(330,23),
  3578 + combo_surface_name = wx.ComboBox(self, -1, size=(210, 23),
3575 3579 style=wx.CB_DROPDOWN | wx.CB_READONLY)
3576 3580 # combo_surface_name.SetSelection(0)
3577 3581 if sys.platform != 'win32':
... ... @@ -3587,6 +3591,15 @@ class ICPCorregistrationDialog(wx.Dialog):
3587 3591 self.surface = self.proj.surface_dict[init_surface].polydata
3588 3592 self.LoadActor()
3589 3593  
  3594 + tooltip = wx.ToolTip(_("Choose the registration mode:"))
  3595 + choice_icp_method = wx.ComboBox(self, -1, "", size=(100, 23),
  3596 + choices=([_("Affine"), _("Similarity"), _("RigidBody")]),
  3597 + style=wx.CB_DROPDOWN|wx.CB_READONLY)
  3598 + choice_icp_method.SetSelection(0)
  3599 + choice_icp_method.SetToolTip(tooltip)
  3600 + choice_icp_method.Bind(wx.EVT_COMBOBOX, self.OnChoiceICPMethod)
  3601 +
  3602 + # Buttons to acquire and remove points
3590 3603 create_point = wx.Button(self, -1, label=_('Create point'))
3591 3604 create_point.Bind(wx.EVT_BUTTON, self.OnCreatePoint)
3592 3605  
... ... @@ -3594,37 +3607,11 @@ class ICPCorregistrationDialog(wx.Dialog):
3594 3607 cont_point.Bind(wx.EVT_TOGGLEBUTTON, partial(self.OnContinuousAcquisition, btn=cont_point))
3595 3608 self.cont_point = cont_point
3596 3609  
3597   - self.timer = wx.Timer(self)
3598   - self.Bind(wx.EVT_TIMER, self.OnUpdate, self.timer)
3599   -
3600   - btn_reset = wx.Button(self, -1, label=_('Reset the points'), size=(100, 23))
  3610 + btn_reset = wx.Button(self, -1, label=_('Remove points'))
3601 3611 btn_reset.Bind(wx.EVT_BUTTON, self.OnReset)
3602 3612  
3603   - btn_acqui_sizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5)
3604   - btn_acqui_sizer.AddMany([(create_point, wx.LEFT),
3605   - (cont_point, wx.RIGHT)])
3606   -
3607   - icp = wx.Button(self, -1, label=_('Apply registration'))
3608   - icp.Bind(wx.EVT_BUTTON, self.OnICP)
3609   -
3610   - tooltip = wx.ToolTip(_("Choose the ICP method"))
3611   - choice_icp_method = wx.ComboBox(self, -1, "",
3612   - choices=([_("Affine"), _("Similarity"), _("RigidBody")]), style=wx.CB_DROPDOWN|wx.CB_READONLY)
3613   - choice_icp_method.SetSelection(0)
3614   - choice_icp_method.SetToolTip(tooltip)
3615   - choice_icp_method.Bind(wx.EVT_COMBOBOX, self.OnChoiceICPMethod)
3616   -
3617   - btn_icp_sizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5)
3618   - btn_icp_sizer.AddMany([(choice_icp_method, wx.LEFT),
3619   - (icp, wx.RIGHT)])
3620   -
3621   - surface_resetsizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5)
3622   - surface_resetsizer.AddMany([combo_surface_name,
3623   - btn_reset])
3624   -
3625   - top_sizer = wx.FlexGridSizer(rows=2, cols=1, hgap=50, vgap=5)
3626   - top_sizer.AddMany([txt_surface,
3627   - surface_resetsizer])
  3613 + btn_apply_icp = wx.Button(self, -1, label=_('Apply registration'))
  3614 + btn_apply_icp.Bind(wx.EVT_BUTTON, self.OnICP)
3628 3615  
3629 3616 # Buttons to finish or cancel object registration
3630 3617 tooltip = wx.ToolTip(_(u"Refine done"))
... ... @@ -3634,22 +3621,27 @@ class ICPCorregistrationDialog(wx.Dialog):
3634 3621 btn_cancel = wx.Button(self, wx.ID_CANCEL)
3635 3622 btn_cancel.SetHelpText("")
3636 3623  
3637   - btnsizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5)
3638   - btnsizer.AddMany([(btn_ok, wx.LEFT),
3639   - (btn_cancel, wx.RIGHT)])
  3624 + top_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=50, vgap=5)
  3625 + top_sizer.AddMany([txt_surface, txt_mode,
  3626 + combo_surface_name, choice_icp_method])
  3627 +
  3628 + btn_acqui_sizer = wx.FlexGridSizer(rows=1, cols=3, hgap=15, vgap=15)
  3629 + btn_acqui_sizer.AddMany([create_point, cont_point, btn_reset])
3640 3630  
3641   - extra_sizer = wx.FlexGridSizer(rows=3, cols=1, hgap=50, vgap=10)
3642   - extra_sizer.AddMany([btn_acqui_sizer,
3643   - btn_icp_sizer,
3644   - btnsizer])
  3631 + btn_ok_sizer = wx.FlexGridSizer(rows=1, cols=3, hgap=20, vgap=20)
  3632 + btn_ok_sizer.AddMany([btn_apply_icp, btn_ok, btn_cancel])
  3633 +
  3634 + btn_sizer = wx.FlexGridSizer(rows=2, cols=1, hgap=50, vgap=20)
  3635 + btn_sizer.AddMany([(btn_acqui_sizer, 1, wx.ALIGN_CENTER_HORIZONTAL),
  3636 + (btn_ok_sizer, 1, wx.ALIGN_RIGHT)])
3645 3637  
3646 3638 self.progress = wx.Gauge(self, -1)
3647 3639  
3648 3640 main_sizer = wx.BoxSizer(wx.VERTICAL)
3649   - main_sizer.Add(top_sizer, 0, wx.LEFT|wx.TOP|wx.RIGHT|wx.BOTTOM, 10)
  3641 + main_sizer.Add(top_sizer, 0, wx.LEFT|wx.TOP|wx.BOTTOM, 10)
3650 3642 main_sizer.Add(self.interactor, 0, wx.EXPAND)
3651   - main_sizer.Add(extra_sizer, 0,
3652   - wx.EXPAND|wx.GROW|wx.LEFT|wx.TOP|wx.RIGHT|wx.BOTTOM, 10)
  3643 + main_sizer.Add(btn_sizer, 0,
  3644 + wx.EXPAND|wx.GROW|wx.LEFT|wx.TOP|wx.BOTTOM, 10)
3653 3645 main_sizer.Add(self.progress, 0, wx.EXPAND | wx.ALL, 5)
3654 3646  
3655 3647 self.SetSizer(main_sizer)
... ...
invesalius/gui/task_navigator.py
... ... @@ -392,7 +392,7 @@ class NeuronavigationPanel(wx.Panel):
392 392  
393 393 # TODO: Find a better allignment between FRE, text and navigate button
394 394 txt_fre = wx.StaticText(self, -1, _('FRE:'))
395   - txt_icp = wx.StaticText(self, -1, _('refine:'))
  395 + txt_icp = wx.StaticText(self, -1, _('Refine:'))
396 396  
397 397 # Fiducial registration error text box
398 398 tooltip = wx.ToolTip(_("Fiducial registration error"))
... ... @@ -409,10 +409,12 @@ class NeuronavigationPanel(wx.Panel):
409 409 btn_nav.SetToolTip(tooltip)
410 410 btn_nav.Bind(wx.EVT_TOGGLEBUTTON, partial(self.OnNavigate, btn=(btn_nav, choice_trck, choice_ref)))
411 411  
  412 + tooltip = wx.ToolTip(_(u"Refine the coregistration"))
412 413 checkicp = wx.CheckBox(self, -1, _(' '))
413 414 checkicp.SetValue(False)
414 415 checkicp.Enable(False)
415 416 checkicp.Bind(wx.EVT_CHECKBOX, partial(self.Oncheckicp, ctrl=checkicp))
  417 + checkicp.SetToolTip(tooltip)
416 418 self.checkicp = checkicp
417 419  
418 420 # Image and tracker coordinates number controls
... ...