This is a RESTful image server backed by ImageJ.
To provide easy-to-use and highly reusable image processing functionalities is a central goal of ImageJ. As a result, the components of ImageJ are modular, to make them easily accessible from other Java programs. However, for programs written in other languages besides Java, the interaction becomes complicated. In order to mitigate this problem, this RESTful image server is offered as a universal interfacing layer.
See the Rationale page of this repository's wiki for a longer discussion of cross-language integration and interoperability.
This is currently only a prototype! Testing needed!
The server can run with a graphical display, or in headless mode.
There are several ways to invoke the server:
The pyimagej module includes a Python wrapper for the web API.
A collection of sample API calls to imagej-server using Postman.
Installation
clients\webNew
and run npm install
. This will install all required Node.js packages.Compilation and execution (development)
clients\webNew
and run npm start
.localhost:4200
.GET /modules
Returns a list of modules. By default, imagej-server exposes its API at localhost:8080
, which will be used throughout this documentation.
$ curl localhost:8080/modules
GET /modules/{id}
Returns detailed information of a module specified by {id}
. Notice that {id}
could contain special characters such as dollar sign ($
), which needs to be escaped when using cURL
.
$ curl localhost:8080/modules/'command:net.imagej.ops.math.PrimitiveMath$IntegerAdd'
POST /modules/{id}?process={process}
Executes a module with with JSON inputs. Use the module details to determine the correct input keys. The optional query parameter process
determines if the execution should be pre/post processed.
$ curl -XPOST -H "Content-Type: application/json" -d '{"a":1,"b":3}' \
> localhost:8080/modules/'command:net.imagej.ops.math.PrimitiveMath$IntegerAdd'?process=false
{"result":4}
GET /objects
Lists all object IDs available on imagej-server.
$ curl localhost:8080/objects
GET /objects/{id}
Shows the information of an object.
$ curl localhost:8080/objects/object:1234567890abcdef
{"class":"net.imagej.DefaultDataset","created_at":"Sun Jan 01 00:00:00 CST 2017"}
DELETE /objects/{id}
Delete one object from imagej-server.
$ curl -XDELETE localhost:8080/objects/object:1234567890abcdef
POST /objects/upload?[type={type}]
Uploads a file to server. A 16-bit lowercase alphanumeric ID prefixed with object:
will be returned as a JSON string. The ID can be used in module execution to represent the file. Currently only supports uploading images and tables in text. An optional query parameter type
could be provided as hint to file type. If it is empty, filename would be used for guessing.
$ curl -F "file=@src/test/resources/imgs/about4.tif" localhost:8080/objects/upload
{"id":"object:0123456789abcdef"}
GET /objects/{id}/{format}?[&key={value}]...
Download an object in some specific format from the server. Optional query parameters will be used for configuration depending on the type of the object.
$ curl localhost:8080/objects/object:0123456789abcdef/png
DELETE /admin/stop
Stop the imagej-server gracefully without shutting down the imagej runtime.
curl -XDELETE localhost:8080/admin/stop
ModulesResource
Number
to NumericType
could be refined and considered moving to other projects such as SciJava.List<Integer>
could not be converted into List<IntType>
even with converter between Integer
and IntType
).