Script

Example loop roi and excel

Publication ID: ICY-X9V7M6

Short Description

Simple example using loop roi and excel output

Versions

  • Version 1 • Released on: 2014-05-06 16:38:21
    Download
    Description:

    initial version

    importClass(Packages.icy.util.XLSUtil)
    importClass(Packages.icy.roi.ROIUtil)
    importClass(Packages.icy.roi.ROI2DRectangle)
    importClass(java.awt.Color)
    importClass(Packages.java.io.File)
    
    // This script is a simple example using loops, ROIs, and excel output.
    seq = getSequence()
    
    seq.removeAllROI()
    
    size = 30
    
    workbook = XLSUtil.createWorkbook( new File( seq.getFilename()+".xls" ) )
    page = XLSUtil.createNewPage(workbook, "resultat")
    
    for ( y = 0 ; y < seq.getHeight() ; y = y + size )
    {
    	for ( x = 0 ; x < seq.getWidth() ; x = x + size )
    	{
    		// (x,y) coin haut gauche et ( x,y) coin bas droite
    		roi = new ROI2DRectangle( x , y , x+size , y+size )
    		seq.addROI( roi )
    		mean = ROIUtil.getMeanIntensity( seq , roi)
    		roi.setName( "moy " +mean )
    
    		XLSUtil.setCellNumber( page, x/size, y/size, mean )
    
    		if ( mean < 10 )
    		{
    			roi.setColor( Color.RED )
    		}
    		
    	}
    }
    
    XLSUtil.saveAndClose( workbook )
    

Leave a Review