Commit c7c743fe927f826fe64c9baa337d68b608dd3776

Authored by Renan Matsuda
1 parent e2f228d4
Exists in master

gui improvements and cleaning

invesalius/data/viewer_volume.py
... ... @@ -167,8 +167,6 @@ class Viewer(wx.Panel):
167 167 self.obj_state = None
168 168 self.obj_actor_list = None
169 169 self.arrow_actor_list = None
170   - self.m_icp = None
171   - self.icp = False
172 170 #self.pTarget = [0., 0., 0.]
173 171  
174 172 # self.obj_axes = None
... ... @@ -306,7 +304,6 @@ class Viewer(wx.Panel):
306 304 Publisher.subscribe(self.UpdateObjectOrientation, 'Update object matrix')
307 305 Publisher.subscribe(self.UpdateTrackObjectState, 'Update track object state')
308 306 Publisher.subscribe(self.UpdateShowObjectState, 'Update show object state')
309   - Publisher.subscribe(self.UpdateICP, 'Update ICP matrix')
310 307  
311 308 Publisher.subscribe(self.ActivateTargetMode, 'Target navigation mode')
312 309 Publisher.subscribe(self.OnUpdateObjectTargetGuide, 'Update object matrix')
... ... @@ -1402,10 +1399,6 @@ class Viewer(wx.Panel):
1402 1399 self.mark_actor = None
1403 1400 self.Refresh()
1404 1401  
1405   - def UpdateICP(self, m_icp, flag):
1406   - self.m_icp = m_icp
1407   - self.icp = flag
1408   -
1409 1402 def UpdateShowObjectState(self, state):
1410 1403 self.obj_state = state
1411 1404 if self.obj_actor and not self.obj_state:
... ...
invesalius/gui/task_navigator.py
... ... @@ -308,6 +308,7 @@ class NeuronavigationPanel(wx.Panel):
308 308 self.obj_reg = None
309 309 self.obj_reg_status = False
310 310 self.track_obj = False
  311 + self.m_icp = None
311 312 self.event = threading.Event()
312 313  
313 314 self.coord_queue = QueueCustom(maxsize=1)
... ... @@ -375,6 +376,7 @@ class NeuronavigationPanel(wx.Panel):
375 376  
376 377 # TODO: Find a better allignment between FRE, text and navigate button
377 378 txt_fre = wx.StaticText(self, -1, _('FRE:'))
  379 + txt_icp = wx.StaticText(self, -1, _('icp:'))
378 380  
379 381 # Fiducial registration error text box
380 382 tooltip = wx.ToolTip(_("Fiducial registration error"))
... ... @@ -391,13 +393,9 @@ class NeuronavigationPanel(wx.Panel):
391 393 btn_nav.SetToolTip(tooltip)
392 394 btn_nav.Bind(wx.EVT_TOGGLEBUTTON, partial(self.OnNavigate, btn=(btn_nav, choice_trck, choice_ref)))
393 395  
394   - icp_button = wx.Button(self, -1,_("icp"))
395   - icp_button.Bind(wx.EVT_BUTTON, self.OnICP)
396   - self.icp_button = icp_button
397   -
398 396 checkicp = wx.CheckBox(self, -1, _(' '))
399 397 checkicp.SetValue(False)
400   - checkicp.Enable(0)
  398 + checkicp.Enable(False)
401 399 checkicp.Bind(wx.EVT_CHECKBOX, partial(self.Oncheckicp, ctrl=checkicp))
402 400 self.checkicp = checkicp
403 401  
... ... @@ -425,7 +423,7 @@ class NeuronavigationPanel(wx.Panel):
425 423 nav_sizer.AddMany([(txt_fre, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL),
426 424 (txtctrl_fre, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL),
427 425 (btn_nav, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL),
428   - (icp_button, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL),
  426 + (txt_icp, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL),
429 427 (checkicp, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)])
430 428  
431 429 group_sizer = wx.FlexGridSizer(rows=9, cols=1, hgap=5, vgap=5)
... ... @@ -473,10 +471,11 @@ class NeuronavigationPanel(wx.Panel):
473 471  
474 472 def UpdateNavigationStatus(self, nav_status, vis_status):
475 473 self.nav_status = nav_status
476   - if nav_status:
  474 + if nav_status and (self.m_icp is not None):
477 475 self.checkicp.Enable(True)
478 476 else:
479 477 self.checkicp.Enable(False)
  478 + self.checkicp.SetValue(False)
480 479  
481 480 #def UpdateImageCoordinates(self, position):
482 481 def UpdateFRE(self, fre):
... ... @@ -675,23 +674,18 @@ class NeuronavigationPanel(wx.Panel):
675 674 transf_coord = transformed_points[i][0],-transformed_points[i][1],transformed_points[i][2], 0, 0, 0
676 675 Publisher.sendMessage('Create marker', coord=img_coord, marker_id=None, colour=(1,0,0))
677 676 Publisher.sendMessage('Create marker', coord=transf_coord, marker_id=None, colour=(0,0,1))
  677 + self.checkicp.Enable(True)
678 678 else:
679 679 self.m_icp = None
680 680  
681 681 def Oncheckicp(self, evt, ctrl):
682 682 if ctrl.GetValue() and evt and (self.m_icp is not None):
683 683 self.icp = True
684   - self.icp_button.Enable(0)
685   - dcr.CoordinateCorregistrateNoObject.icp = True
686   - dcr.CoordinateCorregistrateNoObject.m_icp = self.m_icp
687 684 else:
688   - self.icp_button.Enable(1)
689 685 self.icp = False
690   - dcr.CoordinateCorregistrateNoObject.icp = False
691 686  
692 687 self.icp_queue.put_nowait([self.icp, self.m_icp])
693 688 print(self.icp, self.m_icp)
694   - Publisher.sendMessage("Update ICP matrix", m_icp=self.m_icp, flag=self.icp)
695 689  
696 690 def OnNavigate(self, evt, btn):
697 691 btn_nav = btn[0]
... ...