Commit c48845ff11a1b5183b9b648e0873c2cc3c84d20a

Authored by tfmoraes
1 parent a2f19a00

ENH: Applied last victor's patch

Showing 1 changed file with 10 additions and 30 deletions   Show diff stats
invesalius/data/co_registration.py
@@ -9,14 +9,11 @@ import project @@ -9,14 +9,11 @@ import project
9 class Corregister(threading.Thread): 9 class Corregister(threading.Thread):
10 10
11 def __init__(self, bases, flag): 11 def __init__(self, bases, flag):
12 -  
13 threading.Thread.__init__(self) 12 threading.Thread.__init__(self)
14 - self.M = bases[0]  
15 - self.Minv = bases[1]  
16 - self.N = bases[2]  
17 - self.Ninv = bases[3]  
18 - self.q1 = bases[4]  
19 - self.q2 = bases[5] 13 + self.Minv = bases[0]
  14 + self.N = bases[1]
  15 + self.q1 = bases[2]
  16 + self.q2 = bases[3]
20 self.flag = flag 17 self.flag = flag
21 self._pause_ = 0 18 self._pause_ = 0
22 self.start() 19 self.start()
@@ -49,13 +46,6 @@ class Corregister(threading.Thread): @@ -49,13 +46,6 @@ class Corregister(threading.Thread):
49 return coord 46 return coord
50 47
51 def run(self): 48 def run(self):
52 - #Image limits to use in simulation  
53 - #bounds = array(project.Project().imagedata.GetBounds())  
54 - #im_simu = bounds  
55 - #im_simu[0] = bounds[0] - 10.0  
56 - #im_simu[2] = bounds[2] - 10.0  
57 - #im_simu[4] = bounds[4] - 10.0  
58 -  
59 while self.flag == True: 49 while self.flag == True:
60 #Neuronavigation with Polhemus 50 #Neuronavigation with Polhemus
61 trck = self.Coordinates() 51 trck = self.Coordinates()
@@ -63,21 +53,11 @@ class Corregister(threading.Thread): @@ -63,21 +53,11 @@ class Corregister(threading.Thread):
63 img = self.q1 + (self.Minv*self.N)*(tracker - self.q2) 53 img = self.q1 + (self.Minv*self.N)*(tracker - self.q2)
64 coord = [float(img[0]), float(img[1]), float(img[2])] 54 coord = [float(img[0]), float(img[1]), float(img[2])]
65 ps.Publisher().sendMessage('Co-registered Points', coord) 55 ps.Publisher().sendMessage('Co-registered Points', coord)
66 - 56 + coord_cam = float(img[0]), float(img[1]), float(img[2])
  57 + ps.Publisher().sendMessage('Set ball reference position based on bound', coord_cam)
  58 + ps.Publisher().sendMessage('Set camera in volume', coord_cam)
  59 + wx.CallAfter(ps.Publisher().sendMessage, 'Render volume viewer')
  60 + wx.CallAfter(ps.Publisher().sendMessage, 'Co-registered Points', coord)
  61 + sleep(0.05)
67 if self._pause_: 62 if self._pause_:
68 return 63 return
69 -  
70 - #Loop for simulate Polhemus movement and Neuronavigation  
71 - #for i in range(0, 5, 2):  
72 - # while im_simu[i] < (bounds[i+1]+10.0):  
73 - # im_init = matrix([[im_simu[0]], [im_simu[2]], [im_simu[4]]])  
74 - # #mudanca coordenada img2plh  
75 - # tr_simu = self.q2 + (self.Ninv*self.M)*(im_init - self.q1)  
76 - # #mudanca coordenada plh2img  
77 - # img_final = self.q1 + (self.Minv*self.N)*(tr_simu - self.q2)  
78 - # #publica as alteracoes que devem ser feitas nas fatias  
79 - # coord = [float(img_final[0]), float(img_final[1]), float(img_final[2])]  
80 - # ps.Publisher().sendMessage('Co-registered Points', coord)  
81 - # im_simu[i] = im_simu[i] + 4.0  
82 - # if self._pause_:  
83 - # return