Skip to content
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

Incorporate new acquisition engine #809

Closed
henrypinkard opened this issue May 19, 2020 · 1 comment
Closed

Incorporate new acquisition engine #809

henrypinkard opened this issue May 19, 2020 · 1 comment

Comments

@henrypinkard
Copy link
Member

henrypinkard commented May 19, 2020

The new Java-based acquisition engine (https://github.com/micro-manager/AcqEngJ ) should be able to eventually replace the existing Clojure one, providing additional functionality and making long term maintenance and improvement of the acquisition system easier. Additionally, this would enable better integration of Pycro-Manager, such that arbitrary python code could be injected into the acquisition cycle to synchronize hardware, or used to modify/divert images.

Unfortunately, I don't have the bandwidth to take this on right now, but I'm hoping someone else might take a stab at it.

A first step in this process would be to import use of AcqEngJ into the mmstudio codebase, so that it can be tested side-by-side with the existing engine until it is vetted enough to fully replace it. This will also require additions to AcqEngJ, such as support for autofocus. Right now, AcqEngJ is used in both the Java side of Pycro-Manager and Micro-Magellan. Both these projects use NDViewer as an image viewer and NDTffStorage to save data, but the interfaces are entirely separated, so it should be possible to swap in the alternatives in mmstudio.

Practically this will involve:

  1. Instantiating the new engine. This only needs to happen once.
import org.micromanager.acqj.internal.acqengj.Engine;
Engine engJ = new Engine(core);
  1. Making an object that implements AcqEngJ's DataSink interface. This might need to be an adapted class, or maybe there is an existing mmstudio class that already maps to this easily.

  2. Extending or creating a class that has an instance of org.micromanager.acqj.api.Acquisition. This class takes DataSink as an argument, and must have the initialize() and then start() methods called on it. It's public API and documentation can be found in org.micromanager.acqj.api.AcquisitionInterface

  3. Tell the Acquisition what to acquire by calling submitEventIterator with an argument of an Iterator<org.micromanager.acqj.api.AcquisitionEvent>. Acquisition events correspond to the settings of a single image (i.e. one z slice on one channel). Submitting them as an iterator allows for the engine to do hardware sequencing, where applicable. One advantage of this system is that AcqusitionEvents can be serialized and deserialized using JSON, so acquisition instructions can come from code, a text file, or another programming language (e.g. Pycro-Manager). Convenience functions for doing this over time/z/channels/positions are already implemented (see here and here). Magellan's acquisition's provide a similar example of how to do this.

  4. Finally, finish the acquisition by calling acquisition.finish()

  5. Maybe add a method to the studio API that automatically creates an acquisition with the settings present on the MDA window (if this doesn't already exist), so that external libraries (like Pycro-Manager) can create acquisitions with the MM GUI, but inject its own python-based image processors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants