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

Thomas Boudier boudier.t at wehi.edu.au
Wed May 23 00:54:03 BST 2018


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.
_______________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20180522/8241b9c7/attachment.html>


More information about the ome-devel mailing list