<protocol VERSION="4">
<blocks>
<block ID="1366881243" blockType="plugins.adufour.blocks.tools.roi.GetROIFromSequence" className="plugins.adufour.blocks.tools.roi.GetROIFromSequence" collapsed="false" definedName="Get ROI from sequence" height="105" keepsResults="true" width="247" xLocation="35" yLocation="368">
<variables>
<input>
<variable ID="input sequence" name="Source" runtime="false" visible="true"/>
<variable ID="selection state of ROI to extract" name="ROI to get" runtime="false" value="ALL" visible="true"/>
</input>
<output>
<variable ID="extracted rois" name="List of ROI" runtime="false" visible="true"/>
</output>
</variables>
</block>
<block ID="1576023595" blockType="plugins.tprovoost.scripteditor.scriptblock.Javascript" className="plugins.tprovoost.scripteditor.scriptblock.Javascript" collapsed="false" definedName="Javascript" height="443" keepsResults="true" width="547" xLocation="384" yLocation="38">
<variables>
<input>
<variable ID="Script" name="" runtime="false" value="importClass(Packages.icy.roi.ROI2DRectangle)&#10;&#10;// get sequence and rois input&#10;seq = input0&#10;rois = input1&#10;// initialize output rois&#10;output0 = []&#10;&#10;// define rectangular region from image bounds&#10;seqRect = seq.getBounds2D()&#10;&#10;// subtract 1 from border&#10;seqRect.x++;&#10;seqRect.y++;&#10;seqRect.width -= 2;&#10;seqRect.height -= 2;&#10;&#10;// then define a ROI representing 'accepted area'&#10;roiRect = new ROI2DRectangle(seqRect)&#10;ind = 0&#10;&#10;// iterate over all ROIs&#10;for(i = 0; i &lt; rois.length; i++)&#10;{&#10;&#9;// get the ROI&#10;&#9;r = rois[i]&#10;&#9;// roi fit into 'accepted area' --&gt; add it to result&#10;&#9;if (roiRect.contains(r))&#10;&#9;&#9;output0[ind++] = r&#9;&#9;&#10;}" visible="true"/>
<variable ID="Add Input" name="Add Input" runtime="false" value="1" visible="true"/>
<variable ID="Add output" name="Add output" runtime="false" value="0" visible="true"/>
<variable ID="input0" name="input0" runtime="false" type="icy.sequence.Sequence" visible="true"/>
<variable ID="206640911" name="input1" runtime="true" type="[Licy.roi.ROI;" visible="true"/>
</input>
<output>
<variable ID="output0" name="output0" runtime="false" type="[Licy.roi.ROI;" visible="true"/>
</output>
</variables>
</block>
<block ID="1477598421" blockType="plugins.tprovoost.sequenceblocks.add.AddRois" className="plugins.tprovoost.sequenceblocks.SequenceBlocks" collapsed="false" definedName="Add rois" height="107" keepsResults="true" width="285" xLocation="394" yLocation="499">
<variables>
<input>
<variable ID="sequence" name="Sequence" runtime="false" visible="true"/>
<variable ID="rois(s)" name="Roi(s)" runtime="false" visible="true"/>
<variable ID="remove" name="Remove previous" runtime="false" value="true" visible="true"/>
</input>
<output/>
</variables>
</block>
</blocks>
<links>
<link dstBlockID="1576023595" dstVarID="input0" srcBlockID="1366881243" srcVarID="input sequence"/>
<link dstBlockID="1576023595" dstVarID="206640911" srcBlockID="1366881243" srcVarID="extracted rois"/>
<link dstBlockID="1477598421" dstVarID="sequence" srcBlockID="1366881243" srcVarID="input sequence"/>
<link dstBlockID="1477598421" dstVarID="rois(s)" srcBlockID="1576023595" srcVarID="output0" srcVarType="[Licy.roi.ROI;"/>
</links>
</protocol>
