Skip to content

Commit

Permalink
fix draw_fov_current_position (position signal) and update_live_coord…
Browse files Browse the repository at this point in the history
…inates (position_after_move signal)

fix move from well selector double click

move to cached position on startup no longer hidden behind HOMING flags
  • Loading branch information
soham1202 committed Jan 3, 2025
1 parent 90fa325 commit 19b9bf4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
13 changes: 5 additions & 8 deletions software/control/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3377,17 +3377,14 @@ def update_wellplate_settings(
self.update_display_properties(sample)
self.draw_current_fov(self.x_mm, self.y_mm)

def draw_fov_current_location(self, pos: squid.abc.Pos):
def draw_fov_current_position(self, pos: squid.abc.Pos):
if not pos:
if self.x_mm is None and self.y_mm is None:
if self.x_mm is None or self.y_mm is None:
return
self.draw_current_fov(self.x_mm, self.y_mm)
else:
x_mm = pos.x_mm
y_mm = pos.y_mm
self.draw_current_fov(x_mm, y_mm)
self.x_mm = x_mm
self.y_mm = y_mm
self.x_mm = pos.x_mm
self.y_mm = pos.y_mm
self.draw_current_fov(self.x_mm, self.y_mm)

def get_FOV_pixel_coordinates(self, x_mm, y_mm):
if self.sample == "glass slide":
Expand Down
35 changes: 15 additions & 20 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,14 @@ def __init__(self, is_simulation=False, live_only_mode=False, *args, **kwargs):

self.microscope = control.microscope.Microscope(self.stage, self, is_simulation=is_simulation)

# TODO(imo): Why is moving to the cached position after boot hidden behind homing?
if HOMING_ENABLED_X and HOMING_ENABLED_Y and HOMING_ENABLED_Z:
if cached_pos := squid.stage.utils.get_cached_position():
self.stage.move_x_to(cached_pos.x_mm)
self.stage.move_y_to(cached_pos.y_mm)
self.stage.move_z_to(cached_pos.z_mm)

if ENABLE_WELLPLATE_MULTIPOINT:
self.wellplateMultiPointWidget.init_z()
if cached_pos := squid.stage.utils.get_cached_position():
self.stage.move_x_to(cached_pos.x_mm)
self.stage.move_y_to(cached_pos.y_mm)
self.stage.move_z_to(cached_pos.z_mm)

if ENABLE_WELLPLATE_MULTIPOINT:
self.wellplateMultiPointWidget.init_z()
if ENABLE_FLEXIBLE_MULTIPOINT:
self.flexibleMultiPointWidget.init_z()

# Create the menu bar
Expand Down Expand Up @@ -850,7 +849,7 @@ def makeConnections(self):
if ENABLE_FLEXIBLE_MULTIPOINT:
self.objectivesWidget.signal_objective_changed.connect(self.flexibleMultiPointWidget.update_fov_positions)
# TODO(imo): Fix position updates after removal of navigation controller
self.movement_updater.position_after_move.connect(self.navigationViewer.draw_fov_current_location)
self.movement_updater.position.connect(self.navigationViewer.draw_fov_current_position)
if WELLPLATE_FORMAT == "glass slide":
# TODO(imo): This well place logic is duplicated below in onWellPlateChanged. We should change it to only exist in 1 location.
self.movement_updater.sent_after_stopped.connect(self.wellplateMultiPointWidget.set_live_scan_coordinates)
Expand Down Expand Up @@ -1211,27 +1210,23 @@ def connectSlidePositionController(self):
self.slidePositionController.signal_slide_loading_position_reached.connect(
self.navigationWidget.slot_slide_loading_position_reached
)
if ENABLE_FLEXIBLE_MULTIPOINT:
self.slidePositionController.signal_slide_loading_position_reached.connect(
self.flexibleMultiPointWidget.disable_the_start_aquisition_button
)
if ENABLE_WELLPLATE_MULTIPOINT:
self.slidePositionController.signal_slide_loading_position_reached.connect(
self.wellplateMultiPointWidget.disable_the_start_aquisition_button
)

self.slidePositionController.signal_slide_scanning_position_reached.connect(
self.navigationWidget.slot_slide_scanning_position_reached
)
if ENABLE_FLEXIBLE_MULTIPOINT:
self.slidePositionController.signal_slide_loading_position_reached.connect(
self.flexibleMultiPointWidget.disable_the_start_aquisition_button
)
self.slidePositionController.signal_slide_scanning_position_reached.connect(
self.flexibleMultiPointWidget.enable_the_start_aquisition_button
)
if ENABLE_WELLPLATE_MULTIPOINT:
self.slidePositionController.signal_slide_loading_position_reached.connect(
self.wellplateMultiPointWidget.disable_the_start_aquisition_button
)
self.slidePositionController.signal_slide_scanning_position_reached.connect(
self.wellplateMultiPointWidget.enable_the_start_aquisition_button
)

self.slidePositionController.signal_clear_slide.connect(self.navigationViewer.clear_slide)

def replaceWellSelectionWidget(self, new_widget):
Expand Down
4 changes: 2 additions & 2 deletions software/control/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3729,13 +3729,13 @@ def update_well_coordinates(self, selected):
elif self.scanCoordinates.has_regions():
self.scanCoordinates.clear_regions()

def update_live_coordinates(self, x, y):
def update_live_coordinates(self, pos: squid.abc.Pos):
if hasattr(self.parent, "recordTabWidget") and self.parent.recordTabWidget.currentWidget() != self:
return
scan_size_mm = self.entry_scan_size.value()
overlap_percent = self.entry_overlap.value()
shape = self.combobox_shape.currentText()
self.scanCoordinates.set_live_scan_coordinates(x, y, scan_size_mm, overlap_percent, shape)
self.scanCoordinates.set_live_scan_coordinates(pos.x_mm, pos.y_mm, scan_size_mm, overlap_percent, shape)

def toggle_acquisition(self, pressed):
if not self.base_path_is_set:
Expand Down

0 comments on commit 19b9bf4

Please sign in to comment.