Skip to content

Commit

Permalink
Merge pull request #119 from Cephla-Lab/deprecate-display-resolution
Browse files Browse the repository at this point in the history
starting to remove display resolution scaling
  • Loading branch information
hongquanli authored Feb 24, 2025
2 parents ce076bb + 1c8f0eb commit 7084d71
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 43 deletions.
8 changes: 0 additions & 8 deletions software/control/_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,6 @@ class PLATE_READER:
OFFSET_ROW_A_MM = 20


DEFAULT_DISPLAY_CROP = 100 # value ranges from 1 to 100 - image display crop size

CAMERA_PIXEL_SIZE_UM = {
"IMX290": 2.9,
"IMX178": 2.4,
Expand All @@ -436,9 +434,6 @@ class PLATE_READER:

ENABLE_TRACKING = False
TRACKING_SHOW_MICROSCOPE_CONFIGURATIONS = False # set to true when doing multimodal acquisition
if ENABLE_TRACKING:
DEFAULT_DISPLAY_CROP = 100


class AF:
STOP_THRESHOLD = 0.85
Expand Down Expand Up @@ -744,9 +739,6 @@ def load_formats():
Y_HOME_SAFETY_MARGIN_UM = 50
Z_HOME_SAFETY_MARGIN_UM = 600

if ENABLE_TRACKING:
DEFAULT_DISPLAY_CROP = Tracking.DEFAULT_DISPLAY_CROP

USE_XERYON = False
XERYON_SERIAL_NUMBER = "95130303033351E02050"
XERYON_SPEED = 80
Expand Down
32 changes: 1 addition & 31 deletions software/control/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def on_new_frame(self, camera):
# send image to display
time_now = time.time()
if time_now - self.timestamp_last_display >= 1 / self.fps_display:
# self.image_to_display.emit(cv2.resize(image_cropped,(round(self.crop_width*self.display_resolution_scaling), round(self.crop_height*self.display_resolution_scaling)),cv2.INTER_LINEAR))
self.image_to_display.emit(
utils.crop_image(
image_cropped,
Expand All @@ -221,34 +220,6 @@ def on_new_frame(self, camera):
self.handler_busy = False
camera.image_locked = False

"""
def on_new_frame_from_simulation(self,image,frame_ID,timestamp):
# check whether image is a local copy or pointer, if a pointer, needs to prevent the image being modified while this function is being executed
self.handler_busy = True
# crop image
image_cropped = utils.crop_image(image,self.crop_width,self.crop_height)
# send image to display
time_now = time.time()
if time_now-self.timestamp_last_display >= 1/self.fps_display:
self.image_to_display.emit(cv2.resize(image_cropped,(round(self.crop_width*self.display_resolution_scaling), round(self.crop_height*self.display_resolution_scaling)),cv2.INTER_LINEAR))
self.timestamp_last_display = time_now
# send image to write
if self.save_image_flag and time_now-self.timestamp_last_save >= 1/self.fps_save:
self.packet_image_to_write.emit(image_cropped,frame_ID,timestamp)
self.timestamp_last_save = time_now
# send image to track
if time_now-self.timestamp_last_display >= 1/self.fps_track:
# track emit
self.timestamp_last_track = time_now
self.handler_busy = False
"""


class ImageSaver(QObject):

Expand Down Expand Up @@ -485,7 +456,7 @@ def __init__(
self.counter = 0
self.timestamp_last = 0

self.display_resolution_scaling = DEFAULT_DISPLAY_CROP / 100
self.display_resolution_scaling = 1

self.enable_channel_auto_filter_switching = True

Expand Down Expand Up @@ -1091,7 +1062,6 @@ def run_autofocus(self):
image, rotate_image_angle=self.camera.rotate_image_angle, flip_image=self.camera.flip_image
)
self.image_to_display.emit(image)
# image_to_display = utils.crop_image(image,round(self.crop_width* self.liveController.display_resolution_scaling), round(self.crop_height* self.liveController.display_resolution_scaling))

QApplication.processEvents()
timestamp_0 = time.time()
Expand Down
4 changes: 2 additions & 2 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def loadObjects(self, is_simulation):
self.laserAFSettingManager = None
self.configurationManager = core.ConfigurationManager(channel_manager=self.channelConfigurationManager, laser_af_manager=self.laserAFSettingManager)
self.contrastManager = core.ContrastManager()
self.streamHandler = core.StreamHandler(display_resolution_scaling=DEFAULT_DISPLAY_CROP / 100)
self.streamHandler = core.StreamHandler()

self.liveController = core.LiveController(
self.camera, self.microcontroller, self.illuminationController, parent=self
Expand Down Expand Up @@ -572,7 +572,7 @@ def loadWidgets(self):
self.liveController,
self.objectiveStore,
self.channelConfigurationManager,
show_display_options=True,
show_display_options=False,
show_autolevel=True,
autolevel=True,
)
Expand Down
4 changes: 2 additions & 2 deletions software/control/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ def add_components(self, show_trigger_options, show_display_options, show_autole
self.slider_resolutionScaling.setTickPosition(QSlider.TicksBelow)
self.slider_resolutionScaling.setMinimum(10)
self.slider_resolutionScaling.setMaximum(100)
self.slider_resolutionScaling.setValue(DEFAULT_DISPLAY_CROP)
self.slider_resolutionScaling.setValue(100)
self.slider_resolutionScaling.setSingleStep(10)

self.label_resolutionScaling = QSpinBox()
Expand Down Expand Up @@ -4740,7 +4740,7 @@ def initControlWidgets(self, show_trigger_options, show_display_options, show_au
# Resolution Scaling
self.slider_resolutionScaling = QSlider(Qt.Horizontal)
self.slider_resolutionScaling.setRange(10, 100)
self.slider_resolutionScaling.setValue(int(DEFAULT_DISPLAY_CROP))
self.slider_resolutionScaling.setValue(100)
self.slider_resolutionScaling.setTickPosition(QSlider.TicksBelow)
self.slider_resolutionScaling.setTickInterval(10)
self.slider_resolutionScaling.valueChanged.connect(self.update_resolution_scaling)
Expand Down

0 comments on commit 7084d71

Please sign in to comment.