[ome-devel] How to use masks for Rois ?

Dominik Lindner (Staff) d.lindner at dundee.ac.uk
Wed May 23 14:16:49 BST 2018


Hi Thomas,

I think your code looks alright.
OMERO.Insight doesn't support the display of mask ROIs unfortunately. But the
new web viewer (OMERO.iViewer) should. Can you try that?

Just as a precaution: There's a bug in the Java Gateway's ROIFacility [1]. You're
not setting 'c' when you create the MaskData, i.e. the mask applies to all channels.
That should be fine. But just in case you want to set it deliberately to 'all channels', i. e.
setC(-1), this will basically result in setting it to the first channel, like setC(0) would do.
The Z/T/C setters and getters of the ShapeData class don't handle the '-1' case properly at
the moment. If you want to deliberately set Z, C, T to "all", then you have to access the
underlying Ice object directly, something like:
((MaskI) maskData.asIObject()).setC(null)
(In the MaskI object it has to be set to null to indicate "all").
Z/T accordingly.

Regards,
Dominik

1) https://github.com/openmicroscopy/openmicroscopy/pull/5761



On 23 May 2018, at 00:54, Thomas Boudier <boudier.t at wehi.edu.au<mailto:boudier.t at wehi.edu.au>> wrote:


Dear OME developers,

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 :

ImageInt seg = object3D.createSegImage(0, 0, 0);
byte[][] mask = new byte[seg.sizeZ][seg.sizeXY];
int offX = seg.offsetX;
int offY = seg.offsetY;
int offZ = seg.offsetZ;

for (int z = 0; z < seg.sizeZ; z++) {
    byte[] img = mask[z];
    int c = 0;
    for (int y = 0; y < seg.sizeY; y++) {
        for (int x = 0; x < seg.sizeX; x++) {
            if (seg.getPixel(x, y, z) > 0)
                img[c] = (byte) 255;
            else
                img[c] = (byte) 0;
            c++;
        }
    }
}
ROIData data = new ROIData();
data.setImage(image.asImage());
for (int z = 0; z < seg.sizeZ; z++) {
    MaskData maskData = new MaskData(offX, offY, seg.sizeX, seg.sizeY, mask[z]);
    maskData.setZ(z + offZ);
    maskData.setT(T);
    maskData.setText(object3D.getName() + "_" + object3D.getValue());
    data.addShapeData(maskData);
}
// Save ROI
DataManagerFacility dm = gateway.getFacility(DataManagerFacility.class);
ROIFacility roifac = gateway.getFacility(ROIFacility.class);
ROIData roiData = roifac.saveROIs(ctx, image.getId(), Arrays.asList(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


--
/***************************************************************/
      Thomas Boudier, Senior Research Officer,
      BioImage Analyst, Dynamic Imaging Centre,
      Walter and Eliza Hall Institute (WEHI), Australia.
/**************************************************************/


_______________________________________________

The information in this email is confidential and intended solely for the addressee.
You must not disclose, forward, print or use it without the permission of the sender.

The Walter and Eliza Hall Institute acknowledges the Wurundjeri people of the Kulin
Nation as the traditional owners of the land where our campuses are located and
the continuing connection to country and community.
_______________________________________________

_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20180523/812767b2/attachment.html>


More information about the ome-devel mailing list