-
Notifications
You must be signed in to change notification settings - Fork 111
Allow camera device adapters to call InsertImage
on snap
#592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I'm afraid this doesn't consdier how timing works for Snap/GetImage. That is not the nicest API design for multiple reasons, and (as you know) I also believe that in the long run we shouldn't have a separate mechanism for snap (it should just be a single-frame acquisition), but we cannot just lose the ability to perform snaps using the existing API with good timing characteristics -- we need a way to detect the end of exposure and return from It might be possible to offer the option to cameras of returning from Another idea would be for MMCore to call But my recommendation would be for the current device snap API to remain a legacy feature with minimal (if any) changes to behavior. The new camera API could simply leave out a separate snap function. MMCore can then implement |
I'm aware of the intended design. In practice, many camera adapters perform image buffer copying within Instead using
This would actually allow the shutter to close faster than their existing implementations. For camera adapters that actually do what the API intends, yes you're right, the current GetImage mechanism does close the shutter faster. So that argues for not deprecating it, at least until the new camera API is merged. Regardless, we need a mechanism like this so that new camera API can be backwards compatible with
Which do you prefer? |
Do you mean for new-style cameras to work with old-style apps, or the other way around? In either case, I don't think we would want to require existing cameras to be modified in order to achieve compatibility, if that is what you mean. Modifying the Snap behavior like this would be too risky to do without testing each camera, which is not feasible. But we don't want the old API to be permanently required for un-updated cameras. I think it should be possible (if not easy) to bridge between the old and new APIs so that the compatibility works both ways without modification, and I'm happy to put some work into getting that working. It may require things like spawning a thread in MMCore, perhaps. But let's leave this PR open until I (or anybody) has a good alternative. |
[Update after chatting with @henrypinkard] The main goal for this PR is to enable new-style cameras (#593) to work with old-style Keeping it open for now but may close if it seems sufficient to merge as part of #593 (which branches off this PR already). |
(Part of changes needed for the new camera API but should also work with existing camera API. Broken into its own PR for easier review.)
This PR allows camera device adapters, rather than having to maintain their own internal buffer for when
SnapImage()
is called, to instead simply callInsertImage
(or for multi-channel cameras, call it once for each channel). TheCoreCallback
then determines whether the inserted data should be routed to the circular buffer or to an internal buffer maintained in the camera device instance in the core. Higher level code callingGetImage
should not see any difference in behavior.This will simplify writing device adapters for both old and new camera APIs, and it has the potential to improve performance, because copying of the snap buffer can use to multi-threaded copying code like in the circular buffer (in a future PR).
It might be a good addition to deprecate
GetImageBuffer
in the current camera api and make callingInsertImage
the preferred approach.