Stream mode acquisition and metadata


Some time ago one of my problem got solved by using the core streaming mode to acquire images. However, my former colleagues only had use for it recently and realised that the metadata are mostly empty (or non-populated), compared to the acqManager.runAcquisitionWithSettings type of acquisition.

The reason is that (beyond me forgetting to plug in the metadata at first), I built the metadata as follows:

core.startSequenceAcquisition(frames, interval, true);
Metadata.Builder metadata =;
TaggedImage tagged = core.popNextTaggedImage();
Image image =,,;

Now, the only ways I figured out how to get a metadata.txt closer to what I would get using runAcquisitionWithSettings is by doing this very hacky and not pretty thing:

TaggedImage tagged = core.popNextTaggedImage();

// create image without metadata
Image imageNoMetadata =,, null)

// generate metadata using the acquisition manager
Metadata metadata = acqManager.generateMetadata(imageNoMetadata, true);

// convert again the tagged image, this time with metadata
Image image =,, metadata);

or simply building the metadata from scratch (example here adapted from acqManager.generateMetadata).

Is there a more elegant way that I missed?

Thanks in advance!

You could do:

TaggedImage tagged = core.popNextTaggedImage();
Image image =;

Ah very nice, thanks! Funnily, this places all the devices properties in “User Data” with a type (String, Integer…), which is different from the MDA and the other “dirtier” approach (Key:Value at the higher JSON level).

Another question, I now realised that the SummaryMetada (DefaultSummaryMetada) does not contain entries such as “Frames” or “Slices” unless the intended dimensions are defined. Are those added by the clojure acquisition engine? I did not find anything in the Java code (but I might be blind).

And the same question as before, if I want to have these entries in the metadata, do I need to manually build them?

Right now, the only thing I can think of is something along those lines:

SummaryMetadata defaultSM = studio.acquisitions().generateSummaryMetadata();
SummaryMetadata.Builder b = defaultSM.copyBuilder();
Coords c = defaultSM.getIntendedDimensions();

but again very hacky…