Commit 0eeb3ff433eae286c7841a86d11f7b34967bdc36
1 parent
c3fdcee7
Exists in
master
test
Showing
3 changed files
with
30 additions
and
4 deletions
Show diff stats
invesalius/data/coregistration.py
@@ -216,7 +216,7 @@ class CoordinateCorregistrate(threading.Thread): | @@ -216,7 +216,7 @@ class CoordinateCorregistrate(threading.Thread): | ||
216 | 216 | ||
217 | 217 | ||
218 | class CoordinateCorregistrateNoObject(threading.Thread): | 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 | threading.Thread.__init__(self, name='CoordCoregNoObject') | 220 | threading.Thread.__init__(self, name='CoordCoregNoObject') |
221 | self.ref_mode_id = ref_mode_id | 221 | self.ref_mode_id = ref_mode_id |
222 | self.trck_info = trck_info | 222 | self.trck_info = trck_info |
@@ -226,13 +226,14 @@ class CoordinateCorregistrateNoObject(threading.Thread): | @@ -226,13 +226,14 @@ class CoordinateCorregistrateNoObject(threading.Thread): | ||
226 | self.coord_tracts_queue = coord_tracts_queue | 226 | self.coord_tracts_queue = coord_tracts_queue |
227 | self.event = event | 227 | self.event = event |
228 | self.sle = sle | 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 | def __bind_events(self): | 232 | def __bind_events(self): |
233 | Publisher.subscribe(self.UpdateICP, 'Update ICP matrix') | 233 | Publisher.subscribe(self.UpdateICP, 'Update ICP matrix') |
234 | 234 | ||
235 | def UpdateICP(self, m_icp, flag): | 235 | def UpdateICP(self, m_icp, flag): |
236 | + print('oi') | ||
236 | self.m_icp = m_icp | 237 | self.m_icp = m_icp |
237 | self.icp = flag | 238 | self.icp = flag |
238 | 239 |
invesalius/gui/dialogs.py
@@ -849,6 +849,23 @@ def ShowNavigationTrackerWarning(trck_id, lib_mode): | @@ -849,6 +849,23 @@ def ShowNavigationTrackerWarning(trck_id, lib_mode): | ||
849 | dlg.ShowModal() | 849 | dlg.ShowModal() |
850 | dlg.Destroy() | 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 | def ShowEnterMarkerID(default): | 870 | def ShowEnterMarkerID(default): |
854 | msg = _("Edit marker ID") | 871 | msg = _("Edit marker ID") |
invesalius/gui/task_navigator.py
@@ -665,7 +665,7 @@ class NeuronavigationPanel(wx.Panel): | @@ -665,7 +665,7 @@ class NeuronavigationPanel(wx.Panel): | ||
665 | for n in [0, 1, 2]: | 665 | for n in [0, 1, 2]: |
666 | self.numctrls_coord[btn_id][n].SetValue(float(coord[n])) | 666 | self.numctrls_coord[btn_id][n].SetValue(float(coord[n])) |
667 | 667 | ||
668 | - def OnICP(self, evt): | 668 | + def OnICP(self): |
669 | dialog = dlg.ICPCorregistrationDialog(nav_prop=(self.tracker_id, self.trk_init, self.ref_mode_id)) | 669 | dialog = dlg.ICPCorregistrationDialog(nav_prop=(self.tracker_id, self.trk_init, self.ref_mode_id)) |
670 | if dialog.ShowModal() == wx.ID_OK: | 670 | if dialog.ShowModal() == wx.ID_OK: |
671 | self.m_icp, point_coord, transformed_points = dialog.GetValue() | 671 | self.m_icp, point_coord, transformed_points = dialog.GetValue() |
@@ -682,9 +682,14 @@ class NeuronavigationPanel(wx.Panel): | @@ -682,9 +682,14 @@ class NeuronavigationPanel(wx.Panel): | ||
682 | if ctrl.GetValue() and evt and (self.m_icp is not None): | 682 | if ctrl.GetValue() and evt and (self.m_icp is not None): |
683 | self.icp = True | 683 | self.icp = True |
684 | self.icp_button.Enable(0) | 684 | self.icp_button.Enable(0) |
685 | + dcr.CoordinateCorregistrateNoObject.icp = True | ||
686 | + dcr.CoordinateCorregistrateNoObject.m_icp = self.m_icp | ||
685 | else: | 687 | else: |
686 | self.icp_button.Enable(1) | 688 | self.icp_button.Enable(1) |
687 | self.icp = False | 689 | self.icp = False |
690 | + dcr.CoordinateCorregistrateNoObject.icp = False | ||
691 | + | ||
692 | + print(self.icp, self.m_icp) | ||
688 | Publisher.sendMessage("Update ICP matrix", m_icp=self.m_icp, flag=self.icp) | 693 | Publisher.sendMessage("Update ICP matrix", m_icp=self.m_icp, flag=self.icp) |
689 | 694 | ||
690 | def OnNavigate(self, evt, btn): | 695 | def OnNavigate(self, evt, btn): |
@@ -838,6 +843,9 @@ class NeuronavigationPanel(wx.Panel): | @@ -838,6 +843,9 @@ class NeuronavigationPanel(wx.Panel): | ||
838 | jobs.start() | 843 | jobs.start() |
839 | # del jobs | 844 | # del jobs |
840 | 845 | ||
846 | + if dlg.ICPcorregistration(fre): | ||
847 | + self.OnICP() | ||
848 | + | ||
841 | def ResetImageFiducials(self): | 849 | def ResetImageFiducials(self): |
842 | for m in range(0, 3): | 850 | for m in range(0, 3): |
843 | self.btns_coord[m].SetValue(False) | 851 | self.btns_coord[m].SetValue(False) |