[ome-users] QueryService
Woodbridge, Mark R
m.woodbridge at imperial.ac.uk
Mon Nov 9 13:47:10 GMT 2009
Many thanks Josh. This seems to do the trick:
if (!tsp.setPixelsId(pixelsID)) {
tsp.resetDefaults();
tsp.setPixelsId(pixelsID);
}
Mark.
________________________________________
From: josh.moore at gmx.de [josh.moore at gmx.de]
Sent: 09 November 2009 10:46
To: Woodbridge, Mark R
Cc: Chris Allan; ome-users at lists.openmicroscopy.org.uk
Subject: Re: [ome-users] QueryService
Woodbridge, Mark R writes:
> Log says that it's actually the thumbnail service generating the
> error - which explains why your code works! Sorry for the terrible
> bug report.
No worries; that certainly makes a lot more sense.
> But the same problem applies... here's the test case:
>
> import static omero.rtypes.rint;
> import omero.api.ThumbnailStorePrx;
>
> public class Thumbnail {
> public static void main(String[] args) throws Exception {
> ThumbnailStorePrx tsp = new omero.client("localhost").createSession("root", "ome").createThumbnailStore();
> tsp.setPixelsId(29);
> tsp.getThumbnail(rint(64), rint(64));
> }
> }
>
> Is this because there are no rendering settings for root for this image?
Right. If the return value from setPixelsId is false:
http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/ome/api/ThumbnailStore.html#setPixelsId%28long%29
you will definitely need to take further action before things will
work, specifically call resetDefaults and then re-call the set methods:
http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/ome/api/ThumbnailStore.html#resetDefaults()
I went ahead and added a ticket to make the exception clearer:
http://trac.openmicroscopy.org.uk/omero/ticket/1616
Thanks for pointing this out.
~J.
> Mark.
>
> ________________________________________
> From: josh.moore at gmx.de [josh.moore at gmx.de]
> Sent: 09 November 2009 08:51
> To: Woodbridge, Mark R
> Cc: Chris Allan; ome-users at lists.openmicroscopy.org.uk
> Subject: Re: [ome-users] QueryService
>
> Hi Mark,
>
> would you mind sending your server log in which the exception gets
> thrown? I'm not sure where the "o_id" parameter would be coming from.
>
> Testing briefly I see:
>
> josh at mac:~/code/omero.git/dist$ java -cp lib/client/omero_client.jar:. mark
> 102
> josh at mac:~/code/omero.git/dist$ cat mark.java
> import omero.sys.*;
> import omero.model.*;
> import omero.api.*;
>
> public class mark {
> public static void main(String[] args) throws Exception {
> omero.client c = new omero.client("localhost");
> ServiceFactoryPrx sf = c.createSession("root","ome");
> IQueryPrx iQuery = sf.getQueryService();
> IObject image = sf.getQueryService().findByQuery(
> "select i from Image i join fetch i.pixels where i.id = :id",
> new ParametersI().add("id", omero.rtypes.rlong(401)));
> System.out.println(image.getDetails().getOwner().getId().getValue());
> }
> }
>
> but you're right, that the error should definitely not be happening,
> so it would be good to track it down.
>
> Cheers,
> ~J.
>
> Woodbridge, Mark R writes:
> > Well, yes. The actual code I'm running is:
> >
> > IObject image = factory.getQueryService().findByQuery("select i
> > from Image i join fetch i.pixels where i.id = :id", new
> > ParametersI().add("id", rlong(id)));
> >
> > The problem is that it won't in a session owned by root (it returns
> > the aforementioned error). It works fine in a session owned by the
> > owner of the image, but this means sudo-ing. Just wondered why I
> > can't do it as the super user...
> >
> > -----Original Message-----
> > From: Chris Allan [mailto:callan at lifesci.dundee.ac.uk]
> > Sent: 06 November 2009 14:25
> > To: Woodbridge, Mark R
> > Cc: ome-users at lists.openmicroscopy.org.uk
> > Subject: Re: [ome-users] QueryService
> >
> > Something that looks like this:
> >
> > Parameters p = new Parameters();
> > p.setId(1L)
> > List<Image = iQuery.findAllByQuery(select i from Image i join fetch
> > i.pixels where i.id = :id);
> >
> > ??
> >
> > -Chris
> > On 6 Nov 2009, at 14:02, Woodbridge, Mark R wrote:
> >
> > > Hi,
> > >
> > > I'm using the client API from Java to run the query:
> > >
> > > select i from Image i join fetch i.pixels where i.id = :id
> > >
> > > I'm doing this in order to get pixels IDs to pass to the thumbnail
> > > service. When I run it as the OMERO super user I get the message:
> > >
> > > "Null parameters not allowed: o_id"
> > >
> > > I assumed that image Ids would be unique, but it looks like a need
> > > to pass the ID of the owner, as well as the image ID. Is this
> > > correct? Perhaps I have misunderstood...
> > >
> > > Mark.
More information about the ome-users
mailing list