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

ROI mean intensity evolution over time

by stef / Stephane Dallongeville

Export the min / mean / max intensity of the selected ROI of active sequence over time in an excel file.
The excel file use the same filename as the image file except it has ".xls" extension.

version 2 (last version):

download to use and modify in Icy. How do I use scripts ? A Problem ? ask the community.
Changelog for this version: Added min / max intensity information.
importClass(Packages.icy.file.FileUtil)
importClass(Packages.icy.util.XLSUtil)
importClass(Packages.icy.roi.ROIUtil)

sequence = getSequence()

if (sequence != null)
{
	roi = sequence.getSelectedROI()

	if (roi != null)
	{
		// create new excel file
		xls = XLSUtil.createWorkbook(FileUtil.setExtension(sequence.getFilename(), ".xls"))
		// create a new page
		xlsPage = XLSUtil.createNewPage(xls, roi.getName())

		// write header
		XLSUtil.setCellString(xlsPage, 0, 0, "T position")
		XLSUtil.setCellString(xlsPage, 2, 0, "Min intensity")
		XLSUtil.setCellString(xlsPage, 3, 0, "Mean intensity")
		XLSUtil.setCellString(xlsPage, 4, 0, "Max intensity")
		
		for(t = 0; t < sequence.getSizeT(); t++)
		{
			// compute intensities for this frame
			min = ROIUtil.getMinIntensity(sequence, roi, -1, t, -1)
			mean = ROIUtil.getMeanIntensity(sequence, roi, -1, t, -1)
			max = ROIUtil.getMaxIntensity(sequence, roi, -1, t, -1)
			
			// write value
			XLSUtil.setCellNumber(xlsPage, 0, t + 2, t)
			XLSUtil.setCellNumber(xlsPage, 2, t + 2, min)
			XLSUtil.setCellNumber(xlsPage, 3, t + 2, mean)
			XLSUtil.setCellNumber(xlsPage, 4, t + 2, max)
		}

		// save excel file
		XLSUtil.saveAndClose(xls)
	}
}

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


Previous versions:


version 1:

download to use and modify in Icy.
Changelog for this version: initial version
importClass(Packages.icy.file.FileUtil)
importClass(Packages.icy.util.XLSUtil)
importClass(Packages.icy.roi.ROIUtil)

sequence = getSequence()

if (sequence != null)
{
	roi = sequence.getSelectedROI()

	if (roi != null)
	{
		// create new excel file
		xls = XLSUtil.createWorkbook(FileUtil.setExtension(sequence.getFilename(), ".xls"))
		// create a new page
		xlsPage = XLSUtil.createNewPage(xls, roi.getName())

		// write header
		XLSUtil.setCellString(xlsPage, 0, 0, "T position")
		XLSUtil.setCellString(xlsPage, 1, 0, "Mean intensity")
		
		for(t = 0; t < sequence.getSizeT(); t++)
		{
			// compute mean intensity for this frame
			d = ROIUtil.getMeanIntensity(sequence, roi, -1, t, -1)
			
			// write value
			XLSUtil.setCellNumber(xlsPage, 0, t + 2, t)
			XLSUtil.setCellNumber(xlsPage, 1, t + 2, d)
		}

		// save excel file
		XLSUtil.saveAndClose(xls)
	}
}


Icy script publication Id : R1V1T5