Converting a list of ROIs to a binary mask in a script.

86 views
Skip to first unread message

Jean-Yves Tinevez

unread,
Apr 26, 2017, 12:02:20 PM4/26/17
to Icy imaging
Hi all,

We are trying to generate a bunch of binary masks as output of a segmentation process in a script.

For many plugins of Icy I can get a list of ROIs as results. Unfortunately the output format imposed is a label image. 

How can I generate a B&W image from a list of ROIs in a script? 
Then, how to call the labeller from a B&W image so that it generates a label image instead of a list of ROIs, again in a script? 

Thanks!
jy

Stephane

unread,
Apr 26, 2017, 12:39:51 PM4/26/17
to Icy imaging
Hi,

Definitely Icy prefers ROI over binary image and some plugins only export in ROI then.
Still you can convert your ROIs to a sequence with the "ROI to Sequence" block (protocols).
For the script you will need to create an empty Sequence with the desired dimension then use this piece of code (java but close to javascript) :

for (ROI roi : rois)
     
DataIteratorUtil.set(new SequenceDataIterator(sequence, roi, true), 0xFF);


I hope that helps,

- Stephane
Reply all
Reply to author
Forward
0 new messages