Commit 4e997fd40e551e00b4cc2b857a83491959c9ad97
1 parent
49a3bef8
Exists in
master
testing icp FRE...
Showing
2 changed files
with
10 additions
and
6 deletions
Show diff stats
invesalius/data/bases.py
... | ... | @@ -175,7 +175,7 @@ def calculate_fre_m(fiducials): |
175 | 175 | |
176 | 176 | return float(np.sqrt(np.sum(dist ** 2) / 3)) |
177 | 177 | |
178 | -def calculate_fre(fiducials_raw, fiducials, ref_mode_id, m_change): | |
178 | +def calculate_fre(fiducials_raw, fiducials, ref_mode_id, m_change, m_icp=None): | |
179 | 179 | |
180 | 180 | dist = np.zeros([3, 1]) |
181 | 181 | |
... | ... | @@ -188,6 +188,9 @@ def calculate_fre(fiducials_raw, fiducials, ref_mode_id, m_change): |
188 | 188 | p2_m, m_img = dcr.corregistrate_dynamic(coreg_data, p2, ref_mode_id, [None, None]) |
189 | 189 | p3_m, m_img = dcr.corregistrate_dynamic(coreg_data, p3, ref_mode_id, [None, None]) |
190 | 190 | |
191 | + if m_icp: | |
192 | + m_img = transform_icp(m_img, m_icp) | |
193 | + | |
191 | 194 | print(p1_m) |
192 | 195 | print(fiducials[0, :]) |
193 | 196 | ... | ... |
invesalius/gui/task_navigator.py
... | ... | @@ -689,6 +689,8 @@ class NeuronavigationPanel(wx.Panel): |
689 | 689 | else: |
690 | 690 | self.m_icp = None |
691 | 691 | |
692 | + return self.m_icp | |
693 | + | |
692 | 694 | def Oncheckicp(self, evt, ctrl): |
693 | 695 | if ctrl.GetValue() and evt and (self.m_icp is not None): |
694 | 696 | self.icp = True |
... | ... | @@ -786,11 +788,8 @@ class NeuronavigationPanel(wx.Panel): |
786 | 788 | tracker_mode = self.trk_init, self.tracker_id, self.ref_mode_id |
787 | 789 | |
788 | 790 | # compute fiducial registration error (FRE) |
789 | - # this is the old way to compute the fre, left here to recheck if new works fine. | |
790 | - # fre = db.calculate_fre(self.fiducials, minv, n, q1, q2) | |
791 | - fre = db.calculate_fre_m(self.fiducials) | |
791 | + fre = db.calculate_fre(self.fiducials_raw, self.fiducials, self.ref_mode_id, m_change) | |
792 | 792 | self.UpdateFRE(fre) |
793 | - print(db.calculate_fre(self.fiducials_raw, self.fiducials, self.ref_mode_id, m_change)) | |
794 | 793 | |
795 | 794 | if self.track_obj: |
796 | 795 | # if object tracking is selected |
... | ... | @@ -851,7 +850,9 @@ class NeuronavigationPanel(wx.Panel): |
851 | 850 | # del jobs |
852 | 851 | |
853 | 852 | if dlg.ICPcorregistration(fre): |
854 | - self.OnICP() | |
853 | + m_icp = self.OnICP() | |
854 | + fre = db.calculate_fre(self.fiducials_raw, self.fiducials, self.ref_mode_id, m_change, m_icp) | |
855 | + self.UpdateFRE(fre) | |
855 | 856 | |
856 | 857 | def ResetImageFiducials(self): |
857 | 858 | for m in range(0, 3): | ... | ... |