Skip to content

Commit

Permalink
Merge pull request #256 from bls337/main
Browse files Browse the repository at this point in the history
switch to scape settings as default for now
  • Loading branch information
bls337 authored Mar 14, 2024
2 parents 36ea964 + 9905cf3 commit e3027a7
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.swing.SwingUtilities;
import org.micromanager.Studio;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.data.Icons;
import org.micromanager.lightsheetmanager.gui.tabs.acquisition.AdvancedTimingPanel;
Expand Down Expand Up @@ -81,7 +82,7 @@ public AcquisitionTab(final LightSheetManagerModel model) {

private void createUserInterface() {

final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

Panel.setMigLayoutDefault(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.micromanager.lightsheetmanager.api.data.AutofocusFitType;
import org.micromanager.lightsheetmanager.api.data.AutofocusMode;
import org.micromanager.lightsheetmanager.api.data.AutofocusType;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
import org.micromanager.lightsheetmanager.gui.components.ComboBox;
import org.micromanager.lightsheetmanager.gui.components.Label;
Expand Down Expand Up @@ -52,7 +52,7 @@ public AutofocusTab(final LightSheetManagerModel model) {
}

public void createUserInterface() {
final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

final Label lblTitle = new Label("Autofocus Settings", Font.BOLD, 18);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.EventObject;

import org.micromanager.internal.utils.FileDialogs;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.gui.components.*;
import org.micromanager.lightsheetmanager.gui.components.Button;
Expand Down Expand Up @@ -54,7 +54,7 @@ private void createUserInterface() {
final Label lblTitle = new Label("Data Settings", Font.BOLD, 18);


final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

final Panel pnlSave = new Panel("Image Save Settings");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.micromanager.lightsheetmanager.gui.tabs;

import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
Expand Down Expand Up @@ -41,7 +41,7 @@ public SettingsTab(final LightSheetManagerModel model) {
}

private void createUserInterface() {
final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

isUsingPLogic_ = model_.devices().isUsingPLogic();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.micromanager.lightsheetmanager.gui.tabs.acquisition;

import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.components.Button;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
import org.micromanager.lightsheetmanager.gui.components.Label;
Expand Down Expand Up @@ -30,7 +30,7 @@ public MultiPositionPanel(final LightSheetManagerModel model, final CheckBox cbx
}

private void createUserInterface() {
final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

Spinner.setDefaultSize(7);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.micromanager.lightsheetmanager.gui.tabs.acquisition;

import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
import org.micromanager.lightsheetmanager.gui.components.Label;
import org.micromanager.lightsheetmanager.gui.components.Panel;
Expand All @@ -26,7 +26,7 @@ public TimePointsPanel(final LightSheetManagerModel model, final CheckBox cbxUse
}

private void createUserInterface() {
final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

setMigLayout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.micromanager.lightsheetmanager.api.data.CameraMode;
import org.micromanager.lightsheetmanager.api.data.GeometryType;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.components.Button;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
import org.micromanager.lightsheetmanager.gui.components.Panel;
Expand Down Expand Up @@ -66,7 +66,7 @@ private void createUserInterface() {
final GeometryType geometryType = model_.devices()
.getDeviceAdapter().getMicroscopeGeometry();

final DefaultAcquisitionSettingsDISPIM acqSettings = model_.acquisitions()
final DefaultAcquisitionSettingsSCAPE acqSettings = model_.acquisitions()
.settings();

pnlFirst_ = new Panel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import org.micromanager.lightsheetmanager.api.data.GeometryType;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.data.Icons;
import org.micromanager.lightsheetmanager.gui.components.Button;
import org.micromanager.lightsheetmanager.gui.components.Panel;
Expand Down Expand Up @@ -76,7 +76,7 @@ private void createUserInterface() {
}
btnRunAutofocus_ = new Button("Run Autofocus", 120, 26);

final DefaultAcquisitionSettingsDISPIM acqSettings =
final DefaultAcquisitionSettingsSCAPE acqSettings =
model_.acquisitions().settings();

txtSlope_ = new TextField(7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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.AcquisitionEngineDISPIM;
import org.micromanager.lightsheetmanager.model.acquisitions.AcquisitionEngineSCAPE;
import org.micromanager.lightsheetmanager.model.playlist.AcquisitionTableData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ public PLogicDISPIM(final LightSheetManagerModel model) {
devices_ = model_.devices();
core_ = studio_.core();

acqSettings_ = model_.acquisitions().settings();

// TODO: remove this when a more generic method is available and get from model
//acqSettings_ = model_.acquisitions().settings();
acqSettings_ = new DefaultAcquisitionSettingsDISPIM.Builder().build();

scanDistance_ = 0;
actualStepSizeUm_ = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import mmcorej.CMMCore;
import mmcorej.Configuration;
import org.micromanager.Studio;
import org.micromanager.lightsheetmanager.api.AcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.data.AcquisitionMode;
import org.micromanager.lightsheetmanager.api.data.CameraMode;
import org.micromanager.lightsheetmanager.api.data.GeometryType;
import org.micromanager.lightsheetmanager.api.data.MultiChannelMode;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.api.internal.DefaultTimingSettings;
import org.micromanager.lightsheetmanager.model.channels.ChannelSpec;
import org.micromanager.lightsheetmanager.model.devices.cameras.CameraBase;
Expand Down Expand Up @@ -57,7 +56,7 @@ public class PLogicSCAPE {
private static final int triggerSPIMAddr = 46; // backplane signal, same as XY card's TTL output
private static final int laserTriggerAddress = 10; // this should be set to (42 || 8) = (TTL1 || manual laser on)

private final DefaultAcquisitionSettingsDISPIM acqSettings_;
private final DefaultAcquisitionSettingsSCAPE acqSettings_;

private final LightSheetManagerModel model_;

Expand Down Expand Up @@ -93,7 +92,7 @@ public PLogicSCAPE(final LightSheetManagerModel model) {
* @return
*/
public boolean prepareControllerForAcquisitionOffsetOnly(
final DefaultAcquisitionSettingsDISPIM settings,
final DefaultAcquisitionSettingsSCAPE settings,
final double channelOffset) {

final int numViews = settings.volumeSettings().numViews();
Expand Down Expand Up @@ -264,7 +263,7 @@ public boolean prepareControllerForAcquisitionOffsetOnly(
// }

public boolean prepareControllerForAcquisitionSCAPE(
final DefaultAcquisitionSettingsDISPIM settings,
final DefaultAcquisitionSettingsSCAPE settings,
final double channelOffset) {
// turn off beam and scan on both sides (they are turned off by SPIM state machine anyway)
// also ensures that properties match reality at end of acquisition
Expand Down Expand Up @@ -317,7 +316,7 @@ public boolean prepareControllerForAcquisitionSCAPE(
}

// Compute appropriate motor speed in mm/s for the given stage scanning settings
public double computeScanSpeed(DefaultAcquisitionSettingsDISPIM settings, final int numScansPerSlice) {
public double computeScanSpeed(DefaultAcquisitionSettingsSCAPE settings, final int numScansPerSlice) {
//double sliceDuration = settings.timingSettings().sliceDuration();
//double sliceDuration = 0.0; // TODO: get from SliceTiming
double sliceDuration = getSliceDuration(settings.timingSettings(), numScansPerSlice); // TODO: ???
Expand All @@ -333,7 +332,7 @@ public double computeScanSpeed(DefaultAcquisitionSettingsDISPIM settings, final
}

// compute how many channels we do in each one-way scan
private int computeScanChannelsPerPass(DefaultAcquisitionSettingsDISPIM settings) {
private int computeScanChannelsPerPass(DefaultAcquisitionSettingsSCAPE settings) {
return settings.channelMode() == MultiChannelMode.SLICE_HW ? settings.numChannels() : 1;
}

Expand All @@ -343,7 +342,7 @@ private int computeScanChannelsPerPass(DefaultAcquisitionSettingsDISPIM settings
* @param motorSpeed
* @return
*/
public double computeScanAcceleration(final double motorSpeed, DefaultAcquisitionSettingsDISPIM settings) {
public double computeScanAcceleration(final double motorSpeed, DefaultAcquisitionSettingsSCAPE settings) {
return (10 + 100 * (motorSpeed / xyStage_.getMaxSpeedX())) * settings.scanSettings().scanAccelerationFactor();
}

Expand Down Expand Up @@ -376,7 +375,7 @@ public double computeScanAcceleration(final double motorSpeed, final double maxM
return (10 + 100 * (motorSpeed / maxMotorSpeed)) * stageScanAccelFactor;
}

public boolean prepareStageScanForAcquisition(final double x, final double y, DefaultAcquisitionSettingsDISPIM settings) {
public boolean prepareStageScanForAcquisition(final double x, final double y, DefaultAcquisitionSettingsSCAPE settings) {
final boolean scanFromCurrent = settings.scanSettings().scanFromCurrentPosition();
final boolean scanNegative = settings.scanSettings().scanFromNegativeDirection();
double xStartUm;
Expand Down Expand Up @@ -415,7 +414,7 @@ public boolean prepareStageScanForAcquisition(final double x, final double y, De
* @param centerPiezos true to move piezos to center position
* @return false if there is a fatal error, true if successful
*/
public boolean cleanUpControllerAfterAcquisition(final DefaultAcquisitionSettingsDISPIM settings, final boolean centerPiezos) {
public boolean cleanUpControllerAfterAcquisition(final DefaultAcquisitionSettingsSCAPE settings, final boolean centerPiezos) {
// clear "acquisition running" flag on PLC
plcCamera_.setPreset(2);
plcLaser_.setPreset(2);
Expand Down Expand Up @@ -447,7 +446,7 @@ public boolean cleanUpControllerAfterAcquisition(final DefaultAcquisitionSetting
}

public boolean prepareControllerForAcquisitionSide(
final AcquisitionSettingsDISPIM settings,
final DefaultAcquisitionSettingsSCAPE settings,
final int view,
final double channelOffset,
final boolean offsetOnly) {
Expand Down Expand Up @@ -686,7 +685,7 @@ private boolean cleanUpControllerAfterAcquisitionSide(
return true;
}

public boolean setupHardwareChannelSwitching(final DefaultAcquisitionSettingsDISPIM settings) {
public boolean setupHardwareChannelSwitching(final DefaultAcquisitionSettingsSCAPE settings) {

MultiChannelMode channelMode = settings.channelMode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import mmcorej.org.json.JSONObject;
import org.micromanager.UserProfile;
import org.micromanager.lightsheetmanager.api.data.GeometryType;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.propertymap.MutablePropertyMapView;

import java.util.Iterator;
Expand Down Expand Up @@ -77,8 +77,8 @@ public void load() {
JSONObject loadedJson = validateUserSettings(json);
if (loadedJson != null) {
// TODO: switch this based on microscope geometry type
DefaultAcquisitionSettingsDISPIM acqSettings = DefaultAcquisitionSettingsDISPIM.fromJson(
loadedJson.toString(), DefaultAcquisitionSettingsDISPIM.class);
DefaultAcquisitionSettingsSCAPE acqSettings = DefaultAcquisitionSettingsSCAPE.fromJson(
loadedJson.toString(), DefaultAcquisitionSettingsSCAPE.class);
model_.acquisitions().setAcquisitionSettings(acqSettings);
//System.out.println("loadedJson: " + loadedJson);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public void save() {
private JSONObject validateUserSettings(final String loadedSettings) {
// get default settings from builder
final String defaultSettings =
new DefaultAcquisitionSettingsDISPIM.Builder().build().toJson();
new DefaultAcquisitionSettingsSCAPE.Builder().build().toJson();
// validate json strings and count the number of keys
int numLoadedKeys, numDefaultKeys;
JSONObject loadedJson, defaultJson;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.micromanager.lightsheetmanager.LightSheetManagerPlugin;
import org.micromanager.lightsheetmanager.api.AcquisitionManager;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.model.autofocus.AutofocusRunner;
import org.micromanager.lightsheetmanager.model.DataStorage;
Expand All @@ -35,8 +36,8 @@ public abstract class AcquisitionEngine implements AcquisitionManager, MMAcquist
protected final Studio studio_;
protected final CMMCore core_;

protected DefaultAcquisitionSettingsDISPIM.Builder asb_;
protected DefaultAcquisitionSettingsDISPIM acqSettings_;
protected DefaultAcquisitionSettingsSCAPE.Builder asb_;
protected DefaultAcquisitionSettingsSCAPE acqSettings_;

private final ExecutorService acquisitionExecutor_ = Executors.newSingleThreadExecutor(
r -> new Thread(r, "Acquisition Thread"));
Expand Down Expand Up @@ -64,7 +65,7 @@ public AcquisitionEngine(final LightSheetManagerModel model) {
autofocusRunner_ = new AutofocusRunner(model_);

// default settings
asb_ = new DefaultAcquisitionSettingsDISPIM.Builder();
asb_ = new DefaultAcquisitionSettingsSCAPE.Builder();
acqSettings_ = asb_.build();
}

Expand All @@ -88,8 +89,8 @@ public void setFrame(final LightSheetManagerFrame frame) {
*
* @param acqSettings the acquisition settings to set
*/
public void setAcquisitionSettings(final DefaultAcquisitionSettingsDISPIM acqSettings) {
asb_ = new DefaultAcquisitionSettingsDISPIM.Builder(acqSettings);
public void setAcquisitionSettings(final DefaultAcquisitionSettingsSCAPE acqSettings) {
asb_ = new DefaultAcquisitionSettingsSCAPE.Builder(acqSettings);
acqSettings_ = acqSettings;
}

Expand Down Expand Up @@ -232,15 +233,15 @@ protected DefaultSummaryMetadata addMMSummaryMetadata(JSONObject summaryMetadata

// TODO: keep long method name versions or just use aliases?

public DefaultAcquisitionSettingsDISPIM settings() {
public DefaultAcquisitionSettingsSCAPE settings() {
return acqSettings_;
}
//
// public DefaultAcquisitionSettingsDISPIM getAcquisitionSettings() {
// return acqSettings_;
// }
//
public DefaultAcquisitionSettingsDISPIM.Builder settingsBuilder() {
public DefaultAcquisitionSettingsSCAPE.Builder settingsBuilder() {
return asb_;
}
//
Expand Down
Loading

0 comments on commit e3027a7

Please sign in to comment.