Skip to content

Commit

Permalink
Merge pull request #174 from bls337/main
Browse files Browse the repository at this point in the history
remove rest of CameraMode.INTERNAL, improve ui reliability
  • Loading branch information
bls337 authored Oct 4, 2023
2 parents 7a61b08 + a2ead75 commit cf756ba
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum CameraMode {
}

public static CameraMode fromString(final String symbol) {
return stringToEnum.getOrDefault(symbol, CameraMode.INTERNAL);
return stringToEnum.getOrDefault(symbol, CameraMode.EDGE);
}

public static CameraMode getByIndex(final int index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static class Builder extends DefaultAcquisitionSettings.Builder<Builder>
private DefaultSliceCalibration.Builder[] slcb_ = new DefaultSliceCalibration.Builder[2];
private AcquisitionMode acquisitionMode_ = AcquisitionMode.NONE;
private MultiChannelMode channelMode_ = MultiChannelMode.NONE;
private CameraMode cameraMode_ = CameraMode.INTERNAL;
private CameraMode cameraMode_ = CameraMode.EDGE;

private boolean useChannels_ = false;
private boolean useTimePoints_ = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,51 +90,58 @@ private void createUserInterface() {
}

private void createEventHandlers() {
final DefaultTimingSettings.Builder tsb_ = model_.acquisitions()
.settingsBuilder().timingSettingsBuilder();

spnDelayBeforeScan_.registerListener(e -> {
tsb_.delayBeforeScan(spnDelayBeforeScan_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().delayBeforeScan(spnDelayBeforeScan_.getDouble());
//System.out.println("delayBeforeScan: " + acqSettings.getTimingSettings().delayBeforeScan());
});

spnScansPerSlice_.registerListener(e -> {
tsb_.scansPerSlice(spnScansPerSlice_.getInt());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().scansPerSlice(spnScansPerSlice_.getInt());
//System.out.println("scansPerSlice: " + acqSettings.getTimingSettings().scansPerSlice());
});

spnScanDuration_.registerListener(e -> {
tsb_.scanDuration(spnScanDuration_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().scanDuration(spnScanDuration_.getDouble());
//System.out.println("scanDuration: " + acqSettings.getTimingSettings().scanDuration());
});

spnDelayBeforeLaser_.registerListener(e -> {
tsb_.delayBeforeLaser(spnDelayBeforeLaser_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().delayBeforeLaser(spnDelayBeforeLaser_.getDouble());
//System.out.println("delayBeforeLaser: " + acqSettings.getTimingSettings().delayBeforeLaser());
});

spnLaserTriggerDuration_.registerListener(e -> {
tsb_.laserTriggerDuration(spnLaserTriggerDuration_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().laserTriggerDuration(spnLaserTriggerDuration_.getDouble());
//System.out.println("laserTriggerDuration: " + acqSettings.getTimingSettings().laserTriggerDuration());
});

spnDelayBeforeCamera_.registerListener(e -> {
tsb_.delayBeforeCamera(spnDelayBeforeCamera_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().delayBeforeCamera(spnDelayBeforeCamera_.getDouble());
//System.out.println("delayBeforeCamera: " + acqSettings.getTimingSettings().delayBeforeCamera());
});

spnCameraTriggerDuration_.registerListener(e -> {
tsb_.cameraTriggerDuration(spnCameraTriggerDuration_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().cameraTriggerDuration(spnCameraTriggerDuration_.getDouble());
//System.out.println("cameraTriggerDuration: " + acqSettings.getTimingSettings().cameraTriggerDuration());
});

spnCameraExposure_.registerListener(e -> {
tsb_.cameraExposure(spnCameraExposure_.getDouble());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().cameraExposure(spnCameraExposure_.getDouble());
//System.out.println("cameraExposure: " + acqSettings.getTimingSettings().cameraExposure());
});

cbxAlternateScanDirection_.registerListener(e -> {
tsb_.useAlternateScanDirection(cbxAlternateScanDirection_.isSelected());
model_.acquisitions().settingsBuilder()
.timingSettingsBuilder().useAlternateScanDirection(cbxAlternateScanDirection_.isSelected());
//System.out.println("useAlternateScanDirection: " + acqSettings.getTimingSettings().useAlternateScanDirection());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ private void createUserInterface() {
}

private void createEventHandlers() {
final DefaultAcquisitionSettingsDISPIM.Builder asb_ =
model_.acquisitions().settingsBuilder();

btnOpenXYZGrid_.registerListener(e -> xyzGridFrame_.setVisible(true));
btnEditPositionList_.registerListener(e -> model_.studio().app().showPositionList());

spnPostMoveDelay_.registerListener(e -> {
asb_.postMoveDelay(spnPostMoveDelay_.getInt());
model_.acquisitions().settingsBuilder().postMoveDelay(spnPostMoveDelay_.getInt());
//System.out.println("getPostMoveDelay: " + model_.acquisitions().getAcquisitionSettings().getPostMoveDelay());
});

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

import org.micromanager.lightsheetmanager.api.data.CameraMode;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM;
import org.micromanager.lightsheetmanager.api.internal.DefaultSliceSettings;
import org.micromanager.lightsheetmanager.api.internal.DefaultSliceSettingsLS;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
Expand Down Expand Up @@ -87,52 +86,50 @@ private void createUserInterface() {
*/
private void createEventHandlers() {

final DefaultSliceSettings.Builder ssb_ = model_.acquisitions()
.settingsBuilder().sliceSettingsBuilder();

final DefaultSliceSettingsLS.Builder ssbLS_ = model_.acquisitions()
.settingsBuilder().sliceSettingsLSBuilder();

final DefaultAcquisitionSettingsDISPIM.Builder asb =
model_.acquisitions().settingsBuilder();

// regular panel
cbxMinimizeSlicePeriod_.registerListener(e -> {
final boolean selected = !cbxMinimizeSlicePeriod_.isSelected();
lblSlicePeriod_.setEnabled(selected);
spnSlicePeriod_.setEnabled(selected);
ssb_.minimizeSlicePeriod(!selected);
model_.acquisitions().settingsBuilder()
.sliceSettingsBuilder().minimizeSlicePeriod(!selected);
//System.out.println("isSlicePeriodMinimized: " + acqSettings.getSliceSettings().isSlicePeriodMinimized());
});

spnSlicePeriod_.registerListener(e -> {
ssb_.slicePeriod(spnSlicePeriod_.getDouble());
model_.acquisitions().settingsBuilder()
.sliceSettingsBuilder().slicePeriod(spnSlicePeriod_.getDouble());
//System.out.println("slicePeriod: " + acqSettings.getSliceSettings().slicePeriod());
});

spnSampleExposure_.registerListener(e -> {
ssb_.sampleExposure(spnSampleExposure_.getDouble());
model_.acquisitions().settingsBuilder()
.sliceSettingsBuilder().sampleExposure(spnSampleExposure_.getDouble());
//System.out.println("sampleExposure: " + acqSettings.getSliceSettings().sampleExposure());
});

// virtual slit panel
spnScanResetTime_.registerListener(e -> {
ssbLS_.scanResetTime(spnScanResetTime_.getDouble());
model_.acquisitions().settingsBuilder()
.sliceSettingsLSBuilder().scanResetTime(spnScanResetTime_.getDouble());
//System.out.println("scanResetTime: " + acqSettings.getSliceSettingsLS().scanResetTime());
});

spnScanSettleTime_.registerListener(e -> {
ssbLS_.scanSettleTime(spnScanSettleTime_.getDouble());
model_.acquisitions().settingsBuilder()
.sliceSettingsLSBuilder().scanSettleTime(spnScanSettleTime_.getDouble());
//System.out.println("scanSettleTime: " + acqSettings.getSliceSettingsLS().scanSettleTime());
});

spnShutterWidth_.registerListener(e -> {
ssbLS_.shutterWidth(spnShutterWidth_.getDouble());
model_.acquisitions().settingsBuilder()
.sliceSettingsLSBuilder().shutterWidth(spnShutterWidth_.getDouble());
//System.out.println("shutterWidth: " + acqSettings.getSliceSettingsLS().shutterWidth());
});

spnShutterSpeed_.registerListener(e -> {
ssbLS_.shutterSpeedFactor(spnShutterSpeed_.getDouble());
model_.acquisitions().settingsBuilder()
.sliceSettingsLSBuilder().shutterSpeedFactor(spnShutterSpeed_.getDouble());
//System.out.println("shutterSpeedFactor: " + acqSettings.getSliceSettingsLS().shutterSpeedFactor());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,30 @@ private void createUserInterface() {
}

private void createEventHandlers() {
final DefaultVolumeSettings.Builder vsb = model_.acquisitions()
.settingsBuilder().volumeSettingsBuilder();

cmbNumViews_.registerListener(e -> {
vsb.numViews(Integer.parseInt(cmbNumViews_.getSelected()));
model_.acquisitions().settingsBuilder().volumeSettingsBuilder()
.numViews(Integer.parseInt(cmbNumViews_.getSelected()));
});

cmbFirstView_.registerListener(e -> {
vsb.firstView(Integer.parseInt(cmbFirstView_.getSelected()));
model_.acquisitions().settingsBuilder().volumeSettingsBuilder()
.firstView(Integer.parseInt(cmbFirstView_.getSelected()));
});

spnViewDelay_.registerListener(e -> {
vsb.delayBeforeView(spnViewDelay_.getDouble());
model_.acquisitions().settingsBuilder().volumeSettingsBuilder()
.delayBeforeView(spnViewDelay_.getDouble());
});

spnSlicesPerSide_.registerListener(e -> {
vsb.slicesPerVolume(spnSlicesPerSide_.getInt());
model_.acquisitions().settingsBuilder().volumeSettingsBuilder()
.slicesPerVolume(spnSlicesPerSide_.getInt());
});

spnSliceStepSize_.registerListener(e -> {
vsb.sliceStepSize(spnSliceStepSize_.getDouble());
model_.acquisitions().settingsBuilder().volumeSettingsBuilder()
.sliceStepSize(spnSliceStepSize_.getDouble());
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,6 @@ public DefaultTimingSettings.Builder getTimingFromPeriodAndLightExposure(Default
delayBeforeLaser = delayBeforeCamera - scanLaserBufferTime; // trigger laser just before camera to make sure it's on already
laserDuration = (totalExposureMax*shutterSpeed) + scanLaserBufferTime; // laser will turn off as exposure is ending
break;
case INTERNAL: // case fall through
default:
studio_.logs().showError("Invalid camera mode");
// FIXME: set to invalid!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ public void setTriggerMode(CameraMode cameraMode) {
//setProperty("LightScanPlus-LineScanSpeed [lines/sec]", String.valueOf(maxLineScanSpeed/shutterSpeed)); // TODO: had to wrap with String.valueOf
//setProperty("LightScanPlus-ExposedPixelHeight", String.valueOf((int)(shutterWidth/pixelSize)));

break;
case INTERNAL:
setProperty(Properties.TRIGGER_MODE, Values.INTERNAL);
// check to see if we need to disable scan speed control
if (getProperty(Properties.SCAN_SPEED_CONTROL_ENABLE).equals(Values.ON)) {
setProperty(Properties.SCAN_SPEED_CONTROL_ENABLE, Values.OFF);
}
break;
case EDGE:
setProperty(Properties.TRIGGER_MODE, Values.EXTERNAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class CameraBase extends DeviceBase implements LightSheetCamera {

public CameraBase(final Studio studio, final String deviceName) {
super(studio, deviceName);
mode_ = CameraMode.INTERNAL;
mode_ = CameraMode.EDGE;
}

// TODO: take binning into account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public HamamatsuCamera(final Studio studio, final String deviceName) {
@Override
public void setTriggerMode(final CameraMode cameraMode) {
mode_ = cameraMode;
setProperty(Properties.TRIGGER_SOURCE, (cameraMode == CameraMode.INTERNAL) ? Values.INTERNAL : Values.EXTERNAL);
//setProperty(Properties.TRIGGER_SOURCE, (cameraMode == CameraMode.INTERNAL) ? Values.INTERNAL : Values.EXTERNAL);
setProperty(Properties.TRIGGER_SOURCE, Values.EXTERNAL);
setProperty(Properties.SENSOR_MODE, (cameraMode == CameraMode.VIRTUAL_SLIT) ? Values.PROGRESSIVE : Values.AREA);
switch (cameraMode) {
case VIRTUAL_SLIT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ public void setTriggerMode(CameraMode cameraMode) {
case LEVEL:
setProperty(Properties.TRIGGER_MODE, Values.LEVEL);
break;
case INTERNAL:
setProperty(Properties.TRIGGER_MODE, Values.INTERNAL);
break;
default:
break;
}
Expand Down

0 comments on commit cf756ba

Please sign in to comment.