Synopsis
These examples use curl - a command line program to send URL requests.
The required SessionKey parameter has been omitted for clarity
- Create a new set of pixels with width=1024, height=768, Z-sections=36,
Channels=4, Timepoints=64, bytes per pixel=2 (unsigned integers)
curl 'http://localhost/cgi-bin/omeis?Method=NewPixels&Dims=1024,768,36,4,64,2'
Result: PixelsID (a string with a maximum of 21 characters)
Optional parameters include IsSigned and IsFloat. Both default to false if unspecified.
- Upload a file containing the pixels.
curl -F Method=UploadFile -F File=@/home/igg/images/cb_1.r3d http://localhost/cgi-bin/omeis
Result: FileID (a string with a maximum of 21 characters).
The file is uploaded using a standard http multi-part form in a POST request. Note that the content-length must be specified in the http header. This is calculated automatically by curl, and most other libraries that provide http POST functions. When using omeis on the command-line, an UploadSize parameter must be specified, set to the number of bytes in the file.
- Convert an entire Uploaded file to a set of Pixels all at once. The Pixels in this file are in XYZCT order,
which matches the order in Pixels files. Otherwise, you would call
ConvertRows, ConvertPlane, ConvertTIFF or ConvertStack. The optional Offset
parameter is used to skip a 1024 byte header.
curl 'http://localhost/cgi-bin/omeis?Method=Convert&PixelsID=123&FileID=456&Offset=1024'
Result: Number of pixels converted
- FinishPixels must be called before the Pixels can be read
curl 'http://localhost/cgi-bin/omeis?Method=FinishPixels&PixelsID=123'
Result: The PixelsID.
This PixelsID must be used for all subsequent read operations on these pixels. It may not be the same PixelsID as that returned by NewPixels. See the documentation for FinishPixels.
- Binary download of XYZ stack from channel 2, timepoint 0 in network byte
order (big endian).
curl 'http://localhost/cgi-bin/omeis?Method=GetStack&PixelsID=123&theC=2&theT=0'\ > myStack.raw
Result: Raw pixels with an application/octet-stream mime-type saved to myStack.raw.
- Generate a gray-scale TIFF image of channel 0 (first channel), Z section 2
(third Z section), timepoint=1 (second timepoint) using black level=456, white
level=1200, and a size of 100x100 (preserving aspect ratio).
curl 'http://localhost/cgi-bin/omeis?Method=Composite&PixelsID=123&theZ=2&\ theT=1&GrayChannel=0,456,1200,0&Size=100,100&Format=TIFF' > myPlane.tiff
Result: A TIFF image with an image/tiff mime-type saved to myPlane.tiff.