[ome-devel] Download original archived file with python

Wood, Christopher CJW at stowers.org
Fri Feb 11 15:38:22 GMT 2011


Hi,

Thanks for your suggestion. It led me to find the function script_utils.readFromOriginalFile , since I want  the original file rather than saving to a file. Here is an example:

client = omero.client(host)
session = client.createSession(user, password)
gateway = session.createGateway()

queryService = session.getQueryService()
rawFileStore = session.createRawFileStore()

# i found this query in another question in the forum:
qstring = "select ofile from OriginalFile as ofile left join \
    ofile.pixelsFileMaps as pfm left join pfm.child as \
    child where child.id = :id"

p = omero.sys.ParametersI()
p.addLong("id", rtypes.rlong(3914));
files = queryService.findAllByQuery(qstring, p)

fileID = files[0].getId().getValue()
file = util.readFromOriginalFile(rawFileStore, queryService, fileID)

filesize=files[0].getSize().getValue()
file = file[0:filesize]

I noticed that the source code for readFromOriginalFile  doesn't trim the unused chars from the binary string after reading the last block, so I just did that after reading.

Thanks
Chris


On 2/10/11 3:19 PM, "Wood, Christopher" <CJW at stowers.org> wrote:

Hi Will,

something was wrong with the link you provided; here is a link to what I think you wanted me to go to.

Thanks, I will let you know how it goes.
Chris

https://www.openmicroscopy.org.uk/community/viewtopic.php?f=6=595


On 2/10/11 2:08 PM, "Will Moore" <will at lifesci.dundee.ac.uk> wrote:

Hi Chris,

I don't know about the "best" way of doing this, but certainly I know
a way that works!

  Have a look at this discussion - it should have all your answers,
although the complete solution is spread between several posts.
https://www.openmicroscopy.org.uk/community/viewtopic.php?f=6=595=28f49f008da6d46383902b04b82169f7

Let us know if anything is unclear,

  Cheers,

   Will
_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel



More information about the ome-devel mailing list