Need help or advice ? Come to the Icy club ! - Every Wenesday morning from 9h30 to 12h30 - Francois Jacob Building - Main hall - Pasteur
Register

Example loop roi and excel

by fab / Fabrice de Chaumont

Simple example using loop roi and excel output

version 1 (last version):

download to use and modify in Icy. How do I use scripts ? A Problem ? ask the community.
Changelog for this version: 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 )

This script has no documentation. A Problem ? ask the community.



Icy script publication Id : X9V7M6