We're Hiring!

Download original image file via Java API

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please 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

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Download original image file via Java API

Postby dwj » Tue Nov 24, 2015 2:36 pm

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.
dwj
 
Posts: 23
Joined: Mon Nov 16, 2015 10:46 am

Re: Download original image file via Java API

Postby Dominik » Wed Nov 25, 2015 9:51 am

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
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am

Re: Download original image file via Java API

Postby dwj » Wed Nov 25, 2015 1:54 pm

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
dwj
 
Posts: 23
Joined: Mon Nov 16, 2015 10:46 am


Return to Developer Discussion

Who is online

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