Script

Micro-Manager Sequence acquisition with threshold

Publication ID: ICY-D3J7Y1

Short Description

This java script show how to perform a timelaps (20 frames) and Z-Stack acquisition trough Micro-Manager and applying auto K-Means auto threshold on result. WARNING: You need to start Micro-Manager for Icy plugin before executing the script.

Versions

  • Version 1 • Released on: 2017-11-16 12:06:08
    Download
    Description:

    initial version

    importClass(Packages.plugins.adufour.thresholder.KMeans)
    importClass(Packages.plugins.adufour.thresholder.Thresholder)
    importClass(Packages.icy.sequence.Sequence)
    importClass(Packages.plugins.tprovoost.Microscopy.MicroManager.tools.StageMover)
    importClass(Packages.plugins.tprovoost.Microscopy.MicroManager.MicroManager)
    
    sequence = new Sequence()               // create the result sequence
    gui.addSequence(sequence)		// display it
    
    StageMover.moveXYAbsolute(5, 5)         // move microscope to position XY (5, 5)
    
    for(t = 0; t < 20; t++)
    {
    	MicroManager.setExposure(10 + (t * 5))	// set exposure depending T position
    	
    	for(z = 0; z < 10; z++)
    	{
    		StageMover.moveZAbsolute(-5 + z, true)  // set microscope Z position by 10
    		image = MicroManager.snapImage()        // acquire 1 image
    		sequence.setImage(t, z, image)       	// set it in resulting sequence at position 0
    	}
    }
    
    value = KMeans.computeKMeansThresholds(sequence, 0, 2, 256)
    rois = Thresholder.threshold(sequence, 0, value)
    
    for(i = 0; i < rois.length; i++)
    	sequence.addROI(rois[i])
    

Leave a Review