micro-manager / mmCoreAndDevices

Micro-Manager's device control layer, written in C++
41 stars 109 forks source link

Deprecate the "default" sequence acquisition implementation in CCameraBase #421

Open marktsuchida opened 10 months ago

marktsuchida commented 10 months ago

In MMDevice's camera interface, a sequence acquisition is when the camera hardware is set up to acquire multiple frames without software control for each frame; it should be different from performing a series of snap acquisitions. (In fact, a snap probably should have just been a special case of sequence acquisition, with length 1, but I digress.)

Unfortunately, MMDevice's camera device base class CCameraBase (in DeviceBase.h) contains "default" implementations of StartSequenceAcquisition(), StopSequenceAcquisition(), and IsCapturing() that use a thread (BaseSequenceThread* thd_) to call SnapImage() in a loop. This is never a good idea -- cameras that truly only support snaps are rare, and even in that case, it would make much more sense to work around it at a higher level, such as in MMCore.

Most of our well-supported and widely used cameras do not use this problematic default implementation, instead providing their own proper sequence acquisition. However, some cameras do use it, and there might be some that partially use the associated functions in a convoluted way. It is also highly confusing to new developers of camera device adapters.

It would be nice if we could remove the problematic implementation or somehow mark it deprecated (in a way that would warn at compile time), but this is not possible because what we need to enforce is that cameras do override these functions. In addition, some cameras use a few functions that are part of the problematic implementation even though they do not use the BaseSequenceThread.

So I propose that we do the following:

Note that none of these changes require bumping the device interface version, since they do not affect the binary interface of the DLLs.

henrypinkard commented 10 months ago

Sound great to me! Seems low risk, and it would steer developers of new camera devices in the right direction in the future