MATLAB MEX Interface
MATLAB has the capacity to run functions written in C. This functionality is provided by the MATLAB MEX interface. We wrote MATLAB MEX wrappers around the OMEIS client C library to give MATLAB users easy access to OMEIS data.
We haven't yet written MEX wrappers around all OMEIS library functions. The functions
with MEX wrappers have the
MEX C files must allocate dynamic memory using the MATLAB memory manager, i.e.
by calling the
One implication of MEX wrapped functions is that the underlying omeis client
library must be compiled against MATLAB headers and libraries in order to use
Examples
MATLAB deals with types such as im = uint8(255*sin(meshgrid(1:512,1:512))); head = MATLABtoOMEISDatatype(class(im)); [head.dx head.dy head.dz head.dc head.dt] = size(im); head = bp: 1 isSigned: 0 isFloat: 0 dx: 512 dy: 512 dz: 1 dc: 1 dt: 1
Very much analogous to the omeis-http function of the same name,
is = openConnectionOMEIS('http://localhost/cgi-bin/omeis'); is = url: 'http://localhost/cgi-bin/omeis' sessionkey: '00000'
Create a new set of pixels according to the dimensions and pixel type
specified in the id = newPixels(is, head) id = 6 Upload the MATLAB array as pixels into the OMEIS server. Returns the number of pixels set. setPixels (is, id, im) >> setPixels (is, id, im) ans = 262144
n_id = finishPixels(is, id) n_id = 6
Use pixelsInfo(is, n_id) ans = dx: 512 dy: 512 dz: 1 dc: 1 dt: 1 bp: 1 isFloat: 0 isSigned: 0 isFinished: 1 sha1: '9f60206299cd1b28f3c378cb1ce7bf0c8e47b549' And for situations where you want to access the pixels on OMEIS : am = getPixels (is, n_id); For an example MATLAB script illustrating usage of this library see src/matlab/OMEIS/main_script.m . Document Actions |