Created
December 9, 2014 23:17
-
-
Save omsai/c77f8e4302b51b16ffd6 to your computer and use it in GitHub Desktop.
Micro-Manager script to uploading image sequence to Andor Mosaic3 using core API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Upload image from stack to SLM before each frame in MDA. | |
// | |
// We have to use the core API to upload each frame individually, | |
// since there is no public sequencing API for SLM devices. | |
// | |
// Pariksheet Nanda <[email protected]> July 2014 | |
// | |
// License: Public Domain | |
import ij.io.Opener; // To load TIFF stack file from disk. | |
import ij.ImagePlus; // To hold the opened image. | |
import ij.ImageStack; // To access stack pixels. | |
// Load file from disk. | |
Opener opener = new Opener(); | |
ImagePlus imp = opener.openImage("C:/Users/Andor/Downloads/speckle.tif"); | |
// Get stack info. | |
ImageStack stack = imp.getImageStack(); | |
slices = stack.getSize(); | |
// Set MDA to acquire the number of slices. | |
seqSettings = gui.getAcquisitionSettings(); | |
seqSettings.numFrames = slices; | |
gui.setAcquisitionSettings(seqSettings); | |
// Get the installed name of the SLM. | |
mosaic = mmc.getSLMDevice(); | |
// Boilerplate when using runnables. | |
gui.clearRunnables(); | |
// Runnable to upload each image to the SLM. | |
runnable = new Runnable() { | |
int slice = 1; | |
public void run() { | |
// Get the pixels of the stack slice. | |
pixels = stack.getPixels(slice); | |
// Upload the image to the SLM. | |
mmc.setSLMImage(mosaic, pixels); | |
// Activate the uploaded image on the SLM. | |
mmc.displaySLMImage(mosaic); | |
print("Activated slice " + slice); | |
slice++; | |
} | |
}; | |
// Dimension order is frame, position, channel, slice. | |
gui.attachRunnable(-1, -1, -1, -1, runnable); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment