Scripted acquisitions using multi-camera?

Hi All,

Does anyone have a working script we could use an example that sets up a sequence acquisition using multiple cameras or images acquired using the multi-camera utility?

Thank you!

Hi Pavak,

Here’s a quick and dirty example using the multi-camera utility:

import mmcorej.TaggedImage;
import java.util.ArrayList;


// Acquisition name and location
acqName = "test-acq-col";
rootDirName = "D:/Temporary Data Storage";

// Camera labels
label = "Multi Camera";

ArrayList cameras = new ArrayList();
cameras.add("Camera 1");
cameras.add("Camera 2");

camTag = label + "-CameraChannelName";
indexTag = "ImageNumber";

// Parameters
nFrames = 10;
interval = 0;
nChannels = 2;
nSlices = 1;

// Set the memory correctly

// The actual stuff
gui.openAcquisition(acqName, rootDirName, nFrames, 2, 1, 1, true, true);

gui.setChannelColor(acqName, 0, java.awt.Color.GREEN);
gui.setChannelColor(acqName, 1, java.awt.Color.RED);

nImages = nFrames*2; // 2 cameras, 2x nFrames
mmc.startSequenceAcquisition(label, nImages, interval, true);

for (int f=0; f<nImages; f++) {
	boolean gotFrame = false;

	do {
		if (mmc.getBufferTotalCapacity() - mmc.getBufferFreeCapacity() != 0) {
			TaggedImage img = mmc.popNextTaggedImage();
			int cam = cameras.indexOf(img.tags.get(camTag));
			int index = img.tags.getInt(indexTag);
			gui.addImageToAcquisition(acqName, index, cam, 0, 0, img);
			gotFrame = true;
	} while (!gotFrame);

Hi Pedro,

This is my first foray into working with tagged images, so your example is extremely helpful!

Thank you!

Glad to help! I edited the script slightly now so the data is saved to disk by the way, I had missed that.

Thanks @palmada for posting this script! Just for future reference, this script is for Micro-Manager 1.4, and will not work in 2.0.

Thanks for clarifying that Nico, would you be able to point to examples, documentation, or pieces of the API where I can learn how to do something similar in 2.0?

Have a look at:

There are more 2.0 example scripts here:

An overview of the 2.0 api is here:, and a “translation” guide is here:

It would be great if you could try to “translate” the script by @palmada and list it back here. I’ll be happy to add it to the source code repository. Do not hesitate to ask here if you get stuck with anything.

Has anyone figured this out? I am working a script based on @palmada but I am having issues to show the images into the display especially when trying to assign the frames to specific cameras. I tried:

tagged = mmc.popNextTaggedImage();
frame = tagged.tags.getString(“Frame”); //FrameIndex
image =,,null);

but the tagged Image shows 0 when printing the values for several frames even though I see the sequence buffer filling up.