We're Hiring!

Images, Filesets and original files

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.

Images, Filesets and original files

Postby ehrenfeu » Wed Oct 07, 2015 8:05 am

Hi all,

we're having a question regarding the identification of original files belonging to a specific image, part of a fileset, created from multiple import files.

According to the ImportFS docs, the "Original Files" to "Fileset" mapping can be rather complex. We are facing the following situation:

The user has imported a dataset from a series of OME-TIFFs, identified by Bio-Formats as one fileset with a total of six independent images (positions), each having 5 timepoints. The original files were called like this:
Code: Select all
foo_Pos0.ome.tif
foo_Pos0_1.ome.tif
foo_Pos0_2.ome.tif
foo_Pos0_3.ome.tif
foo_Pos0_4.ome.tif
...
foo_Pos5.ome.tif
foo_Pos5_1.ome.tif
foo_Pos5_2.ome.tif
foo_Pos5_3.ome.tif
foo_Pos5_4.ome.tif


Now we are trying to use Python to figure out the original file paths on the server, for each of the images of the fileset separately. I've read the Python language binding docs and the corresponding thread "How to retrieve the original file path?" here on the forum.

However, it is unclear to me how to derive which of the original files paths belongs to which of the image within the fileset. Using e.g. "image.getImportedImageFilePaths()" always returns all of the original files for the entire fileset, not just those corresponding to this image.

Any help would be greatly appreciated, I'm pretty much on a loss here :?

Thanks
~Niko
User avatar
ehrenfeu
 
Posts: 90
Joined: Fri May 11, 2012 8:21 am
Location: Basel, Switzerland

Re: Images, Filesets and original files

Postby mtbc » Thu Oct 08, 2015 8:54 am

Dear Niko,

OMERO 5.1 introduced omero.cmd.UsedFilesRequest which sounds exactly what you want. You give it an image ID and, for FS imports, it gives you http://downloads.openmicroscopy.org/ome ... ThisSeries -- "The original file IDs of any binary files associated with the image's particular series."

Of course, the extent to which a fileset's files are separated by series is rather reader-specific. There may be room for improvement there, or bugs in classification as binary or companion file, or whatever, as this feature has few enough users that it isn't much tested in the wild. Certainly experiment a bit with it on your data to make sure that its responses make sense and are sufficient in your case.

Cheers,

Mark
User avatar
mtbc
Team Member
 
Posts: 282
Joined: Tue Oct 23, 2012 10:59 am
Location: Dundee, Scotland

Re: Images, Filesets and original files

Postby ehrenfeu » Thu Oct 08, 2015 9:13 am

Dear Mark,

looking at the API docs you seem to be right, this should exactly do what I'm looking for!

Is this exposed in the Python API as well?

Thanks,
Niko
User avatar
ehrenfeu
 
Posts: 90
Joined: Fri May 11, 2012 8:21 am
Location: Basel, Switzerland

Re: Images, Filesets and original files

Postby cblackburn » Thu Oct 08, 2015 10:50 am

Hi Niko,

As it is an omero.cmd it can be handled something like this:
Code: Select all
import omero
from omero.gateway import BlitzGateway
from omero.callbacks import CmdCallbackI
from omero.cmd import UsedFilesRequest

conn = BlitzGateway(USER, PASSWORD, host=HOST)
conn.connect()
req = UsedFilesRequest(imageId=ID)
handle = conn.c.sf.submit(req)
cb = CmdCallbackI(conn.c, handle)
rsp = cb.loop(8, 500)
rsp.binaryFilesThisSeries


If successful rsp.binaryFilesThisSeries should contain a list of IDs of the original files for that series, ie image ID.

This is a very crude example that does no error checking! See https://github.com/openmicroscopy/openm ... i.py#L1618 for a more complete example.

Cheers,

Colin
cblackburn
 
Posts: 85
Joined: Mon May 25, 2009 9:03 pm

Re: Images, Filesets and original files

Postby mtbc » Thu Oct 08, 2015 10:58 am

Dear Niko,

In adapting Colin's illustrative example, also note that one may use a DoAll request to query regarding many images in a single call to the server: one sends a list of requests and gets a correspondingly ordered list of responses.

Cheers,

Mark
User avatar
mtbc
Team Member
 
Posts: 282
Joined: Tue Oct 23, 2012 10:59 am
Location: Dundee, Scotland

Re: Images, Filesets and original files

Postby ehrenfeu » Thu Oct 08, 2015 11:22 am

Thanks guys for the details! I'll check this out with my existing code and let you know.

Thanks again,
Niko
User avatar
ehrenfeu
 
Posts: 90
Joined: Fri May 11, 2012 8:21 am
Location: Basel, Switzerland


Return to Developer Discussion

Who is online

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