We're Hiring!

copyShapes() method is not found

General user discussion about using the OMERO platform to its fullest. Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

There are workflow guides for various OMERO functions on our help site - http://help.openmicroscopy.org

You should find answers to any basic questions about using the clients there.

copyShapes() method is not found

Postby Kouichi_C_Nakamura » Thu Jan 24, 2019 12:28 pm

Looking at this page (https://docs.openmicroscopy.org/latest/ ... #read-data), I'm following the example in Retrieve ROIs linked to an Image in MATLAB.

Code: Select all
ROIFacility roifac = gateway.getFacility(ROIFacility.class);

//Retrieve the roi linked to an image
List<ROIResult> roiresults = roifac.loadROIs(ctx, image.getId());
ROIResult r = roiresults.iterator().next();
if (r == null) return;
Collection<ROIData> rois = r.getROIs();
List<Shape> list;
Iterator<Roi> j = rois.iterator();
while (j.hasNext()) {
  roi = j.next();
  list = roi.copyShapes();
  // Do something
}


In my practice, roi is an omero.gateway.model.ROIData object and it does not have a method called copyShapes(): https://javadoc.scijava.org/OMERO/omero ... IData.html

I could not find it in the index either: https://javadoc.scijava.org/OMERO/index-all.html


MATLAB code
Code: Select all
roifac = getGatewayFacility(gateway,'ROIFacility'); %see https://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8615&p=20473#p20473

//Retrieve the roi linked to an image
roiresults = roifac.loadROIs(ctx, image.getId());
r = roiresults.iterator().next();
if isempty(r)
    return;
end
rois = r.getROIs();

j = rois.iterator();
while (j.hasNext()) {
  roi = j.next();
  list = roi.copyShapes();  %TODO
  // Do something
}


I guess that the code example is obsolete and requires renewal.
Kouichi_C_Nakamura
 
Posts: 165
Joined: Thu Oct 19, 2017 1:35 pm

Re: copyShapes() method is not found

Postby Dominik » Thu Jan 24, 2019 1:44 pm

You are right. Thanks for pointing this out. I'll update the documentation.

The example should rather be like this:
Code: Select all
       // Retrieve the roi linked to an image
        List<ROIResult> roiresults = roifac.loadROIs(userCtx, imgId);
        ROIResult r = roiresults.iterator().next();
        if (r == null)
            return;
        Collection<ROIData> rois = r.getROIs();
        Iterator<ROIData> j = rois.iterator();
        while (j.hasNext()) {
            ROIData roi = j.next();
            List<ShapeData> shapes = roi.getShapes(-1, -1);
            // Do something
        }


Regards,
Dominik

Edit: See http://downloads.openmicroscopy.org/ome ... s-int-int-
Alternatively you can also get the shapes via the getIterator() method, which returns Lists of shapes.
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am


Return to User Discussion

Who is online

Users browsing this forum: Google [Bot] and 0 guests

cron