Page 1 of 2
Thumbnail pixels and annotations/tag
Posted:
Mon Feb 08, 2010 9:16 pm
by johnjhufnagle
Hi,
In a Java client, if I have a 'loaded' ImageI reference in my hand...(returned from SearchPrx) What do I need to do to load the tags and annotations tied to that image? Also I I wanted to get a hold of the thumbnail image what would be required in the code. I have Insight up and running in debug mode in Eclipse but was having a tough time tracking down where the ImageData object gets actually loaded and how to do that also.
Thanks for your help.
John
Re: Thumbnail pixels and annotations/tag
Posted:
Mon Feb 08, 2010 9:31 pm
by jmoore
Hi John,
Almost all calls to services (*Prx instances) in Insight are made inside of
OmeroGateway. Most of the annotation loading is done via
IMetadata. The thumbnail is acquired via
ThumbnailStore. Examples of using those interfaces can be found OmeroGateway, if you are stepping through Insight anyway..
Cheers,
~Josh
Re: Thumbnail pixels and annotations/tag
Posted:
Tue Feb 09, 2010 3:55 pm
by johnjhufnagle
Are the thumbnail files under <File Respository>/Thumbnails/xxx
fair game once I have an image id? They appear to be named by image id# ?
Or should I be going through an API to get the bits?
Thanks
John
Re: Thumbnail pixels and annotations/tag
Posted:
Tue Feb 09, 2010 3:59 pm
by jmoore
Definitely use the API. Nothing under <File Repository>/ is fair game.
Cheers,
~J.
Re: Thumbnail pixels and annotations/tag
Posted:
Wed Feb 17, 2010 3:15 pm
by johnjhufnagle
I'm wondering what the series of steps in Java should be to retrieve the bytes for a thumbnail.
Given an ImageI reference (loaded) that has been returned from the SearchPrx what should I do to get the bytes.
When I issue the getPrimaryPixels() in the code below I get:
omero.UnloadedCollectionException: Error updating collection:pixelsSeq
Collection is currently null. This can be seen
by testing "pixelsSeqLoaded". This implies
that this collection was unloaded. Please refresh this object
in order to update this collection.
ImageI i = (ImageI)batchIter.next();
Pixels px = i.getPrimaryPixels();
byte[] imgBytes = thumbnailService.getThumbnailByLongestSide.....(...)
What is needed to to have a 'loaded' pixel set?
Re: Thumbnail pixels and annotations/tag
Posted:
Wed Feb 17, 2010 3:27 pm
by cxallan
How are you getting the Image/Image collection in your hand John?
Re: Thumbnail pixels and annotations/tag
Posted:
Wed Feb 17, 2010 3:34 pm
by johnjhufnagle
Here is the snippet. Thanks
search = serviceFactory.createSearchService();
search.setBatchSize(RESULT_BATCH_SIZE);
search.onlyType("Image");
search.setReturnUnloaded(false);
search.byFullText(qry.getSearchStr());
while (search.hasNext())
{
List<omero.model.IObject> batch = search.results();
Iterator batchIter = batch.iterator();
while(batchIter.hasNext())
{
ImageI i = (ImageI)batchIter.next();
Pixels px = i.getPrimaryPixels();
....
}
}
Re: Thumbnail pixels and annotations/tag
Posted:
Wed Feb 17, 2010 3:55 pm
by cxallan
You'll need to either make a call to findByQuery iteratively (with getThumbnailByLongestSide) asking for both objects or collect all the image IDs and make one larger call followed by getThumbnailByLongestSideSet.
Re: Thumbnail pixels and annotations/tag
Posted:
Wed Feb 17, 2010 3:57 pm
by cxallan
Re: Thumbnail pixels and annotations/tag
Posted:
Wed Feb 17, 2010 4:15 pm
by johnjhufnagle
Hi Chris,
I currently use the IQuery interface to retrieve my image details at a later stage...with an image id that I cache. Not sure how I should then load the Pixel data though at this point given your instructions.
If I have an image id:
IQueryPrx qProxy = sf.getQueryService();
ImageI img = (ImageI)qProxy.find("Image", imgId);
...at this point how do I load the Pixels?