Commit 0eeb3ff433eae286c7841a86d11f7b34967bdc36

Authored by rmatsuda
1 parent c3fdcee7
Exists in master

test

invesalius/data/coregistration.py
... ... @@ -216,7 +216,7 @@ class CoordinateCorregistrate(threading.Thread):
216 216  
217 217  
218 218 class CoordinateCorregistrateNoObject(threading.Thread):
219   - def __init__(self, ref_mode_id, trck_info, coreg_data, coord_queue, view_tracts, coord_tracts_queue, event, sle):
  219 + def __init__(self, ref_mode_id, trck_info, coreg_data, coord_queue, view_tracts, coord_tracts_queue, event, sle, icp = None, m_icp = None):
220 220 threading.Thread.__init__(self, name='CoordCoregNoObject')
221 221 self.ref_mode_id = ref_mode_id
222 222 self.trck_info = trck_info
... ... @@ -226,13 +226,14 @@ class CoordinateCorregistrateNoObject(threading.Thread):
226 226 self.coord_tracts_queue = coord_tracts_queue
227 227 self.event = event
228 228 self.sle = sle
229   - self.m_icp = None
230   - self.icp = False
  229 + self.m_icp = m_icp
  230 + self.icp = icp
231 231  
232 232 def __bind_events(self):
233 233 Publisher.subscribe(self.UpdateICP, 'Update ICP matrix')
234 234  
235 235 def UpdateICP(self, m_icp, flag):
  236 + print('oi')
236 237 self.m_icp = m_icp
237 238 self.icp = flag
238 239  
... ...
invesalius/gui/dialogs.py
... ... @@ -849,6 +849,23 @@ def ShowNavigationTrackerWarning(trck_id, lib_mode):
849 849 dlg.ShowModal()
850 850 dlg.Destroy()
851 851  
  852 +def ICPcorregistration(fre):
  853 + msg = _("The fiducial registration error is: ") + str(round(fre, 2)) + '\n' + \
  854 + _("Would you like to improve accuracy?")
  855 + if sys.platform == 'darwin':
  856 + dlg = wx.MessageDialog(None, "", msg,
  857 + wx.YES_NO)
  858 + else:
  859 + dlg = wx.MessageDialog(None, msg, "InVesalius 3",
  860 + wx.YES_NO)
  861 +
  862 + if dlg.ShowModal() == wx.ID_YES:
  863 + flag = True
  864 + else:
  865 + flag = False
  866 +
  867 + dlg.Destroy()
  868 + return flag
852 869  
853 870 def ShowEnterMarkerID(default):
854 871 msg = _("Edit marker ID")
... ...
invesalius/gui/task_navigator.py
... ... @@ -665,7 +665,7 @@ class NeuronavigationPanel(wx.Panel):
665 665 for n in [0, 1, 2]:
666 666 self.numctrls_coord[btn_id][n].SetValue(float(coord[n]))
667 667  
668   - def OnICP(self, evt):
  668 + def OnICP(self):
669 669 dialog = dlg.ICPCorregistrationDialog(nav_prop=(self.tracker_id, self.trk_init, self.ref_mode_id))
670 670 if dialog.ShowModal() == wx.ID_OK:
671 671 self.m_icp, point_coord, transformed_points = dialog.GetValue()
... ... @@ -682,9 +682,14 @@ class NeuronavigationPanel(wx.Panel):
682 682 if ctrl.GetValue() and evt and (self.m_icp is not None):
683 683 self.icp = True
684 684 self.icp_button.Enable(0)
  685 + dcr.CoordinateCorregistrateNoObject.icp = True
  686 + dcr.CoordinateCorregistrateNoObject.m_icp = self.m_icp
685 687 else:
686 688 self.icp_button.Enable(1)
687 689 self.icp = False
  690 + dcr.CoordinateCorregistrateNoObject.icp = False
  691 +
  692 + print(self.icp, self.m_icp)
688 693 Publisher.sendMessage("Update ICP matrix", m_icp=self.m_icp, flag=self.icp)
689 694  
690 695 def OnNavigate(self, evt, btn):
... ... @@ -838,6 +843,9 @@ class NeuronavigationPanel(wx.Panel):
838 843 jobs.start()
839 844 # del jobs
840 845  
  846 + if dlg.ICPcorregistration(fre):
  847 + self.OnICP()
  848 +
841 849 def ResetImageFiducials(self):
842 850 for m in range(0, 3):
843 851 self.btns_coord[m].SetValue(False)
... ...