Skip to content

Commit

Permalink
Merge pull request #150 from bls337/main
Browse files Browse the repository at this point in the history
stop polling positions before running acq
  • Loading branch information
bls337 authored Sep 28, 2023
2 parents 0b4e093 + 8f623bd commit 9be53cf
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@Plugin(type = MenuPlugin.class)
public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin {
public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022";
public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2023";
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.1.0";
Expand Down Expand Up @@ -42,6 +42,7 @@ public void onPluginSelected() {
model_ = new LightSheetManagerModel(studio_);
final boolean isLoaded = model_.setup();
frame_ = new LightSheetManagerFrame(model_, isLoaded);
model_.acquisitions().setFrame(frame_); // TODO: remove later
frame_.setVisible(true);
frame_.toFront();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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.utils.WindowUtils;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.internal.utils.WindowPositioning;
Expand Down Expand Up @@ -136,6 +137,11 @@ private void createUserInterface() {

}

// 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_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ public void stopPolling() {
positionUpdater_.stopPolling();
}

public boolean isPolling() {
return positionUpdater_.isPolling();
}

public void haltAllDevices() {
System.out.println("Halt pressed!");
for (ControlPanel controlPanel : controlPanels_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ public void startPolling() {
public void stopPolling() {
isPolling_.set(false);
}

public boolean isPolling() {
return isPolling_.get();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.micromanager.lightsheetmanager.model.acquisitions;

import javafx.scene.effect.Light;
import mmcorej.CMMCore;
import mmcorej.StrVector;
import mmcorej.org.json.JSONArray;
Expand Down Expand Up @@ -30,6 +31,7 @@
import org.micromanager.lightsheetmanager.api.data.GeometryType;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultTimingSettings;
import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.model.autofocus.AutofocusRunner;
import org.micromanager.lightsheetmanager.model.DataStorage;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
Expand Down Expand Up @@ -70,6 +72,10 @@ public class AcquisitionEngine implements AcquisitionManager, MMAcquistionContro
private Pipeline curPipeline_;
private long nextWakeTime_ = -1;


// TODO: remove later, hacky method to stop position updater for now
private LightSheetManagerFrame frame_;

public AcquisitionEngine(final LightSheetManagerModel model) {
model_ = Objects.requireNonNull(model);
studio_ = model.studio();
Expand All @@ -83,6 +89,10 @@ public AcquisitionEngine(final LightSheetManagerModel model) {
acqSettings_ = asb_.build();
}

public void setFrame(final LightSheetManagerFrame frame) {
frame_ = Objects.requireNonNull(frame);
}

/**
* Sets the acquisition settings and populates the acquisition settings builder with its values.
*
Expand Down Expand Up @@ -179,6 +189,11 @@ public boolean isRunning() {
private void runAcquisitionSCAPE() {
// System.out.println(asb_);
// System.out.println(asb_.build());
final boolean isPolling = frame_.getNavigationPanel().isPolling();
if (isPolling) {
System.out.println("stopped!");
frame_.getNavigationPanel().stopPolling();
}

// TODO: remove this when acqSettings for SCAPE are implemented
asb_.useAdvancedTiming(true);
Expand Down Expand Up @@ -617,6 +632,11 @@ public void close() {
// TODO: execute any end-acquisition runnables

currentAcquisition_ = null;

// start polling for navigation panel
if (isPolling) {
frame_.getNavigationPanel().startPolling();
}
}
}

Expand Down

0 comments on commit 9be53cf

Please sign in to comment.