Short Description

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.

Versions

  • Version 2 • Released on: 2018-07-19 16:02:56
    Download
    Description:

    - 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()
  • Version 1 • Released on: 2018-07-19 15:56:28
    Download
    Description:

    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);
    }
    

Leave a Review