From a89b2e0f16bb7e22e7ddb05307b86a2180e98cc6 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 1 May 2024 16:16:02 -0700 Subject: [PATCH] fix negative scan direction stage scanning --- .../lightsheetmanager/model/PLogicSCAPE.java | 3 +- .../acquisitions/AcquisitionEngineSCAPE.java | 43 +++++++++++-------- .../model/devices/vendor/ASIXYStage.java | 9 ++++ 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java b/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java index d87257f..db18900 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/PLogicSCAPE.java @@ -230,6 +230,7 @@ public boolean prepareControllerForAcquisition( xyStage_.setScanPattern(isStageScan2Sided ? ASIXYStage.ScanPattern.SERPENTINE : ASIXYStage.ScanPattern.RASTER); + xyStage_.setScanSettlingTime(acqSettings_.volumeSettings().delayBeforeView()); if (xyStage_.getAxisPolarityX() != ASIXYStage.AxisPolarity.NORMAL) { studio_.logs().showError( @@ -351,7 +352,7 @@ public boolean prepareStageScanForAcquisition(final double x, final double y, De xyStage_.setSlowAxisStop(y / 1000); zSpeedZero_ = true; // will turn false if we are doing planar correction - return false; + return true; // return preparePlanarCorrectionForAcquisition(); TODO: add planar correction later } 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 e3c3bc9..301436b 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngineSCAPE.java @@ -40,6 +40,7 @@ import java.io.IOException; import java.util.ArrayList; + public class AcquisitionEngineSCAPE extends AcquisitionEngine { private double origSpeedX_; @@ -149,29 +150,33 @@ boolean run() { } // --- testing code below --- -// String plcName = "Scanner:AB:33"; -// StrVector propertyNames; -// try { -// propertyNames = core_.getDevicePropertyNames(plcName); -// } catch (Exception e) { -// propertyNames = null; -// } -// -// Gson gsonObj = new Gson(); -// HashMap deviceProps = new HashMap<>(); -// for (String propName : propertyNames) { -// String propValue; +// StrVector deviceNames = core_.getLoadedDevices(); +// for (String deviceName : deviceNames) { +// System.out.println("deviceName: " + deviceName); +// StrVector propertyNames; // try { -// propValue = core_.getProperty(plcName, propName); +// propertyNames = core_.getDevicePropertyNames(deviceName); // } catch (Exception e) { -// propValue = ""; -// System.out.println("failed!"); +// propertyNames = null; // } -// deviceProps.put(propName, propValue); -// //System.out.println(propName); +// +// Gson gsonObj = new Gson(); +// HashMap deviceProps = new HashMap<>(); +// for (String propName : propertyNames) { +// String propValue; +// try { +// propValue = core_.getProperty(deviceName, propName); +// } catch (Exception e) { +// propValue = ""; +// System.out.println("failed!"); +// } +// deviceProps.put(propName, propValue); +// //System.out.println(propName); +// } +// +// String jsonStr = gsonObj.toJson(deviceProps); +// System.out.println(jsonStr); // } -// String jsonStr = gsonObj.toJson(deviceProps); -// System.out.println(jsonStr); setAcquisitionSettings(asb_.build()); diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIXYStage.java b/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIXYStage.java index 47da0a2..f5fe38e 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIXYStage.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/devices/vendor/ASIXYStage.java @@ -158,6 +158,14 @@ public ScanState getScanState() { return ScanState.fromString(getProperty(Properties.SCAN_STATE)); } + public void setScanSettlingTime(final double milliseconds) { + setPropertyFloat(Properties.SCAN_SETTLING_TIME, milliseconds); + } + + public double getScanSettlingTime() { + return getPropertyFloat(Properties.SCAN_SETTLING_TIME); + } + public static class Properties { public static final String AXIS_POLARITY_X = "AxisPolarityX"; public static final String AXIS_POLARITY_Y = "AxisPolarityY"; @@ -173,6 +181,7 @@ public static class Properties { public static final String SCAN_NUM_LINES = "ScanNumLines"; public static final String SCAN_PATTERN = "ScanPattern"; public static final String SCAN_STATE = "ScanState"; + public static final String SCAN_SETTLING_TIME = "ScanSettlingTime(ms)"; public static final String SCAN_FAST_AXIS_START_POSITION = "ScanFastAxisStartPosition(mm)"; public static final String SCAN_FAST_AXIS_STOP_POSITION = "ScanFastAxisStopPosition(mm)";