Closed lnyng closed 7 years ago
@0x00B1 Could you please have a look and let us know what you think? We think this is getting really close to being usable for calling ImageJ routines from CellProfiler in a nice way!
I cleaned up the big commit, splitting out the individual parts. All commits compile with passing tests, so I'm merging it. Much improved master branch! Thanks for your efforts, @lnyng!
To run the project in eclipse, add
server imagej-server.yml
to the program arguments in run configuration. The first token is a dropwizard command to run the server, and the second specifies the name of the configuration file. Also remember to set thetmpDir
variable in imagej-server.yml.APIs (try Postman if not already):
curl localhost:8080/modules
Returns a list of modules
curl localhost:8080/modules/{id}
Returns detailed information of a module
curl -XPOST -H "Content-Type: application/json" -d '{"inputMap":{INPUTS}}' localhost:8080/modules/{id}
Executes a module with inputs from json
curl -F "file=@PATH/TO/IMAGE" localhost:8080/io/file
Uploads an image to server. id of the uploaded image will be return in form of
{"id":"_img_ID"}
The id will be used in module execution to represent the image.curl -XPOST localhost:8080/io/_img_ID?ext=EXTENSION
Request download of image specified by ID. The image will be saved into a file in imagej-server side with EXTENSION. The filename is returned.
curl localhost:8080/io/FILENAME
Download the image with FILENAME form the server. The FILENAME must be the return value from the request download API call.
Notes and memo:
ModulesResource
Number
toNumericType
could be refined and considered moving to other projects such as Scijava.Mixins
is the initial attempt for providing json annotation to java types that we could not modify. More Mixins should be implemented for serializing complex types (potentially also for deserializing).List<Integer>
could not be converted intoList<IntType>
even with converter betweenInteger
andIntType
).