Skip to content
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
Expand Up @@ -136,7 +136,7 @@ public boolean equals(Object obj) {
showGraph == other.showGraph &&
mode == other.mode &&
scoringMethod == other.scoringMethod &&
channel.equals(other.channel);
Objects.equals(channel, other.channel);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public boolean equals(Object obj) {
}
DefaultChannelSettings other = (DefaultChannelSettings) obj;
return enabled == other.enabled
&& group.equals(other.group)
&& Objects.equals(group, other.group)
&& mode == other.mode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ public boolean equals(Object obj) {
}
DispimAcquisitionSettings other = (DispimAcquisitionSettings) obj;
return Objects.equals(channels(), other.channels()) &&
Objects.equals(autofocus(), other.autofocus()) &&
Objects.equals(timing, other.timing) &&
Objects.equals(volume(), other.volume()) &&
Objects.equals(slice, other.slice) &&
Objects.equals(sliceLS, other.sliceLS) &&
Objects.equals(stageScan, other.stageScan) &&
// Objects.equals(sheetCalibration_, other.sheetCalibration_) &&
// Objects.equals(sliceCalibration_, other.sliceCalibration_) &&
Arrays.equals(sheetCalibrations, other.sheetCalibrations) &&
Arrays.equals(sliceCalibrations, other.sliceCalibrations) &&
acquisitionMode() == other.acquisitionMode() &&
cameraMode() == other.cameraMode() &&
Arrays.equals(imagingCameraOrder(), other.imagingCameraOrder()) &&
Expand All @@ -137,13 +138,14 @@ public boolean equals(Object obj) {
public int hashCode() {
return Objects.hash(
channels(),
autofocus(),
timing,
volume(),
slice,
sliceLS,
stageScan,
// sheetCalibration_,
// sliceCalibration_,
Arrays.hashCode(sheetCalibrations),
Arrays.hashCode(sliceCalibrations),
acquisitionMode(),
cameraMode(),
Arrays.hashCode(imagingCameraOrder()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public boolean equals(Object obj) {
}
ScapeAcquisitionSettings other = (ScapeAcquisitionSettings) obj;
return Objects.equals(channels(), other.channels()) &&
Objects.equals(autofocus(), other.autofocus()) &&
Objects.equals(timing, other.timing) &&
Objects.equals(volume(), other.volume()) &&
Objects.equals(slice, other.slice) &&
Expand All @@ -128,6 +129,7 @@ public boolean equals(Object obj) {
public int hashCode() {
return Objects.hash(
channels(),
autofocus(),
timing,
volume(),
slice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,11 @@ public double computeScanSpeed(final ScapeAcquisitionSettings settings) {
return settings.volume().sliceStepSize() * speedFactor / sliceDurationMs / channelsPerPass;
}

// compute how many channels we do in each one-way scan
// compute how many channels we do in each one-way scan, at least 1 so the speed and the scan
// line count never divide by 0 when channels are enabled but none is used
private int computeScanChannelsPerPass(ScapeAcquisitionSettings settings) {
return settings.channels().mode() == ChannelMode.SLICE_HW ? settings.channels().count() : 1;
return settings.channels().mode() == ChannelMode.SLICE_HW
? Math.max(1, settings.channels().count()) : 1;
}

/**
Expand Down Expand Up @@ -471,10 +473,6 @@ public boolean prepareControllerForAcquisitionSide(
piezoCenter += settings.volume().sliceStepSize() / 2;
}

// HACK(Brandon): used this to get a single camera to work with 2 simultaneous cameras
// increase number of trigger pulses for multiple simultaneous cameras
// numSlicesHW *= model_.devices().getDeviceAdapter().getNumSimultaneousCameras();

// FIXME: more light sheet setup
//final double slope1 = settings.sliceCalibration(1).sliceSlope();
//final double slope2 = settings.sliceCalibration(2).sliceSlope();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ boolean setup() {
}

// checked here so demo and NIDAQ runs, which skip doHardwareCalculations, refuse too
if (acqSettings_.channels().enabled() && acqSettings_.channels().count() == 0) {
if (channelsEnabledButNoneUsed()) {
model_.logging().reportError("\"Channels\" is checked, but no channels are selected");
return false;
}
Expand Down Expand Up @@ -1561,10 +1561,6 @@ private boolean doHardwareCalculations(PLogicScape plc) {
return false; // early exit
}
}
// // TODO: add code to check if cameras are active
// if (model_.devices().getDeviceAdapter().getNumSimultaneousCameras() > 1) {
// nrSlicesSoftware *= 2;
// }

// 1.4 adjusts nrSlicesSoftware at this point when hardware timepoints are in use: one
// controller trigger covers every timepoint, so the camera sequence has to be sized for
Expand Down Expand Up @@ -2145,7 +2141,19 @@ private void updateSlicePeriodLabel(final JLabel label) {
label.setText(NumberUtils.doubleToDisplayString(acqSettings_.timing().sliceDurationMs()) + " ms");
}

/**
* Returns true when channels are enabled but none is used. The run refuses that setup, so
* the volume and total duration labels show a dash instead of an estimate.
*/
private boolean channelsEnabledButNoneUsed() {
return acqSettings_.channels().enabled() && acqSettings_.channels().count() == 0;
}

private void updateVolumeDurationLabel(final JLabel label) {
if (channelsEnabledButNoneUsed()) {
label.setText("-");
return;
}
final double duration = computeVolumeDuration();
if (duration > 1000) {
// round to ms
Expand All @@ -2162,6 +2170,10 @@ private void updateVolumeDurationLabel(final JLabel label) {
* Update the displayed total time duration.
*/
private void updateTotalTimeDurationLabel(final JLabel label) {
if (channelsEnabledButNoneUsed()) {
label.setText("-");
return;
}
final double duration = computeTotalTimeDuration();
if (duration < 60) { // less than 1 min
label.setText(NumberUtils.doubleToDisplayString(duration) + " s");
Expand Down
Loading