Skip to content

diSPIM: update the acq eng to match SCAPE's finish() method, fixes some bugs for both engines along the way#428

Merged
bls337 merged 7 commits into
micro-manager:mainfrom
bls337:main
Jul 4, 2026
Merged

diSPIM: update the acq eng to match SCAPE's finish() method, fixes some bugs for both engines along the way#428
bls337 merged 7 commits into
micro-manager:mainfrom
bls337:main

Conversation

@bls337

@bls337 bls337 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Ported finish() lifecycle cleanup from AcquisitionEngineScape to AcquisitionEngineDispim for parity between the two acquisition engines. diSPIM's finish() was previously almost a no-op (just polling restart) — the equivalent cleanup already existed, but was inlined at the tail of run() using local variables that weren't reachable from finish(). Promoted that state to instance fields (controller_, savedExposures_, isShutterOpen_, autoShutter_) and moved the cleanup into finish() so it now runs reliably regardless of how the acquisition ends.

New in diSPIM's finish()

  • Stop any still-running camera sequence acquisitions
  • PLogic/controller cleanup (cleanUpControllerAfterAcquisition, stopSPIMStateMachines)
  • Shutter/autoshutter restore
  • Check for acquisition exceptions
  • Camera trigger-mode reset to INTERNAL + exposure restore
  • unregisterForEvents(this) — diSPIM registered for events on every acquisition run but never unregistered (listener leak); now fixed

Bugs found along the way (fixed in both engines)

  1. NPE risk in PLogic cleanup: SCAPE's finish() called controller_.cleanUpControllerAfterAcquisition(...) with no null check. In demo mode, controller_ is never instantiated even when "use PLogic" is enabled in settings — so finish() would NPE right there and silently skip everything after it (shutter restore, exception check, camera reset). Fixed by guarding with controller_ != null in both engines.
  2. NPE risk in exposure restore: savedExposures_ had no initial value in either engine, only getting populated near the top of run(). If run() threw before reaching that point, finish() would still execute (via the outer finally) and NPE on `save

@bls337 bls337 merged commit 95a85af into micro-manager:main Jul 4, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant