From ca59ecb1002a3a87c64e85157be085ecf5df6720 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 28 Aug 2024 17:51:52 -0700 Subject: [PATCH] delete moved files --- .../api/LightSheetManager.java | 29 --- .../gui/LightSheetManagerFrame.java | 191 ------------------ .../model/LightSheetManagerModel.java | 162 --------------- 3 files changed, 382 deletions(-) delete mode 100644 src/main/java/org/micromanager/lightsheetmanager/api/LightSheetManager.java delete mode 100644 src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java delete mode 100644 src/main/java/org/micromanager/lightsheetmanager/model/LightSheetManagerModel.java diff --git a/src/main/java/org/micromanager/lightsheetmanager/api/LightSheetManager.java b/src/main/java/org/micromanager/lightsheetmanager/api/LightSheetManager.java deleted file mode 100644 index 679866b..0000000 --- a/src/main/java/org/micromanager/lightsheetmanager/api/LightSheetManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.micromanager.lightsheetmanager.api; - -/** - * Root interface to everything related to Light Sheet Microscope - * - */ -public interface LightSheetManager { - - /** - * Access to a AutofocusSettingsBuilder. - * - * @return AutofocusSettings.Builder with default settings. - */ - AutofocusSettings.Builder autofocusSettingsBuilder(); - - /** - * Access to a VolumeSettingsBuilder. - * - * @return VolumeSettings.Builder with default settings. - */ - VolumeSettings.Builder volumeSettingsBuilder(); - - /** - * Access to a TimingSettingsBuilder. - * - * @return TimingSettings.Builder with default settings. - */ - TimingSettings.Builder timingSettingsBuilder(); -} diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java b/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java deleted file mode 100644 index c462f0b..0000000 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java +++ /dev/null @@ -1,191 +0,0 @@ -package org.micromanager.lightsheetmanager.gui; - -import com.google.common.eventbus.Subscribe; -import mmcorej.CMMCore; -import net.miginfocom.swing.MigLayout; - -import org.micromanager.Studio; -import org.micromanager.events.ExposureChangedEvent; -import org.micromanager.events.LiveModeEvent; - -import org.micromanager.lightsheetmanager.LightSheetManagerPlugin; -import org.micromanager.lightsheetmanager.api.data.GeometryType; -import org.micromanager.lightsheetmanager.gui.components.Label; -import org.micromanager.lightsheetmanager.gui.data.Icons; -import org.micromanager.lightsheetmanager.gui.tabs.TabPanel; -import org.micromanager.lightsheetmanager.gui.tabs.navigation.NavigationPanel; -import org.micromanager.lightsheetmanager.gui.tabs.setup.PositionPanel; -import org.micromanager.lightsheetmanager.gui.utils.WindowUtils; -import org.micromanager.lightsheetmanager.model.LightSheetManagerModel; -import org.micromanager.internal.utils.WindowPositioning; - -import javax.swing.JFrame; -import java.awt.Font; -import java.util.Objects; - -/** - * Main GUI frame. - * - */ -public class LightSheetManagerFrame extends JFrame { - - private final Studio studio_; - private final CMMCore core_; - - private TabPanel tabPanel_; - - private final LightSheetManagerModel model_; - - public LightSheetManagerFrame(final LightSheetManagerModel model, final boolean isLoaded) { - model_ = Objects.requireNonNull(model); - studio_ = model_.studio(); - core_ = studio_.core(); - - // save window position - WindowPositioning.setUpBoundsMemory( - this, this.getClass(), this.getClass().getSimpleName()); - - // create the user interface - if (isLoaded) { - initDialogs(); - final GeometryType geometryType = model_.devices() - .getDeviceAdapter().getMicroscopeGeometry(); - switch (geometryType) { - case DISPIM: - case SCAPE: - createUserInterface(); - break; - default: - model_.setErrorText("Microscope geometry type " - + geometryType + " is not supported yet."); - createErrorUserInterface(); - break; - } - } else { - model_.setErrorText("Error creating the data model. " + - "Do you have the Light Sheet Manager device adapter in your hardware configuration?"); - createErrorUserInterface(); - } - - } - - /** - * This is the window that opens when the plugin encounters an error. - */ - private void createErrorUserInterface() { - setTitle(LightSheetManagerPlugin.menuName); - setResizable(false); - - // use MigLayout as the layout manager - setLayout(new MigLayout( - "insets 10 10 10 10", - "[]10[]", - "[]10[]" - )); - final Label lblTitle = new Label("Light Sheet Manager", Font.BOLD, 16); - final Label lblError = new Label("Error: " + model_.getErrorText(), Font.BOLD, 14); - - add(lblTitle, "wrap"); - add(lblError, ""); - - pack(); // fit window size to layout - setIconImage(Icons.MICROSCOPE.getImage()); - - // clean up resources when the frame is closed - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - } - - /** - * The user interface for diSPIM or SCAPE. - */ - private void createUserInterface() { - setTitle(LightSheetManagerPlugin.menuName); - setResizable(false); - - final Label lblTitle = new Label(LightSheetManagerPlugin.menuName, Font.BOLD, 20); - lblTitle.setFont(new Font(Font.MONOSPACED, Font.BOLD, 20)); - - // use MigLayout as the layout manager - setLayout(new MigLayout( - "insets 10 10 10 10", - "[]20[]", - "[]10[]" - )); - - // main control area - final int width = 900; - final int height = 600; - tabPanel_ = new TabPanel(model_, this, width, height); - - // add ui elements to the panel - add(lblTitle, "wrap"); - add(tabPanel_, "wrap"); - - pack(); // fit window size to layout - setIconImage(Icons.MICROSCOPE.getImage()); - - // clean up resources when the frame is closed - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - // register micro-manager events - studio_.events().registerForEvents(this); - - // TODO: better way to connect all of this together, maybe observer pattern for updater - PositionPanel positionPanel = tabPanel_.getSetupPathTab(1).getSetupPanel().getPositionPanel(); - tabPanel_.getNavigationTab().getNavigationPanel() - .getPositionUpdater().setPositionPanel(positionPanel); - - if (model_.pluginSettings().isPollingPositions()) { - tabPanel_.getNavigationTab().getNavigationPanel().startPolling(); - } - - WindowUtils.registerWindowClosingEvent(this, event -> { - tabPanel_.getNavigationTab().getNavigationPanel().stopPolling(); - model_.userSettings().save(); - studio_.logs().logMessage("user settings saved"); - }); - - } - - // TODO: remove when there is a better method to stop polling from acq engine - public NavigationPanel getNavigationPanel() { - return tabPanel_.getNavigationTab().getNavigationPanel(); - } - - public Studio getStudio_() { - return studio_; - } - - /** - * Detect settings after the model is loaded, - * ask to change settings with dialogs. - */ - private void initDialogs() { - model_.devices().checkDevices(this); - } - - public void toggleLiveMode() { - if (studio_.live().isLiveModeOn()) { - studio_.live().setLiveModeOn(false); - // close the live mode window if it exists - if (studio_.live().getDisplay() != null) { - studio_.live().getDisplay().close(); - } - } else { - studio_.live().setLiveModeOn(true); - } - } - - // Note: doesn't seem to work for all cameras - @Subscribe - public void liveModeListener(LiveModeEvent event) { -// if (!studio_.live().isLiveModeOn()) { -// } - } - - @Subscribe - public void onExposureChanged(ExposureChangedEvent event) { -// System.out.println("Exposure changed!"); - } - -} \ No newline at end of file diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/LightSheetManagerModel.java b/src/main/java/org/micromanager/lightsheetmanager/model/LightSheetManagerModel.java deleted file mode 100644 index e4279cb..0000000 --- a/src/main/java/org/micromanager/lightsheetmanager/model/LightSheetManagerModel.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.micromanager.lightsheetmanager.model; - -import mmcorej.CMMCore; -import org.micromanager.Studio; -import org.micromanager.lightsheetmanager.api.AutofocusSettings; -import org.micromanager.lightsheetmanager.api.LightSheetManager; -import org.micromanager.lightsheetmanager.api.TimingSettings; -import org.micromanager.lightsheetmanager.api.VolumeSettings; -import org.micromanager.lightsheetmanager.api.data.GeometryType; -import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngine; -import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngineDISPIM; -import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngineSCAPE; -import org.micromanager.lightsheetmanager.model.playlist.AcquisitionTableData; - -import java.util.Objects; - -/** - * This is the container for all the data needed to operate a microscope with light sheet manager. - */ -public class LightSheetManagerModel implements LightSheetManager { - - private final Studio studio_; - private final CMMCore core_; - - private String errorText_; - - private UserSettings userSettings_; - private PluginSettings pluginSettings_; - - private final XYZGrid xyzGrid_; - private final DeviceManager deviceManager_; - - private AcquisitionEngine acqEngine_; - private AcquisitionTableData acqTableData_; - - public LightSheetManagerModel(final Studio studio) { - studio_ = Objects.requireNonNull(studio); - core_ = studio_.core(); - - pluginSettings_ = new PluginSettings(); - userSettings_ = new UserSettings(this); - xyzGrid_ = new XYZGrid(this); - deviceManager_ = new DeviceManager(studio_, this); - - // set during setup if there is an errordisplayed in the error ui - errorText_ = ""; - } - - /** - * Returns true when the model is loaded correctly. - * - * @return true if the model loads with no errors - */ - public boolean setup() { - - // first we check to see if the device adapter is present - if (!deviceManager_.hasDeviceAdapter()) { - return false; - } - - // setup devices - deviceManager_.setup(); - - // create different acq engine based on microscope geometry - final GeometryType geometryType = deviceManager_ - .getDeviceAdapter().getMicroscopeGeometry(); - switch (geometryType) { - case SCAPE: - acqEngine_ = new AcquisitionEngineSCAPE(this); - break; - case DISPIM: - acqEngine_ = new AcquisitionEngineDISPIM(this); - break; - default: - studio_.logs().logError( - "setup error, AcquisitionEngine not implemented for " + geometryType); - return false; // early exit => error - } - - // load settings - userSettings_.load(); - - // if we made it here then everything loaded correctly - return true; - } - - /** - * This sets the text to be displayed in the error ui when an error occurs during setup. - * - * @param text the error message - */ - public void setErrorText(final String text) { - errorText_ = text; - } - - public String getErrorText() { - return errorText_; - } - - public AcquisitionEngine getAcquisitionEngine() { - return acqEngine_; - } - - public AcquisitionEngine acquisitions() { - return acqEngine_; - } - - public DeviceManager getDeviceManager() { - return deviceManager_; - } - - public DeviceManager devices() { - return deviceManager_; - } - - public UserSettings userSettings() { - return userSettings_; - } - - public PluginSettings pluginSettings() { - return pluginSettings_; - } - - public void pluginSettings(final PluginSettings pluginSettings) { - pluginSettings_ = Objects.requireNonNull(pluginSettings); - } - - public CMMCore getCore() { - return core_; - } - - public CMMCore core() { - return core_; - } - - public Studio getStudio() { - return studio_; - } - - public Studio studio() { - return studio_; - } - - public XYZGrid getXYZGrid() { - return xyzGrid_; - } - - @Override - public AutofocusSettings.Builder autofocusSettingsBuilder() { - return null; - } - - @Override - public VolumeSettings.Builder volumeSettingsBuilder() { - return null; - } - - @Override - public TimingSettings.Builder timingSettingsBuilder() { - return null; - } -}