<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
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="">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="">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="">ome-devel@lists.openmicroscopy.org.uk</a><br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<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>
</body>
</html>