reversed align function to not iterate for the pick align
@@ -1685,6 +1685,18 @@ class View(QtGui.QLabel):
return [(y_min, x_min), (y_max, x_max)]
def align(self):
+ if len(self._picks) > 0:
+ shift = self.shift_from_picked()
+ sp = lib.ProgressDialog('Shifting channels', 0, len(self.locs), self)
+ sp.set_value(0)
+ for i, locs_ in enumerate(self.locs):
+ locs_.y -= shift[0][i]
+ locs_.x -= shift[1][i]
+ if len(shift) == 3:
+ locs_.z -= shift[2][i]
+ sp.set_value(i+1)
+ self.update_scene()
+ else:
completed = False
max_iterations = 10
iteration = 0
@@ -1699,9 +1711,6 @@ class View(QtGui.QLabel):
while not completed:
completed = True
- if len(self._picks) > 0:
- shift = self.shift_from_picked()
- else:
shift = self.shift_from_rcc()
sp = lib.ProgressDialog('Shifting channels', 0, len(self.locs), self)
sp.set_value(0)
@@ -1711,7 +1720,6 @@ class View(QtGui.QLabel):
for i, locs_ in enumerate(self.locs):
if np.absolute(shift[0][i]) + np.absolute(shift[1][i]) > convergence:
completed = False
- print('Continuing iteratioon')
locs_.y -= shift[0][i]
locs_.x -= shift[1][i]
@@ -1728,7 +1736,6 @@ class View(QtGui.QLabel):
shift_z.append(np.mean(temp_shift_z))
iteration+=1
self.update_scene()
-
#Plot shift etc
if display:
fig1 = plt.figure(figsize=(8, 8))
@@ -1823,7 +1830,6 @@ class View(QtGui.QLabel):
for i, (locs_, info_) in enumerate(zip(self.locs, self.infos)):
_, image = render.render(locs_, info_, blur_method='smooth')
images.append(image)
- print(image.shape)
rp.set_value(i + 1)
n_pairs = int(n_channels * (n_channels - 1) / 2)
rc = lib.ProgressDialog('Correlating image pairs', 0, n_pairs, self)
