Script

Convert ROI to Detection and export to swimming pool

Publication ID: ICY-D3E4N2

Short Description

This script converts the ROIs of the active Sequence in a set of detection (DetectionResults) and export it in the swimming pool so it can be used by the Spot Tracking plugin.

Versions

  • Version 1 • Released on: 2015-03-13 11:31:33
    Download
    Description:

    initial version

    importClass(Packages.icy.type.point.Point5D)
    importClass(Packages.icy.swimmingPool.SwimmingObject)
    importClass(Packages.icy.roi.ROI)
    importClass(Packages.plugins.nchenouard.spot.DetectionResult)
    importClass(Packages.plugins.nchenouard.spot.Spot)
    
    seq = getSequence()
    
    if (seq != null)
    {
        dr = new DetectionResult()
        rois = seq.getROIs()
        
        for (i = 0; i < rois.size(); i++)
        {
        	roi = rois.get(i)
            pos = roi.getPosition5D()
            t = pos.getT()
            z = pos.getZ()
    
            if ((t < 0) || (t >= seq.getSizeT()))
                t = 0;
            if ((z < 0) || (z >= seq.getSizeZ()))
                z = 0;
    
    	spot = new Spot(pos.getX(), pos.getY(), z)
            dr.addDetection(t, spot)
        }
    
        obj = new SwimmingObject(dr, "Detection results")
        gui.getSwimmingPool().add(obj)
    }

Leave a Review