Skip to content

Commit

Permalink
Merge pull request #286 from bls337/main
Browse files Browse the repository at this point in the history
only add valid acq modes when loading
  • Loading branch information
bls337 authored May 7, 2024
2 parents c061977 + a071498 commit 0515c9b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.micromanager.lightsheetmanager.api.data;

import java.util.ArrayList;
import java.util.Arrays;

// TODO: account for different naming on each geometry type (SLICE_SCAN_ONLY)
Expand Down Expand Up @@ -39,12 +40,21 @@ public static String[] toArray() {
.toArray(String[]::new);
}

// TODO: check if stage scanning exists
public static String[] getValidKeys() {
final AcquisitionMode[] keys = new AcquisitionMode[] {
NO_SCAN, STAGE_SCAN, SLICE_SCAN_ONLY, PIEZO_SCAN_ONLY
};
return Arrays.stream(keys)
/**
* Returns an array of valid acquisition modes as strings.
*
* @param isStageScanning {@code true} if stage scanning
* @return an array of strings
*/
public static String[] getValidKeys(final boolean isStageScanning) {
final ArrayList<AcquisitionMode> keys = new ArrayList<>();
keys.add(NO_SCAN);
if (isStageScanning) {
keys.add(STAGE_SCAN);
}
keys.add(SLICE_SCAN_ONLY);
keys.add(PIEZO_SCAN_ONLY);
return keys.stream()
.map(AcquisitionMode::toString)
.toArray(String[]::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ private void createUserInterface() {
pnlChannelTable_.setItemsEnabled(false);
}

cmbAcquisitionModes_ = new ComboBox(AcquisitionMode.getValidKeys(),
// acquisition mode combo box
final boolean isUsingScanSettings = model_.devices().isUsingStageScanning();
cmbAcquisitionModes_ = new ComboBox(AcquisitionMode.getValidKeys(isUsingScanSettings),
acqSettings.acquisitionMode().toString(),
180, 24);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ private void createUserInterface() {

// check for devices to set up the tab
isUsingPLogic_ = model_.devices().isUsingPLogic();
if (isUsingPLogic_) {
final ASIXYStage xyStage = model_.devices().getDevice("SampleXY");
if (xyStage != null) {
isUsingScanSettings_ = xyStage.hasProperty(ASIXYStage.Properties.SCAN_NUM_LINES);
} else {
isUsingScanSettings_ = false;
}
}
isUsingScanSettings_ = model_.devices().isUsingStageScanning();

final Panel pnlScanSettings = new Panel("Stage Scan Settings");
pnlScanSettings.setMigLayout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,8 @@ public boolean hasDeviceAdapter() {

// check for ASI hardware triggering device
public boolean isUsingPLogic() {
// make sure that we have devices set
if (deviceMap_.get("TriggerLaser") == null && deviceMap_.get("TriggerCamera") == null) {
return false;
return false; // early exit => devices not set
}
// check if both device names contain "PLogic"
boolean result = false;
Expand All @@ -338,6 +337,15 @@ public boolean isUsingPLogic() {
return result;
}

// check for ASI stage scanning
public boolean isUsingStageScanning() {
if (deviceMap_.get("SampleXY") == null) {
return false; // early exit => device not set
}
return deviceMap_.get("SampleXY")
.hasProperty(ASIXYStage.Properties.SCAN_NUM_LINES);
}

/**
* Creates a configuration group named "System" that includes all device properties
* the Light Sheet Manager device adapter.
Expand Down

0 comments on commit 0515c9b

Please sign in to comment.