<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Dominik,</p>
<p>Thanks a lot four reply and thanks for the tip about the channels. <br>
</p>
<p>In omero.web 5.4.6 I can see some previews of the mask and it looks ok, but since the mask is the same as the binary image I was not sure it was working, because I cannot see any difference when show is checked or not. Here is a snapshot of the data.
<br>
</p>
<p>Hi Curtis,</p>
<p>Thanks for the link, I will definitely have a look, because there is no pint for me writing duplicate code ;) .</p>
<p>cheers</p>
<p>Thomas<br>
</p>
<br>
<div class="moz-cite-prefix">On 23/05/18 23:16, Dominik Lindner (Staff) wrote:<br>
</div>
<blockquote type="cite" cite="mid:F09B5574-9CDD-45EC-ACFF-53986EAC7F62@dundee.ac.uk">
Hi Thomas,
<div class=""><br class="">
</div>
<div class="">I think your code looks alright. </div>
<div class="">OMERO.Insight doesn't support the display of mask ROIs unfortunately. But the </div>
<div class="">new web viewer (OMERO.iViewer) should. Can you try that?</div>
<div class=""><br class="">
</div>
<div class="">Just as a precaution: There's a bug in the Java Gateway's ROIFacility [1]. You're </div>
<div class="">not setting 'c' when you create the MaskData, i.e. the mask applies to all channels.</div>
<div class="">That should be fine. But just in case you want to set it deliberately to 'all channels', i. e.</div>
<div class="">setC(-1), this will basically result in setting it to the first channel, like setC(0) would do.</div>
<div class="">The Z/T/C setters and getters of the ShapeData class don't handle the '-1' case properly at </div>
<div class="">the moment. If you want to deliberately set Z, C, T to "all", then you have to access the </div>
<div class="">underlying Ice object directly, something like:</div>
<div class="">((MaskI) maskData.asIObject()).setC(null)</div>
<div class="">(In the MaskI object it has to be set to null to indicate "all").</div>
<div class="">Z/T accordingly.</div>
<div class=""><br class="">
</div>
<div class="">Regards,</div>
<div class="">Dominik</div>
<div class=""><br class="">
</div>
<div class="">1) <a href="https://github.com/openmicroscopy/openmicroscopy/pull/5761" class="" moz-do-not-send="true">https://github.com/openmicroscopy/openmicroscopy/pull/5761</a></div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 23 May 2018, at 00:54, Thomas Boudier <<a href="mailto:boudier.t@wehi.edu.au" class="" moz-do-not-send="true">boudier.t@wehi.edu.au</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">Dear OME developers,</p>
<p class="">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 class="">
</p>
<pre style="background-color: rgb(255, 255, 255); font-family: 'DejaVu Sans Mono'; font-size: 10.5pt;" class="">ImageInt seg = object3D.createSegImage(<span style="color:#0000ff;" class="">0</span>, <span style="color:#0000ff;" class="">0</span>, <span style="color:#0000ff;" class="">0</span>);
<span style="color:#000080;font-weight:bold;" class="">byte</span>[][] mask = <span style="color:#000080;font-weight:bold;" class="">new byte</span>[seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeZ</span>][seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeXY</span>];
<span style="color:#000080;font-weight:bold;" class="">int </span>offX = seg.<span style="color:#660e7a;font-weight:bold;" class="">offsetX</span>;
<span style="color:#000080;font-weight:bold;" class="">int </span>offY = seg.<span style="color:#660e7a;font-weight:bold;" class="">offsetY</span>;
<span style="color:#000080;font-weight:bold;" class="">int </span>offZ = seg.<span style="color:#660e7a;font-weight:bold;" class="">offsetZ</span>;

<span style="color:#000080;font-weight:bold;" class="">for </span>(<span style="color:#000080;font-weight:bold;" class="">int </span>z = <span style="color:#0000ff;" class="">0</span>; z < seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeZ</span>; z++) {
    <span style="color:#000080;font-weight:bold;" class="">byte</span>[] img = mask[z];
    <span style="color:#000080;font-weight:bold;" class="">int </span>c = <span style="color:#0000ff;" class="">0</span>;
    <span style="color:#000080;font-weight:bold;" class="">for </span>(<span style="color:#000080;font-weight:bold;" class="">int </span>y = <span style="color:#0000ff;" class="">0</span>; y < seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeY</span>; y++) {
        <span style="color:#000080;font-weight:bold;" class="">for </span>(<span style="color:#000080;font-weight:bold;" class="">int </span>x = <span style="color:#0000ff;" class="">0</span>; x < seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeX</span>; x++) {
            <span style="color:#000080;font-weight:bold;" class="">if </span>(seg.getPixel(x, y, z) > <span style="color:#0000ff;" class="">0</span>)
                img[c] = (<span style="color:#000080;font-weight:bold;" class="">byte</span>) <span style="color:#0000ff;" class="">255</span>;
            <span style="color:#000080;font-weight:bold;" class="">else
</span><span style="color:#000080;font-weight:bold;" class="">                </span>img[c] = (<span style="color:#000080;font-weight:bold;" class="">byte</span>) <span style="color:#0000ff;" class="">0</span>;
            c++;
        }
    }
}
ROIData data = <span style="color:#000080;font-weight:bold;" class="">new </span>ROIData();
data.setImage(image.asImage());
<span style="color:#000080;font-weight:bold;" class="">for </span>(<span style="color:#000080;font-weight:bold;" class="">int </span>z = <span style="color:#0000ff;" class="">0</span>; z < seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeZ</span>; z++) {
    MaskData maskData = <span style="color:#000080;font-weight:bold;" class="">new </span>MaskData(offX, offY, seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeX</span>, seg.<span style="color:#660e7a;font-weight:bold;" class="">sizeY</span>, mask[z]);
    maskData.setZ(z + offZ);
    maskData.setT(T);
    maskData.setText(object3D.getName() + <span style="color:#008000;font-weight:bold;" class="">"_" </span>+ object3D.getValue());
    data.addShapeData(maskData);
}
<span style="color:#808080;font-style:italic;" class="">// Save ROI
</span>DataManagerFacility dm = <span style="color:#660e7a;font-weight:bold;" class="">gateway</span>.getFacility(DataManagerFacility.<span style="color:#000080;font-weight:bold;" class="">class</span>);
ROIFacility roifac = <span style="color:#660e7a;font-weight:bold;" class="">gateway</span>.getFacility(ROIFacility.<span style="color:#000080;font-weight:bold;" class="">class</span>);
ROIData roiData = roifac.saveROIs(<span style="color:#660e7a;font-weight:bold;" class="">ctx</span>, image.getId(), Arrays.<span style="font-style:italic;" class="">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 class="">
<p style="font-size:8pt; line-height:10pt;
                    font-family: 'Arial','Arial',serif;" class="">
_______________________________________________ <br class="">
<br class="">
The information in this email is confidential and intended solely for the addressee.<br class="">
You must not disclose, forward, print or use it without the permission of the sender.<br class="">
<br class="">
The Walter and Eliza Hall Institute acknowledges the Wurundjeri people of the Kulin
<br class="">
Nation as the traditional owners of the land where our campuses are located and <br class="">
the continuing connection to country and community.<br class="">
_______________________________________________ </p>
</div>
</div>
_______________________________________________<br class="">
ome-devel mailing list<br class="">
<a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="" moz-do-not-send="true">ome-devel@lists.openmicroscopy.org.uk</a><br class="">
<a class="moz-txt-link-freetext" href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<span style="font-size:10pt;">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">_______________________________________________
ome-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a>
<a class="moz-txt-link-freetext" href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a>
</pre>
</blockquote>
<br>
<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>