Skip to content

Commit e346b95

Browse files
Merge pull request #964 from TheDeanLab/948-mip-display
2 parents ad37df5 + aaf70d9 commit e346b95

File tree

10 files changed

+1620
-1045
lines changed

10 files changed

+1620
-1045
lines changed

src/navigate/controller/controller.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
1+
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
22
# All rights reserved.
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted for academic and research use only
@@ -56,6 +56,7 @@
5656
StageController,
5757
CameraSettingController,
5858
CameraViewController,
59+
MIPViewController,
5960
MultiPositionController,
6061
ChannelsTabController,
6162
AcquireBarController,
@@ -210,6 +211,11 @@ def __init__(
210211
self.view.camera_waveform.camera_tab, self
211212
)
212213

214+
#: MIPSettingController: MIP Settings Tab Sub-Controller.
215+
self.mip_setting_controller = MIPViewController(
216+
self.view.camera_waveform.mip_tab, self
217+
)
218+
213219
#: CameraSettingController: Camera Settings Tab Sub-Controller.
214220
self.camera_setting_controller = CameraSettingController(
215221
self.view.settings.camera_settings_tab, self
@@ -360,18 +366,15 @@ def change_microscope(self, microscope_name, zoom=None):
360366
self.waveform_popup_controller.populate_experiment_values()
361367

362368
def initialize_cam_view(self):
363-
"""Populate view tab.
369+
"""Populate view and maximum intensity projection tabs.
364370
365-
Populate widgets with necessary data from
366-
config file via config controller. For the entire view tab.
367-
Sets the minimum and maximum counts
368-
for when the data is not being autoscaled.
371+
Communicates with the camera view controller and mip setting controller to
372+
set the minimum and maximum counts, as well as the default channel settings.
369373
"""
370374
# Populating Min and Max Counts
371-
minmax_values = [0, 2**16 - 1]
372-
self.camera_view_controller.initialize("minmax", minmax_values)
373-
image_metrics = [1, 0, 0]
374-
self.camera_view_controller.initialize("image", image_metrics)
375+
self.camera_view_controller.initialize("minmax", [0, 2**16 - 1])
376+
self.mip_setting_controller.initialize("minmax", [0, 2**16 - 1])
377+
self.camera_view_controller.initialize("image", [1, 0, 0])
375378

376379
def populate_experiment_setting(self, file_name=None, in_initialize=False):
377380
"""Load experiment file and populate model.experiment and configure view.
@@ -552,6 +555,7 @@ def set_mode_of_sub(self, mode):
552555
self.channels_tab_controller.set_mode(mode)
553556
self.camera_view_controller.set_mode(mode)
554557
self.camera_setting_controller.set_mode(mode)
558+
self.mip_setting_controller.set_mode(mode)
555559
self.waveform_tab_controller.set_mode(mode)
556560
if mode == "stop":
557561
# GUI Failsafe
@@ -959,6 +963,7 @@ def capture_image(self, command, mode, *args):
959963
args : function-specific passes.
960964
"""
961965
self.camera_view_controller.image_count = 0
966+
self.mip_setting_controller.image_count = 0
962967

963968
# Start up Progress Bars
964969
images_received = 0
@@ -984,7 +989,11 @@ def capture_image(self, command, mode, *args):
984989
self.acquire_bar_controller.view.acquire_btn.configure(state="normal")
985990

986991
self.camera_view_controller.initialize_non_live_display(
987-
self.data_buffer,
992+
self.configuration["experiment"]["MicroscopeState"],
993+
self.configuration["experiment"]["CameraParameters"],
994+
)
995+
996+
self.mip_setting_controller.initialize_non_live_display(
988997
self.configuration["experiment"]["MicroscopeState"],
989998
self.configuration["experiment"]["CameraParameters"],
990999
)
@@ -1010,7 +1019,12 @@ def capture_image(self, command, mode, *args):
10101019
self.execute("stop_acquire")
10111020

10121021
# Display the Image in the View
1013-
self.camera_view_controller.try_to_display_image(image_id=image_id)
1022+
self.camera_view_controller.try_to_display_image(
1023+
image=self.data_buffer[image_id]
1024+
)
1025+
self.mip_setting_controller.try_to_display_image(
1026+
image=self.data_buffer[image_id]
1027+
)
10141028
images_received += 1
10151029

10161030
# Update progress bar.
@@ -1101,7 +1115,7 @@ def display_images(camera_view_controller, show_img_pipe, data_buffer):
11011115
# Display the Image in the View
11021116
try:
11031117
camera_view_controller.try_to_display_image(
1104-
image_id=image_id,
1118+
image=data_buffer[image_id],
11051119
)
11061120
except tkinter._tkinter.TclError:
11071121
print("Can't show images for the additional microscope!")

src/navigate/controller/sub_controllers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .stages import StageController # noqa
66
from .acquire_bar import AcquireBarController # noqa
77
from .channels_tab import ChannelsTabController # noqa
8-
from .camera_view import CameraViewController # noqa
8+
from .camera_view import CameraViewController, MIPViewController # noqa
99
from .camera_settings import CameraSettingController # noqa
1010
from .waveform_tab import WaveformTabController # noqa
1111
from .waveform_popup import WaveformPopupController # noqa

src/navigate/controller/sub_controllers/camera_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ def update_experiment_values(self, *args):
358358

359359
self.roi_widgets["Width"].set(x_pixels)
360360
self.roi_widgets["Height"].set(y_pixels)
361+
self.camera_setting_dict["fov_x"] = self.roi_widgets["FOV_X"].get()
362+
self.camera_setting_dict["fov_y"] = self.roi_widgets["FOV_Y"].get()
361363

362364
return ""
363365

0 commit comments

Comments
 (0)