Skip to content

Automatically clear circular buffer in continuous sequence acquisition#588

Merged
marktsuchida merged 7 commits intomicro-manager:mainfrom
henrypinkard:circ_buff_overwrite
Aug 15, 2025
Merged

Automatically clear circular buffer in continuous sequence acquisition#588
marktsuchida merged 7 commits intomicro-manager:mainfrom
henrypinkard:circ_buff_overwrite

Conversation

@henrypinkard
Copy link
Copy Markdown
Contributor

This adds an overwrite mode to the circular buffer, which means that when an image is inserted and there's no more space, it will automatically clear itself. Currently, most cameras do this manually when there is an error on insert.

This is motivated by the need to deprecate the ability of devices to clear and allocate the buffer in the core. This should instead be done by higher level application code.

One thing I don't fully understand is the stopOnOverflow argument of startSequenceAcquisition. Some, but not all, cameras appear to have logic that changes behavior based on this flag, but I'm not aware of any higher level code that ever sets this to false when running a finite sequence of N frames.

Regardless, stopOnOverflow shouldn't be an issue for merging this, because the only time we set overwrite=true is when calling startContinuousSequenceAcquisition, where stopOnOverflow is always false

@henrypinkard henrypinkard mentioned this pull request Mar 4, 2025
3 tasks
Copy link
Copy Markdown
Member

@marktsuchida marktsuchida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @henrypinkard. It's so much easier to confidently review a narrowly targeted PR like this!

@henrypinkard
Copy link
Copy Markdown
Contributor Author

@marktsuchida ready to merge?

This function needs to acquire g_bufferLock to be correct, but since it
is not used, just delete it until the need arises.
These are the device adapters that use the newly deprecated
ClearImageBuffer() function but have MSVC's SDL (Security Development
Lifecycle) checks enabled, which turn C4996 (deprecation warning) into
an error.

AlliedVisionCamera
DahengGalaxy
IDSPeak
Lumenera
PlayerOne
PyDevice
QSI
SequenceTester
SigmaKoki
SpinnakerCamera
ZWO

Disabling SDL checks temporarily; after updating to remove the use of
the deprecated function, SDL checks should be re-enabled.
@marktsuchida
Copy link
Copy Markdown
Member

marktsuchida commented May 16, 2025

Code-wise, this is ready to merge, but let's wait a bit for a day on which other major changes are not going into the nightly build (we upgraded to Java 11 today).

  • Bump MMCore minor version
  • Bump MMDevice interface version

The device interface version needs to be bumped, despite the apparent lack of change, because there is a behavioral change: camera adapters written assuming this change will fail Live when the buffer fills up if run with an older Core. We may want to coordinate this version increment with #640 and the actual removal of ClearImageBuffer().

@marktsuchida marktsuchida merged commit 4298518 into micro-manager:main Aug 15, 2025
4 checks passed
marktsuchida added a commit to marktsuchida/mmCoreAndDevices that referenced this pull request Aug 15, 2025
Clearing the Core sequence buffer on the camera device side is no longer
necessary after micro-manager#588.

Remove all such code from cameras.

No attempt is made here to fix missing error handling (of which there
are quite a few).

Also removes a few places where ClearImageBuffer() was being called upon
stopping acquisition, which should be unnecessary if not wrong.
marktsuchida added a commit to marktsuchida/mmCoreAndDevices that referenced this pull request Aug 15, 2025
This function should not be necessary after micro-manager#588.
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.

2 participants