diff --git a/PYME/Acquire/SpoolController.py b/PYME/Acquire/SpoolController.py index ae1dd27c9..666414bbe 100644 --- a/PYME/Acquire/SpoolController.py +++ b/PYME/Acquire/SpoolController.py @@ -414,7 +414,8 @@ def StartSpooling(self, fn=None, stack=None, compLevel=None, if stack: protocol = protocol_z protocol.dwellTime = z_dwell - #print(protocol) + stack_settings = stack if hasattr(stack, 'keys') else None + protocol.set_stack_positions(stack_settings) else: protocol = protocol diff --git a/PYME/Acquire/protocol.py b/PYME/Acquire/protocol.py index 056d6fc77..6950bd621 100644 --- a/PYME/Acquire/protocol.py +++ b/PYME/Acquire/protocol.py @@ -192,11 +192,14 @@ def __init__(self, taskList, startFrame, dwellTime, metadataEntries=[], prefligh self.slice_order = slice_order self.require_camera_restart = require_camera_restart - - def Init(self, spooler): - self.zPoss = np.arange(scope.stackSettings.GetStartPos(), - scope.stackSettings.GetEndPos() + .95 * scope.stackSettings.GetStepSize(), - scope.stackSettings.GetStepSize() * scope.stackSettings.GetDirection()) + + def set_stack_positions(self, stack_mdh=None): + stack_mdh = dict() if stack_mdh is None else stack_mdh + start = stack_mdh.get('StackSettings.StartPos', scope.stackSettings.GetStartPos()) + stop = stack_mdh.get('StackSettings.EndPos', scope.stackSettings.GetEndPos()) + direction = 1 if stop > start else -1 + step = direction * stack_mdh.get('StackSettings.StepSize', scope.stackSettings.GetStepSize()) + self.zPoss = np.arange(start, stop + .95 * step, step) if self.slice_order != 'saw': if self.slice_order == 'random': @@ -208,9 +211,10 @@ def Init(self, spooler): else: # even self.zPoss = np.concatenate([self.zPoss[::2], self.zPoss[-1::-2]]) + + self.piezoName = 'Positioning.%s' % stack_mdh.get('StackSettings.ScanPiezo', scope.stackSettings.GetScanChannel()) - - self.piezoName = 'Positioning.%s' % scope.stackSettings.GetScanChannel() + def Init(self, spooler): self.startPos = scope.state[self.piezoName + '_target'] #FIXME - _target positions shouldn't be part of scope state self.pos = 0