[ome-users] Batch import of images AND attachments
Colin Blackburn
C.Blackburn at dundee.ac.uk
Thu Dec 12 08:15:25 GMT 2013
Hi Graeme,
On 11 Dec 2013, at 20:51, Graeme Ball <graemeball at googlemail.com> wrote:
> Hi Josh,
>
> sure, I can make the script available. Can I tidy it up a little over Christmas and send it to you in the new year? At the moment it is a little tangled up with some other code and not very well tested or documented.
>
> When I invoke the cli from my python script I see several lines of output (are they being sent to stdout?), e.g. see attached. So you suggest I capture that and pick out the pixel Id from these two lines, right?:-
> Imported pixels:
> 53
You can capture the stdout and stderr using the cli.invoke() itself. Here's a snippet using user/password though you could use a session key:
stdo = "import.out"
stde = "import.err"
cmd = ["-s", "localhost", "-u", "myUser", -"w" -"myPassword" "import"]
cmd.extend([str("---errs=%s"%stde), str("---file=%s"%stdo), "--"])
cmd.append(fileName)
cli.invoke(cmd)
You can then get the ids from the stdo file where they appear one per line (if the import was successful, cli.rv == 0). If there was an error then stde file has the logging info.
Cheers,
Colin
> What I really wanted was to have import functionality available via the blitz gateway and get a reference to the new image back: using cli + blitz for imports seems a bit awkward.
>
> Cheers,
>
> Graeme
>
>
> On Tue, Dec 10, 2013 at 2:35 PM, Josh Moore <josh at glencoesoftware.com> wrote:
> Hi Graeme,
>
> On Dec 10, 2013, at 3:32 PM, Graeme Ball wrote:
>
> > The biggest problem is that the importer does not seem to return the ID of
> > the image after completing the upload, and you need this ID to add your
> > attachments etc.
>
> The stdout from the CLI importer is the ID of the Pixels objects (as opposed
> to the Image objects). You can also pipe these values to a file for later
> consumption.
>
>
> > we wanted to do the same thing, and ended up writing a python script that
> > performs the upload in 2 steps:-
> > 1. upload the images using the command line importer (you can invoke it
> > from python)
> > 2. use the Blitz gateway to add attachments and annotations
>
>
> Would you be up for sharing the script?
>
> Cheers,
> ~Josh
>
>
> > Regards,
> >
> > Graeme
> >
> >
> > On Tue, Dec 10, 2013 at 10:26 AM, John Webber (NBI)
> > <John.Webber at nbi.ac.uk>wrote:
> >
> >> Hi all,
> >>
> >>
> >>
> >> I have been using the command line importer to import images into an Omero
> >> instance as follows:
> >>
> >>
> >>
> >> bin/omero -s $RemoteHost -u "$User" -w "$Password" -p $Port import -d
> >> $Dataset $File
> >>
> >>
> >>
> >> Can anyone let me know if I can also use this format of command to import
> >> ATTACHMENTS to specific images and, if so, please can you advise me of the
> >> correct syntax?
> >>
> >>
> >>
> >> If it is not possible to import attachments to specific images, is anyone
> >> able to recommend how we can do a batch upload of images AND their
> >> attachments, into Omero?
> >>
> >>
> >> Thanks
> >>
> >> John
> >>
>
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>
> <iomero_import_output.txt>_______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
The University of Dundee is a registered Scottish Charity, No: SC015096
More information about the ome-users
mailing list