Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only add valid acq modes when loading #286

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading