<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Dear OME developers,</p>
<p>I am trying to write some java code to create kinda 3D Rois, but I am not sure how to create MaskData, this is my code :
<br>
</p>
<pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:10.5pt;">ImageInt seg = object3D.createSegImage(<span style="color:#0000ff;">0</span>, <span style="color:#0000ff;">0</span>, <span style="color:#0000ff;">0</span>);
<span style="color:#000080;font-weight:bold;">byte</span>[][] mask = <span style="color:#000080;font-weight:bold;">new byte</span>[seg.<span style="color:#660e7a;font-weight:bold;">sizeZ</span>][seg.<span style="color:#660e7a;font-weight:bold;">sizeXY</span>];
<span style="color:#000080;font-weight:bold;">int </span>offX = seg.<span style="color:#660e7a;font-weight:bold;">offsetX</span>;
<span style="color:#000080;font-weight:bold;">int </span>offY = seg.<span style="color:#660e7a;font-weight:bold;">offsetY</span>;
<span style="color:#000080;font-weight:bold;">int </span>offZ = seg.<span style="color:#660e7a;font-weight:bold;">offsetZ</span>;

<span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>z = <span style="color:#0000ff;">0</span>; z < seg.<span style="color:#660e7a;font-weight:bold;">sizeZ</span>; z++) {
    <span style="color:#000080;font-weight:bold;">byte</span>[] img = mask[z];
    <span style="color:#000080;font-weight:bold;">int </span>c = <span style="color:#0000ff;">0</span>;
    <span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>y = <span style="color:#0000ff;">0</span>; y < seg.<span style="color:#660e7a;font-weight:bold;">sizeY</span>; y++) {
        <span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>x = <span style="color:#0000ff;">0</span>; x < seg.<span style="color:#660e7a;font-weight:bold;">sizeX</span>; x++) {
            <span style="color:#000080;font-weight:bold;">if </span>(seg.getPixel(x, y, z) > <span style="color:#0000ff;">0</span>)
                img[c] = (<span style="color:#000080;font-weight:bold;">byte</span>) <span style="color:#0000ff;">255</span>;
            <span style="color:#000080;font-weight:bold;">else
</span><span style="color:#000080;font-weight:bold;">                </span>img[c] = (<span style="color:#000080;font-weight:bold;">byte</span>) <span style="color:#0000ff;">0</span>;
            c++;
        }
    }
}
ROIData data = <span style="color:#000080;font-weight:bold;">new </span>ROIData();
data.setImage(image.asImage());
<span style="color:#000080;font-weight:bold;">for </span>(<span style="color:#000080;font-weight:bold;">int </span>z = <span style="color:#0000ff;">0</span>; z < seg.<span style="color:#660e7a;font-weight:bold;">sizeZ</span>; z++) {
    MaskData maskData = <span style="color:#000080;font-weight:bold;">new </span>MaskData(offX, offY, seg.<span style="color:#660e7a;font-weight:bold;">sizeX</span>, seg.<span style="color:#660e7a;font-weight:bold;">sizeY</span>, mask[z]);
    maskData.setZ(z + offZ);
    maskData.setT(T);
    maskData.setText(object3D.getName() + <span style="color:#008000;font-weight:bold;">"_" </span>+ object3D.getValue());
    data.addShapeData(maskData);
}
<span style="color:#808080;font-style:italic;">// Save ROI
</span>DataManagerFacility dm = <span style="color:#660e7a;font-weight:bold;">gateway</span>.getFacility(DataManagerFacility.<span style="color:#000080;font-weight:bold;">class</span>);
ROIFacility roifac = <span style="color:#660e7a;font-weight:bold;">gateway</span>.getFacility(ROIFacility.<span style="color:#000080;font-weight:bold;">class</span>);
ROIData roiData = roifac.saveROIs(<span style="color:#660e7a;font-weight:bold;">ctx</span>, image.getId(), Arrays.<span style="font-style:italic;">asList</span>(data)).iterator().next();

Actually I am not sure how such Mask Roi should display inside OMERO, it seems I can only see the bounding box but not the actual mask.

Thanks for any hints.

Best,

Thomas
</pre>
<pre class="moz-signature" cols="72">-- 
/***************************************************************/
      Thomas Boudier, Senior Research Officer,
      BioImage Analyst, Dynamic Imaging Centre,
      Walter and Eliza Hall Institute (WEHI), Australia.
/**************************************************************/  
</pre>
<div>
<p style="font-size:8pt; line-height:10pt; font-family: 'Arial','Arial',serif;">_______________________________________________
<br>
<br>
The information in this email is confidential and intended solely for the addressee.<br>
You must not disclose, forward, print or use it without the permission of the sender.<br>
<br>
The Walter and Eliza Hall Institute acknowledges the Wurundjeri people of the Kulin
<br>
Nation as the traditional owners of the land where our campuses are located and <br>
the continuing connection to country and community.<br>
_______________________________________________ </p>
</div>
</body>
</html>