Script

Micro-Manager continous acquisition on crops

Publication ID: ICY-E4Q6U8

Short Description

This script take ROI(s) from an input image and create cropped image(s) from it / them then continuously acquire and update crops.

Versions

  • Version 1 • Released on: 2018-03-19 19:15:15
    Download
    Description:

    initial version

    importClass(Packages.icy.sequence.Sequence)
    importClass(Packages.icy.image.IcyBufferedImage)
    importClass(Packages.icy.image.IcyBufferedImageUtil)
    importClass(Packages.plugins.tprovoost.Microscopy.MicroManager.MicroManager)
    
    // get acquired image containing ROIs
    acquiredSeq = getSequence()
    // get image type
    dataType = acquiredSeq.getDataType_()
    // get rois
    rois = acquiredSeq.getROIs()
    
    cropImages = []
    
    // create result image
    for(r = 0; r < rois.size(); r++)
    {
    	roi = rois.get(r)
    	bnd = roi.getBounds5D()
    	img = new IcyBufferedImage(bnd.getSizeX(), bnd.getSizeY(), 1, dataType)
    
    	// store image
    	cropImages[r] = img
    
    	// create sequence
    	s = new Sequence(img)
    	// change sequence name
    	s.setName("image" + r + " - " + roi.getName())
    	// show it
    	gui.addSequence(s)
    }
    
    
    while(true)
    {
    	// snap image
    	newImage = MicroManager.snapImage()
    
    	for(r = 0; r < rois.size(); r++)
    	{
    		roi = rois.get(r)
    		bnd = roi.getBounds5D().toRectangle2D().getBounds()
    		
    		img = cropImages[r]
    		img.copyData(newImage, bnd, null)
    	}
    
    	// do processig here on cropped images
    }

Leave a Review