We provide a C library, based on cURL,
that very closely mirrors the OMEIS server HTTP interface. This library composes and parses
GET and POST requests allowing clients to easily interact with OMEIS.
The library is provided with the default OME distribution in the src/C/omeis-http
directory.
It comes with a configuration script. Normally, its only dependency is cURL. However, if you wish to use
this library with compiled MATLAB MEX functions then you must link this library with your MATLAB installation
and pass the configure script flags to specify the MATLAB authorized user; in this case it is 'tmacur1'. The
configure script must be executed by the root because, internally, it sudoes into the specified MATLAB user.
Get more information about the MATLAB MEX interface.
sudo configure --with-MATLAB --with-MATLAB-user=tmacur1
This library doesn't yet mirror all OMEIS methods. We use [C]
in our documentation
to designate client library methods that are currently implemented. If some OMEIS methods that you would like to
use aren't supported by the library, let us know.
Additional Client Library Functions
The client library contains several auxiliary functions that lack corresponding OMEIS methods. These
functions are described in this section.
The very first function one must call to use the library is openConnectionOMEIS
. The first
parameter is the URL to the OMEIS server. The second parameter is the SessionKey token.
Since SessionKey authentication is not yet complete, any string can be provided. e.g. :
omeis* is = openConnectionOMEIS("http://localhost/cgi-bin/omeis", "0000");
The omeis
struct returned from calling openConnectionOMEIS encodes the connection to the
OMEIS server and serves as the first input to all other functions. e.g. :
char* sha1 = pixelsSHA1 (is, ID);
C functions describe data according to native types such as float
, int
,
unsigned int
, long int
etc. whilst OMEIS is concerned
with bpp
, isSigned
, and isFloat
.
The CtoOMEISDatatype
library function translates between
the conventions.
pixHeader* ph = malloc(sizeof(pixHeader));
CtoOMEISDatatype ("unsigned char", ph);
For comparision look at the OMEIS MATLAB MEX untility M-file
MATLABtoOMEISDatatype.m.
OMEIStoCArray
is a function that casts the void*
data returned by OMEIS into the requested type.
void* pixels = getPixels (is, 135);
int** int_pixels = (int**) OMEIStoCArray (pixels, ph, "int");
For example source code illustrating how to use this library see src/C/omeis-http/main.c.