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 @@ -14,7 +14,7 @@ public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin {
public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2026";
public static final String description = "A plugin to control various types of light sheet microscopes.";
public static final String menuName = "Light Sheet Manager";
public static final String version = "0.7.3";
public static final String version = "0.7.4";

private Studio studio_;
private LightSheetManager model_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public abstract class AcquisitionEngine implements AcquisitionManager, MMAcquist
private final ExecutorService acquisitionExecutor_ = Executors.newSingleThreadExecutor(
r -> new Thread(r, "Acquisition Thread"));
protected volatile Acquisition currentAcquisition_ = null; // TODO: consider making a getter rather than protected?
// true once setup() succeeds and run() is about to begin; the end-of-run save only runs when this is true
protected boolean acquisitionStarted_ = false;

private final AutofocusAdapter autofocus_;

Expand Down Expand Up @@ -158,8 +156,6 @@ public Future<?> requestRun(boolean speedTest) {
studio_.logs().showError(e, "Error during acquisition setup");
return; // early exit => stop acquisition
}
// setup succeeded and we are about to run; end-of-run work (the save) is now valid
acquisitionStarted_ = true;
run(); // run the acquisition and block until complete
} catch (Exception e) {
studio_.logs().showError(e);
Expand All @@ -172,10 +168,9 @@ public Future<?> requestRun(boolean speedTest) {
// must ALWAYS run: if currentAcquisition_ is left set, every future
// acquisition is rejected until the plugin restarts
currentAcquisition_ = null;
// free the datastore at acq end so a large store isn't kept in memory; matches MM's AcqEngJAdapter.onAcquisitionEnded
// free the datastore so a large store isn't kept in memory (matches MM's
// AcqEngJAdapter.onAcquisitionEnded); also what the save guard checks to skip aborted/empty runs
datastore_ = null;
// reset for the next run; must be here (always runs), not in finish() which can throw
acquisitionStarted_ = false;
// LSM-ACQ-STOP in the innermost finally: fires on completion, error, abort, throwing finish()
if (runId != -1) {
final long elapsedMs = (System.nanoTime() - startNs) / 1_000_000L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ void finish() {

// TODO: execute any end-acquisition runnables

// don't save if the run never started or produced no images
if (acquisitionStarted_ && acqSettings_.isSavingImagesDuringAcquisition()
&& datastore_.getNumImages() > 0) {
// save only if this run created a store with images
if (acqSettings_.isSavingImagesDuringAcquisition()
&& datastore_ != null && datastore_.getNumImages() > 0) {
final String savePath = FileUtils.createUniquePath(
acqSettings_.saveDirectory(), acqSettings_.saveNamePrefix());
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ void finish() {

// TODO: execute any end-acquisition runnables

// don't save if the run never started or produced no images
if (acquisitionStarted_ && acqSettings_.isSavingImagesDuringAcquisition()
&& datastore_.getNumImages() > 0) {
// save only if this run created a store with images
if (acqSettings_.isSavingImagesDuringAcquisition()
&& datastore_ != null && datastore_.getNumImages() > 0) {
final String savePath = FileUtils.createUniquePath(
acqSettings_.saveDirectory(), acqSettings_.saveNamePrefix());
try {
Expand Down
Loading