From 346b88a7cbab68d257fa76b2dde53b86334df992 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 18 Apr 2024 17:00:22 -0700 Subject: [PATCH] fix error on startup with undefined camera --- .../LightSheetManagerPlugin.java | 2 +- .../lightsheetmanager/gui/tabs/CameraTab.java | 17 ++++++++++++----- .../acquisitions/AcquisitionEngineSCAPE.java | 1 - 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java b/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java index 0cb88d9..3546219 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java +++ b/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java @@ -14,7 +14,7 @@ public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin { public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2024"; public static final String description = "A plugin to control various types of light sheet microscopes."; public static final String menuName = "Light Sheet Manager"; - public static final String version = "0.4.1"; + public static final String version = "0.4.2"; private Studio studio_; private LightSheetManagerFrame frame_; diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/CameraTab.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/CameraTab.java index b1a3486..d80f627 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/CameraTab.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/CameraTab.java @@ -8,6 +8,7 @@ import org.micromanager.lightsheetmanager.gui.components.ListeningPanel; import org.micromanager.lightsheetmanager.gui.components.Panel; import org.micromanager.lightsheetmanager.model.LightSheetManagerModel; +import org.micromanager.lightsheetmanager.model.devices.cameras.CameraBase; import java.awt.Font; import java.util.Objects; @@ -53,13 +54,19 @@ private void createUserInterface() { btnGetCurrentROI_ = new Button("Get Current ROI", 120, 30); // get the imaging camera library based on number of imaging paths - CameraLibrary camLib; + CameraLibrary camLib = CameraLibrary.UNKNOWN; if (model_.devices().getDeviceAdapter().getNumImagingPaths() >= 2) { - camLib = CameraLibrary.fromString( - model_.devices().getDevice("Imaging1Camera").getDeviceLibrary()); + final CameraBase camera = model_.devices() + .getDevice("Imaging1Camera"); + if (camera != null) { + camLib = CameraLibrary.fromString(camera.getDeviceLibrary()); + } } else { - camLib = CameraLibrary.fromString( - model_.devices().getDevice("ImagingCamera").getDeviceLibrary()); + final CameraBase camera = model_.devices() + .getDevice("ImagingCamera"); + if (camera != null) { + camLib = CameraLibrary.fromString(camera.getDeviceLibrary()); + } } cmbCameraTriggerMode_ = new ComboBox(CameraMode.getAvailableModes(camLib), diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java index cfd18dd..2d882c9 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java @@ -382,7 +382,6 @@ public void close() { } }, Acquisition.AFTER_CAMERA_HOOK); - ///////////// Turn off autoshutter ///////////////// final boolean isShutterOpen; try {