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

ROI to label

by stef / Stephane Dallongeville

Convert ROI(s) to labeled image.
This script basically iterate over all the ROIs of the current active image and will paint the content of each ROI into the image with current ROI index.

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: - clear the image before setting the label - fixed image display update
importClass(Packages.icy.sequence.SequenceDataIterator)
importClass(Packages.icy.type.DataIteratorUtil)
importClass(Packages.icy.roi.ROIUtil)

// get current image
seq = getSequence()

// clear the image
dataIterator = new SequenceDataIterator(seq)
DataIteratorUtil.set(dataIterator, 0)

// retrieve ROIs
rois = seq.getROIs()

// for each ROI
for(i = 0; i < rois.size(); i++)
{
	roi = rois.get(i)
	// get data iterator over the ROI region
	dataIterator = new SequenceDataIterator(seq, roi, true)
	// set current ROI index value + 1 as label
        DataIteratorUtil.set(dataIterator, i + 1);
}

// we changed the image (data iterator do not notify sequence about it)
seq.dataChanged()

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.sequence.SequenceDataIterator)
importClass(Packages.icy.type.DataIteratorUtil)
importClass(Packages.icy.roi.ROIUtil)

seq = getSequence()
rois = seq.getROIs()

for(i = 0; i < rois.size(); i++)
{
	roi = rois.get(i)
	dataIterator = new SequenceDataIterator(seq, roi, true)
        DataIteratorUtil.set(dataIterator, i + 1);
}


Icy script publication Id : C9V3G4