Page 1 of 1

Download original image file via Java API

PostPosted: Tue Nov 24, 2015 2:36 pm
by dwj
Hi,

With Insight I’m able to download an original image file from omero server to my client.
A look into the Insight code shows me, that I need a ‘FileID’ to get the OriginalFile.

How can I get this ‘FileID’ from a given ImageData object with the Java API?
The ImageData object provides ‘getFilesetID()’ and ‘getID()’ only.

Re: Download original image file via Java API

PostPosted: Wed Nov 25, 2015 9:51 am
by Dominik
Hi!

In Insight this is done by a query, which requests all original files for an image and then downloads them via the RawFileStore. I'm currently extracting this code from Insight into a separate Java Gateway which makes dealing with the Java API a bit easier.
You can take the current Gateway code as example.
The method which actually performs the download is TransferFacilityHelper.downloadImage(...)
https://github.com/openmicroscopy/openm ... .java#L949 (you can ignore the "//Prior to FS" part)
The query you need for getting the FileSet (the original files of the image) is in TransferFacilityHelper.getFilesetQuery() https://github.com/openmicroscopy/openm ... java#L1070

You can also use the Java Gateway directly (you would need blitz.jar and its dependencies), but be aware that the Java Gateway is still "experimental" for 5.2.0:
https://www.openmicroscopy.org/site/sup ... /Java.html
Respectively the downloadImage(...) method in particular:
http://downloads.openmicroscopy.org/ome ... ring-long-

Regards,
Dominik

Re: Download original image file via Java API

PostPosted: Wed Nov 25, 2015 1:54 pm
by dwj
Hi Dominik!

Thank you so much! I used the solution with the query for getting the FileSet with the help of the function TransferFacilityHelper.getFilesetQuery().

It works perfectly!

Best regards,
Daniel