[ome-devel] uploading to the OMEIS
Ilya Goldberg
igg at nih.gov
Tue Sep 5 16:26:56 BST 2006
Hi Melissa
On Sep 4, 2006, at 12:52 AM, Melissa Yung wrote:
> Hi
>
> Is it possible to upload any file to the OMEIS ?
certainly
> If so could I please have any directions as to what
> code should be looked at and modified ?
There's detailed documentation here including an API reference:
http://www.openmicroscopy.org/api/omeis/
The universal API for the image server is GET and POST requests sent
using HTTP.
As for code, it depends what you're issuing the request from. You
can do it using a form specified in pure HTML for example, using no
code at all:
<form action="http://localhost/cgi-bin/omeis"
enctype="multipart/form-data" method="post">
<input type="hidden" name="Method" value="UploadFile">
<input type="submit" value="Send">
<input type="file" name="File">
</form>
The browser will ask the user to select a file to upload.
An oddity here is that the file must actually be the last thing sent
to the image server, so it has to appear last in the form.
You can do it on the command line using curl (similar to wget) like so:
curl -F Method=UploadFile -F File=@/home/igg/images/cb_1.r3d http://
localhost/cgi-bin/omeis
Perl has several modules for doing HTTP (LWP or libwww-perl among
others). If you're writing an extension to the OME back-end, you can
simply call:
my $file = OME::Image::Server::File->upload($localFile, $repository);
Which returns an OME::Image::Server::File object given a path in
$localFile and an optional Repository attribute (an instance of the
Repository ST).
Or, you can call
my $fileID = OME::Image::Server->uploadFile($repository,$filename);
Here, the repository attribute is not optional, and the call returns
the raw file ID (not an OME::Image::Server::File object). You can
always get the default repository like so:
$repository = OME::Session->instance()->findRemoteRepository();
There is OME-Java code to do this as well. All of these are very
very thin layers on top of standard libraries that let you issue HTTP
requests. The OME back-end uses libcurl internally with our own perl
bindings for it (perl2/OME/Util/cURL.pm).
-Ilya
>
> Thank you
>
>
>
>
> ____________________________________________________
> On Yahoo!7
> Fuel Price Watch - Find and map the cheapest petrol prices in
> Australia
> http://au.maps.yahoo.com/fuelwatch/
> _______________________________________________
> 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