From 6ff784ebd86bdddc462015260ddb1787b863b6d8 Mon Sep 17 00:00:00 2001 From: fedem-p Date: Mon, 6 Jun 2022 14:51:52 +0200 Subject: [PATCH 1/5] added extra layer to display first volume --- sashimi/gui/camera_gui.py | 58 +++++++++++++++++++++++++++++++++++++++ sashimi/gui/main_gui.py | 4 +++ sashimi/state.py | 15 +++++++++- 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/sashimi/gui/camera_gui.py b/sashimi/gui/camera_gui.py index afab32f5..27fd5f18 100644 --- a/sashimi/gui/camera_gui.py +++ b/sashimi/gui/camera_gui.py @@ -102,6 +102,19 @@ def __init__(self, state: State, timer: QTimer, style: str): name="frame_layer", ) + self.drift_layer = self.viewer.add_image( + np.zeros( + [ + 1, + ] + + self.max_sensor_resolution + ), + blending="additive", + name="drift_layer", + colormap="red", + visible=False, + ) + # Add square ROI of size max image size: self.roi = self.viewer.add_shapes( [np.array([[0, 0], [s[0], 0], [s[0], s[1]], [0, s[1]]])], @@ -135,8 +148,13 @@ def __init__(self, state: State, timer: QTimer, style: str): self.contrast_range = ContrastSettings() self.wid_contrast_range = ParameterGui(self.contrast_range) + self.active_drift_chk = QCheckBox("Activate Drift Reference") + self.display_drift_chk = QCheckBox("Visualize/Hide Drift Reference") + self.bottom_layout.addWidget(self.auto_contrast_chk) self.bottom_layout.addWidget(self.wid_contrast_range) + self.bottom_layout.addWidget(self.active_drift_chk) + self.bottom_layout.addWidget(self.display_drift_chk) self.bottom_layout.addStretch() @@ -148,6 +166,13 @@ def __init__(self, state: State, timer: QTimer, style: str): self.auto_contrast_chk.stateChanged.connect(self.update_auto_contrast) self.contrast_range.sig_param_changed.connect(self.set_manual_contrast) + # connect drift widget + self.active_drift_chk.clicked.connect(self.activate_drift_reference) + self.display_drift_chk.clicked.connect(self.display_drift_reference) + self.display_drift_chk.setEnabled( + False + ) # only enabled if drift reference is activated + self.auto_contrast_chk.setChecked(True) self.state.camera_settings.sig_param_changed.connect( @@ -229,8 +254,10 @@ def toggle_ndims(self): """ if self.ndisplay_button.isChecked(): self.frame_layer.scale = [self.voxel_size[0] / self.voxel_size[1], 1.0, 1.0] + self.drift_layer.scale = [self.voxel_size[0] / self.voxel_size[1], 1.0, 1.0] else: self.frame_layer.scale = [1.0, 1.0, 1.0] + self.drift_layer.scale = [1.0, 1.0, 1.0] def update_current_plane(self, _): self.state.current_plane = self.viewer.dims.current_step[0] @@ -254,6 +281,37 @@ def update_auto_contrast(self, is_checked): def set_manual_contrast(self): self.frame_layer.contrast_limits = self.contrast_range.contrast_range + def activate_drift_reference(self): + self.state.is_drift_active = not self.state.is_drift_active + + def display_drift_reference(self): + if self.state.drift_ref is not None: + self.drift_layer.visible = not self.drift_layer.visible + else: + print("Error: drift was inactive before start of acquisition") + + def display_drift(self, is_exp_started=False): + if ( + is_exp_started + and self.state.is_drift_active + and self.state.drift_ref is not None + ): + # set layer data + self.drift_layer.data = self.state.drift_ref + # set buttons + self.display_drift_chk.setEnabled(True) + self.display_drift_chk.setChecked(True) + # set layer visibility + self.drift_layer.visible = True + else: + # set buttons + self.display_drift_chk.setEnabled(False) + self.display_drift_chk.setChecked(False) + # set layer visibility + self.drift_layer.visible = False + # reset drift image + self.state.reset_drift_reference() + class CameraSettingsWidget(QWidget): """Widget to modify parameters for the camera. diff --git a/sashimi/gui/main_gui.py b/sashimi/gui/main_gui.py index ab95c548..a681397d 100644 --- a/sashimi/gui/main_gui.py +++ b/sashimi/gui/main_gui.py @@ -158,6 +158,10 @@ def set_enabled_gui(self, enable): self.wid_camera.setEnabled(enable) self.wid_save_options.setEnabled(enable) self.wid_display.auto_contrast_chk.setEnabled(enable) + self.wid_display.active_drift_chk.setEnabled(enable) + self.wid_display.display_drift( + is_exp_started=not enable + ) # notifies the viewing widget to display drift layer class StatusWidget(QTabWidget): diff --git a/sashimi/state.py b/sashimi/state.py index 5e2f8c33..81fde949 100644 --- a/sashimi/state.py +++ b/sashimi/state.py @@ -310,6 +310,8 @@ def __init__(self): self.logger = ConcurrenceLogger("main") self.calibration_ref = None + self.drift_ref = None + self.is_drift_active = False self.waveform = None self.current_plane = 0 self.stop_event = LoggedEvent(self.logger, SashimiEvents.CLOSE_ALL) @@ -555,7 +557,9 @@ def send_scansave_settings(self): self.dispatcher.n_planes_queue.put(self.n_planes) def start_experiment(self): - # TODO disable the GUI except the abort button + + if self.is_drift_active: + self.get_drift_reference() self.current_exp_state = GlobalState.EXPERIMENT_RUNNING self.logger.log_message("started experiment") self.scanner.wait_signal.set() @@ -572,6 +576,7 @@ def end_experiment(self): self.experiment_start_event.clear() self.saver.save_queue.clear() self.send_scansave_settings() + self.reset_drift_reference() self.current_exp_state = GlobalState.PAUSED def is_exp_started(self) -> bool: @@ -648,6 +653,14 @@ def reset_noise_subtraction(self): self.calibration_ref = None self.noise_subtraction_active.clear() + def reset_drift_reference(self): + self.drift_ref = None + + def get_drift_reference(self): + self.drift_ref = None + while self.drift_ref is None: + self.drift_ref = self.get_volume() + def get_volume(self): # TODO consider get_last_parameters method try: From 49c8f03c5a4ec4834454078eded0fe07a4f114a8 Mon Sep 17 00:00:00 2001 From: fedem-p Date: Tue, 7 Jun 2022 16:09:03 +0200 Subject: [PATCH 2/5] moved logic in camera gui --- sashimi/gui/camera_gui.py | 42 +++++++++++++++++++++++++++++---------- sashimi/gui/main_gui.py | 7 ++++--- sashimi/state.py | 13 ------------ 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/sashimi/gui/camera_gui.py b/sashimi/gui/camera_gui.py index 27fd5f18..b3fbc24e 100644 --- a/sashimi/gui/camera_gui.py +++ b/sashimi/gui/camera_gui.py @@ -82,6 +82,10 @@ def __init__(self, state: State, timer: QTimer, style: str): self.refresh_display = True self.is_first_frame = True self.auto_contrast = True + self.is_exp_started = False + self.is_exp_ended = False + + self.is_drift_active = False s = self.get_fullframe_size() self.image_shape = (1, s, s) @@ -100,6 +104,7 @@ def __init__(self, state: State, timer: QTimer, style: str): ), blending="translucent", name="frame_layer", + visible=True, ) self.drift_layer = self.viewer.add_image( @@ -150,11 +155,13 @@ def __init__(self, state: State, timer: QTimer, style: str): self.active_drift_chk = QCheckBox("Activate Drift Reference") self.display_drift_chk = QCheckBox("Visualize/Hide Drift Reference") + self.display_frame_chk = QCheckBox("Visualize/Hide Frame Reference") self.bottom_layout.addWidget(self.auto_contrast_chk) self.bottom_layout.addWidget(self.wid_contrast_range) self.bottom_layout.addWidget(self.active_drift_chk) self.bottom_layout.addWidget(self.display_drift_chk) + self.bottom_layout.addWidget(self.display_frame_chk) self.bottom_layout.addStretch() @@ -169,11 +176,13 @@ def __init__(self, state: State, timer: QTimer, style: str): # connect drift widget self.active_drift_chk.clicked.connect(self.activate_drift_reference) self.display_drift_chk.clicked.connect(self.display_drift_reference) + self.display_frame_chk.clicked.connect(self.display_frame_reference) self.display_drift_chk.setEnabled( False ) # only enabled if drift reference is activated self.auto_contrast_chk.setChecked(True) + self.display_frame_chk.setChecked(True) self.state.camera_settings.sig_param_changed.connect( self.launch_delayed_contrast_reset @@ -235,6 +244,14 @@ def refresh_image(self): self.frame_layer.data = current_image # self.frame_layer.scale = [self.voxel_size[0] / self.voxel_size[1], 1.0, 1.0] + if self.is_exp_started: + self.display_drift(frame = current_image, is_exp_running=True) + self.is_exp_started = False + elif self.is_exp_ended: + self.display_drift(is_exp_running=False) + self.is_exp_ended = False + + # Check if anything changed in the image shape, which would mean that changes of the contrast # are required (in case a parameter update was missed). if self.is_first_frame or self.image_shape != current_image.shape: @@ -282,22 +299,26 @@ def set_manual_contrast(self): self.frame_layer.contrast_limits = self.contrast_range.contrast_range def activate_drift_reference(self): - self.state.is_drift_active = not self.state.is_drift_active + # self.state.is_drift_active = not self.state.is_drift_active + self.is_drift_active = not self.is_drift_active def display_drift_reference(self): - if self.state.drift_ref is not None: + if self.drift_layer.data is not None: self.drift_layer.visible = not self.drift_layer.visible else: print("Error: drift was inactive before start of acquisition") - - def display_drift(self, is_exp_started=False): - if ( - is_exp_started - and self.state.is_drift_active - and self.state.drift_ref is not None + + def display_frame_reference(self): + self.frame_layer.visible = not self.frame_layer.visible + + def display_drift(self, frame = None, is_exp_running = False): + if (is_exp_running + and self.is_drift_active + and frame is not None ): # set layer data - self.drift_layer.data = self.state.drift_ref + self.drift_layer.data = frame + self.drift_layer.contrast_limits= self.frame_layer.contrast_limits # set buttons self.display_drift_chk.setEnabled(True) self.display_drift_chk.setChecked(True) @@ -310,7 +331,8 @@ def display_drift(self, is_exp_started=False): # set layer visibility self.drift_layer.visible = False # reset drift image - self.state.reset_drift_reference() + self.drift_layer.data = np.zeros([2,2]) + class CameraSettingsWidget(QWidget): diff --git a/sashimi/gui/main_gui.py b/sashimi/gui/main_gui.py index a681397d..5fa6cc95 100644 --- a/sashimi/gui/main_gui.py +++ b/sashimi/gui/main_gui.py @@ -146,8 +146,11 @@ def check_end_experiment(self): # check if experiment started or ended and update gui enabling if self.st.is_exp_started(): self.set_enabled_gui(enable=False) + self.wid_display.is_exp_started = True + elif self.st.is_exp_ended(): self.set_enabled_gui(enable=True) + self.wid_display.is_exp_ended = True def set_enabled_gui(self, enable): """Disable all the gui elements during the experiment""" @@ -159,9 +162,7 @@ def set_enabled_gui(self, enable): self.wid_save_options.setEnabled(enable) self.wid_display.auto_contrast_chk.setEnabled(enable) self.wid_display.active_drift_chk.setEnabled(enable) - self.wid_display.display_drift( - is_exp_started=not enable - ) # notifies the viewing widget to display drift layer + class StatusWidget(QTabWidget): diff --git a/sashimi/state.py b/sashimi/state.py index 81fde949..f75fcba7 100644 --- a/sashimi/state.py +++ b/sashimi/state.py @@ -310,8 +310,6 @@ def __init__(self): self.logger = ConcurrenceLogger("main") self.calibration_ref = None - self.drift_ref = None - self.is_drift_active = False self.waveform = None self.current_plane = 0 self.stop_event = LoggedEvent(self.logger, SashimiEvents.CLOSE_ALL) @@ -558,8 +556,6 @@ def send_scansave_settings(self): def start_experiment(self): - if self.is_drift_active: - self.get_drift_reference() self.current_exp_state = GlobalState.EXPERIMENT_RUNNING self.logger.log_message("started experiment") self.scanner.wait_signal.set() @@ -576,7 +572,6 @@ def end_experiment(self): self.experiment_start_event.clear() self.saver.save_queue.clear() self.send_scansave_settings() - self.reset_drift_reference() self.current_exp_state = GlobalState.PAUSED def is_exp_started(self) -> bool: @@ -653,14 +648,6 @@ def reset_noise_subtraction(self): self.calibration_ref = None self.noise_subtraction_active.clear() - def reset_drift_reference(self): - self.drift_ref = None - - def get_drift_reference(self): - self.drift_ref = None - while self.drift_ref is None: - self.drift_ref = self.get_volume() - def get_volume(self): # TODO consider get_last_parameters method try: From 12927971da9afde76ce1d017fb4b60c686ff061f Mon Sep 17 00:00:00 2001 From: fedem-p Date: Tue, 7 Jun 2022 16:43:45 +0200 Subject: [PATCH 3/5] linting and added docstrings --- sashimi/gui/camera_gui.py | 57 ++++++++++++++++++++++++--------------- sashimi/gui/main_gui.py | 10 ++++--- sashimi/state.py | 18 +++++++++---- 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/sashimi/gui/camera_gui.py b/sashimi/gui/camera_gui.py index b3fbc24e..d97f997f 100644 --- a/sashimi/gui/camera_gui.py +++ b/sashimi/gui/camera_gui.py @@ -84,7 +84,6 @@ def __init__(self, state: State, timer: QTimer, style: str): self.auto_contrast = True self.is_exp_started = False self.is_exp_ended = False - self.is_drift_active = False s = self.get_fullframe_size() @@ -107,6 +106,7 @@ def __init__(self, state: State, timer: QTimer, style: str): visible=True, ) + # create drift layer and set it as not visible self.drift_layer = self.viewer.add_image( np.zeros( [ @@ -244,14 +244,14 @@ def refresh_image(self): self.frame_layer.data = current_image # self.frame_layer.scale = [self.voxel_size[0] / self.voxel_size[1], 1.0, 1.0] + # If experiment is started/ended call the display drift function if self.is_exp_started: - self.display_drift(frame = current_image, is_exp_running=True) + self.display_drift(frame=current_image, is_exp_running=True) self.is_exp_started = False elif self.is_exp_ended: self.display_drift(is_exp_running=False) self.is_exp_ended = False - - + # Check if anything changed in the image shape, which would mean that changes of the contrast # are required (in case a parameter update was missed). if self.is_first_frame or self.image_shape != current_image.shape: @@ -298,27 +298,43 @@ def update_auto_contrast(self, is_checked): def set_manual_contrast(self): self.frame_layer.contrast_limits = self.contrast_range.contrast_range - def activate_drift_reference(self): - # self.state.is_drift_active = not self.state.is_drift_active + def activate_drift_reference(self) -> None: + """ + If active the first volume during the experiment + will be saved and overlayed to the viewer + """ self.is_drift_active = not self.is_drift_active - def display_drift_reference(self): - if self.drift_layer.data is not None: + def display_drift_reference(self) -> None: + """ + Toggles the visualization of the drift layer on/off + """ + # if not None or empty + if self.drift_layer.data is not None or np.any(self.drift_layer.data): self.drift_layer.visible = not self.drift_layer.visible - else: - print("Error: drift was inactive before start of acquisition") - - def display_frame_reference(self): + + def display_frame_reference(self) -> None: + """ + Toggles the visualization of the main layer on/off + """ self.frame_layer.visible = not self.frame_layer.visible - - def display_drift(self, frame = None, is_exp_running = False): - if (is_exp_running - and self.is_drift_active - and frame is not None - ): + + def display_drift(self, frame=None, is_exp_running=False) -> None: + """ + If the conditions are right displays the drift layer, + else it will disable the buttons and reset the drift layer + + Args: + frame (np.ndarray): current image used to refresh the viewer after the experiment started. + Defaults to None. + is_exp_running (bool): check to discriminate between start and end of the experiment. + Defaults to False. + """ + # if experiment started, button is selected and frame has been generated + if is_exp_running and self.is_drift_active and frame is not None: # set layer data self.drift_layer.data = frame - self.drift_layer.contrast_limits= self.frame_layer.contrast_limits + self.drift_layer.contrast_limits = self.frame_layer.contrast_limits # set buttons self.display_drift_chk.setEnabled(True) self.display_drift_chk.setChecked(True) @@ -331,8 +347,7 @@ def display_drift(self, frame = None, is_exp_running = False): # set layer visibility self.drift_layer.visible = False # reset drift image - self.drift_layer.data = np.zeros([2,2]) - + self.drift_layer.data = np.zeros([2, 2]) class CameraSettingsWidget(QWidget): diff --git a/sashimi/gui/main_gui.py b/sashimi/gui/main_gui.py index 5fa6cc95..e39aaa99 100644 --- a/sashimi/gui/main_gui.py +++ b/sashimi/gui/main_gui.py @@ -146,14 +146,19 @@ def check_end_experiment(self): # check if experiment started or ended and update gui enabling if self.st.is_exp_started(): self.set_enabled_gui(enable=False) + # pass down to the display window the information self.wid_display.is_exp_started = True - + elif self.st.is_exp_ended(): self.set_enabled_gui(enable=True) + # pass down to the display window the information self.wid_display.is_exp_ended = True def set_enabled_gui(self, enable): - """Disable all the gui elements during the experiment""" + """ + Disable all the gui elements during the experiment + and re-enables them after + """ self.menuBar().setEnabled(enable) self.wid_laser.setEnabled(enable) self.wid_status.setEnabled(enable) @@ -164,7 +169,6 @@ def set_enabled_gui(self, enable): self.wid_display.active_drift_chk.setEnabled(enable) - class StatusWidget(QTabWidget): def __init__(self, st: State, timer): super().__init__() diff --git a/sashimi/state.py b/sashimi/state.py index f75fcba7..2af61180 100644 --- a/sashimi/state.py +++ b/sashimi/state.py @@ -554,8 +554,11 @@ def send_scansave_settings(self): self.saver.saving_parameter_queue.put(self.save_params) self.dispatcher.n_planes_queue.put(self.n_planes) - def start_experiment(self): - + def start_experiment(self) -> None: + """ + Sets all the signals and cleans the queue + to trigger the start of the experiment + """ self.current_exp_state = GlobalState.EXPERIMENT_RUNNING self.logger.log_message("started experiment") self.scanner.wait_signal.set() @@ -566,7 +569,11 @@ def start_experiment(self): time.sleep(0.01) self.is_saving_event.set() - def end_experiment(self): + def end_experiment(self) -> None: + """ + Sets all the signals and cleans the queue + to trigger the end of the experiment + """ self.logger.log_message("experiment ended") self.is_saving_event.clear() self.experiment_start_event.clear() @@ -577,7 +584,7 @@ def end_experiment(self): def is_exp_started(self) -> bool: """ check if the experiment has started: - looks for tha change in the value hold by current_exp_running + looks for tha change in the value hold by current_exp_state Returns: bool @@ -594,7 +601,7 @@ def is_exp_started(self) -> bool: def is_exp_ended(self) -> bool: """ check if the experiment has ended: - looks for tha change in the value hold by current_exp_running + looks for tha change in the value hold by current_exp_state Returns: bool @@ -645,6 +652,7 @@ def obtain_noise_average(self, n_images=50): self.dispatcher.calibration_ref_queue.put(self.calibration_ref) def reset_noise_subtraction(self): + self.calibration_ref = None self.noise_subtraction_active.clear() From 59ae552f5b59c39c6dd6e244772f3344765ae4cb Mon Sep 17 00:00:00 2001 From: fedem-p Date: Thu, 16 Jun 2022 13:48:43 +0200 Subject: [PATCH 4/5] Updated drift visualization --- sashimi/gui/camera_gui.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sashimi/gui/camera_gui.py b/sashimi/gui/camera_gui.py index d97f997f..8ac5f1b0 100644 --- a/sashimi/gui/camera_gui.py +++ b/sashimi/gui/camera_gui.py @@ -110,9 +110,8 @@ def __init__(self, state: State, timer: QTimer, style: str): self.drift_layer = self.viewer.add_image( np.zeros( [ - 1, + 1, 5, 5, ] - + self.max_sensor_resolution ), blending="additive", name="drift_layer", @@ -155,7 +154,7 @@ def __init__(self, state: State, timer: QTimer, style: str): self.active_drift_chk = QCheckBox("Activate Drift Reference") self.display_drift_chk = QCheckBox("Visualize/Hide Drift Reference") - self.display_frame_chk = QCheckBox("Visualize/Hide Frame Reference") + self.display_frame_chk = QCheckBox("Visualize/Hide Live View") self.bottom_layout.addWidget(self.auto_contrast_chk) self.bottom_layout.addWidget(self.wid_contrast_range) @@ -177,12 +176,15 @@ def __init__(self, state: State, timer: QTimer, style: str): self.active_drift_chk.clicked.connect(self.activate_drift_reference) self.display_drift_chk.clicked.connect(self.display_drift_reference) self.display_frame_chk.clicked.connect(self.display_frame_reference) + + self.display_frame_chk.setChecked(True) + self.display_frame_chk.setEnabled(False) self.display_drift_chk.setEnabled( False ) # only enabled if drift reference is activated self.auto_contrast_chk.setChecked(True) - self.display_frame_chk.setChecked(True) + self.state.camera_settings.sig_param_changed.connect( self.launch_delayed_contrast_reset @@ -336,18 +338,25 @@ def display_drift(self, frame=None, is_exp_running=False) -> None: self.drift_layer.data = frame self.drift_layer.contrast_limits = self.frame_layer.contrast_limits # set buttons + #-> drift is active -> all buttons on self.display_drift_chk.setEnabled(True) self.display_drift_chk.setChecked(True) + self.display_frame_chk.setChecked(True) + self.display_frame_chk.setEnabled(True) # set layer visibility self.drift_layer.visible = True else: # set buttons + # -> drift inactive all buttons off self.display_drift_chk.setEnabled(False) self.display_drift_chk.setChecked(False) + self.display_frame_chk.setChecked(True) #live view on + self.display_frame_chk.setEnabled(False) # set layer visibility self.drift_layer.visible = False + self.frame_layer.visible = True #live view on # reset drift image - self.drift_layer.data = np.zeros([2, 2]) + self.drift_layer.data = self.frame_layer.data * 0 class CameraSettingsWidget(QWidget): From ea533157b3083e4766876135a738c0fcbf4c824d Mon Sep 17 00:00:00 2001 From: fedem-p Date: Tue, 28 Jun 2022 13:46:17 +0200 Subject: [PATCH 5/5] linting --- sashimi/gui/camera_gui.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sashimi/gui/camera_gui.py b/sashimi/gui/camera_gui.py index 8ac5f1b0..51ede5db 100644 --- a/sashimi/gui/camera_gui.py +++ b/sashimi/gui/camera_gui.py @@ -110,7 +110,9 @@ def __init__(self, state: State, timer: QTimer, style: str): self.drift_layer = self.viewer.add_image( np.zeros( [ - 1, 5, 5, + 1, + 5, + 5, ] ), blending="additive", @@ -176,7 +178,7 @@ def __init__(self, state: State, timer: QTimer, style: str): self.active_drift_chk.clicked.connect(self.activate_drift_reference) self.display_drift_chk.clicked.connect(self.display_drift_reference) self.display_frame_chk.clicked.connect(self.display_frame_reference) - + self.display_frame_chk.setChecked(True) self.display_frame_chk.setEnabled(False) self.display_drift_chk.setEnabled( @@ -184,7 +186,6 @@ def __init__(self, state: State, timer: QTimer, style: str): ) # only enabled if drift reference is activated self.auto_contrast_chk.setChecked(True) - self.state.camera_settings.sig_param_changed.connect( self.launch_delayed_contrast_reset @@ -338,7 +339,7 @@ def display_drift(self, frame=None, is_exp_running=False) -> None: self.drift_layer.data = frame self.drift_layer.contrast_limits = self.frame_layer.contrast_limits # set buttons - #-> drift is active -> all buttons on + # -> drift is active -> all buttons on self.display_drift_chk.setEnabled(True) self.display_drift_chk.setChecked(True) self.display_frame_chk.setChecked(True) @@ -350,11 +351,11 @@ def display_drift(self, frame=None, is_exp_running=False) -> None: # -> drift inactive all buttons off self.display_drift_chk.setEnabled(False) self.display_drift_chk.setChecked(False) - self.display_frame_chk.setChecked(True) #live view on + self.display_frame_chk.setChecked(True) # live view on self.display_frame_chk.setEnabled(False) # set layer visibility self.drift_layer.visible = False - self.frame_layer.visible = True #live view on + self.frame_layer.visible = True # live view on # reset drift image self.drift_layer.data = self.frame_layer.data * 0