Page 1 of 1

Images, Filesets and original files

PostPosted: Wed Oct 07, 2015 8:05 am
by ehrenfeu
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

Re: Images, Filesets and original files

PostPosted: Thu Oct 08, 2015 8:54 am
by mtbc
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

Re: Images, Filesets and original files

PostPosted: Thu Oct 08, 2015 9:13 am
by ehrenfeu
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

Re: Images, Filesets and original files

PostPosted: Thu Oct 08, 2015 10:50 am
by cblackburn
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

Re: Images, Filesets and original files

PostPosted: Thu Oct 08, 2015 10:58 am
by mtbc
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

Re: Images, Filesets and original files

PostPosted: Thu Oct 08, 2015 11:22 am
by ehrenfeu
Thanks guys for the details! I'll check this out with my existing code and let you know.

Thanks again,
Niko