From 3cda89ef4392f153fdfc73458dedc89f41792f0d Mon Sep 17 00:00:00 2001 From: TheGeekTortoise Date: Fri, 15 Feb 2019 16:14:46 +0100 Subject: [PATCH] add parameters & documentation for annotation crop feature --- .../api/ontology/RestAlgoAnnotationController.groovy | 3 +++ .../ontology/RestReviewedAnnotationController.groovy | 11 +++++++---- .../api/ontology/RestUserAnnotationController.groovy | 3 +++ src/groovy/be/cytomine/AnnotationDomain.groovy | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/grails-app/controllers/be/cytomine/api/ontology/RestAlgoAnnotationController.groovy b/grails-app/controllers/be/cytomine/api/ontology/RestAlgoAnnotationController.groovy index 196770067..24d2c8e63 100644 --- a/grails-app/controllers/be/cytomine/api/ontology/RestAlgoAnnotationController.groovy +++ b/grails-app/controllers/be/cytomine/api/ontology/RestAlgoAnnotationController.groovy @@ -170,6 +170,9 @@ class RestAlgoAnnotationController extends RestController { @RestApiParam(name="maxSize", type="int", paramType = RestApiParamType.PATH,description = "Maximum size of the crop image (w and h)"), @RestApiParam(name="zoom", type="int", paramType = RestApiParamType.PATH,description = "Zoom level"), @RestApiParam(name="draw", type="boolean", paramType = RestApiParamType.PATH,description = "Draw annotation form border on the image"), + @RestApiParam(name="thickness", type="int", paramType = RestApiParamType.QUERY, description = " If draw used, set the thickness of the geometry contour on the crop.", required = false), + @RestApiParam(name="color", type="string", paramType = RestApiParamType.QUERY, description = " If draw used, set the color of the geometry contour on the crop. Color are hexadecimal value", required = false), + @RestApiParam(name="square", type="boolean", paramType = RestApiParamType.QUERY, description = " If draw used, try to extends the ROI around the crop to have a square.", required = false), ]) def crop() { AlgoAnnotation annotation = AlgoAnnotation.read(params.long("id")) diff --git a/grails-app/controllers/be/cytomine/api/ontology/RestReviewedAnnotationController.groovy b/grails-app/controllers/be/cytomine/api/ontology/RestReviewedAnnotationController.groovy index dd8f5a10b..4e91fe852 100644 --- a/grails-app/controllers/be/cytomine/api/ontology/RestReviewedAnnotationController.groovy +++ b/grails-app/controllers/be/cytomine/api/ontology/RestReviewedAnnotationController.groovy @@ -512,10 +512,13 @@ class RestReviewedAnnotationController extends RestController { @RestApiMethod(description="Get annotation reviewed crop (image area that frame annotation)") @RestApiResponseObject(objectIdentifier = "file") @RestApiParams(params=[ - @RestApiParam(name="id", type="long", paramType = RestApiParamType.PATH,description = "The annotation id"), - @RestApiParam(name="maxSize", type="int", paramType = RestApiParamType.PATH,description = "Maximum size of the crop image (w and h)"), - @RestApiParam(name="zoom", type="int", paramType = RestApiParamType.PATH,description = "Zoom level"), - @RestApiParam(name="draw", type="boolean", paramType = RestApiParamType.PATH,description = "Draw annotation form border on the image") + @RestApiParam(name="id", type="long", paramType = RestApiParamType.PATH,description = "The annotation id"), + @RestApiParam(name="maxSize", type="int", paramType = RestApiParamType.PATH,description = "Maximum size of the crop image (w and h)"), + @RestApiParam(name="zoom", type="int", paramType = RestApiParamType.PATH,description = "Zoom level"), + @RestApiParam(name="draw", type="boolean", paramType = RestApiParamType.PATH,description = "Draw annotation form border on the image"), + @RestApiParam(name="thickness", type="int", paramType = RestApiParamType.QUERY, description = " If draw used, set the thickness of the geometry contour on the crop.", required = false), + @RestApiParam(name="color", type="string", paramType = RestApiParamType.QUERY, description = " If draw used, set the color of the geometry contour on the crop. Color are hexadecimal value", required = false), + @RestApiParam(name="square", type="boolean", paramType = RestApiParamType.QUERY, description = " If draw used, try to extends the ROI around the crop to have a square.", required = false), ]) def crop() { ReviewedAnnotation annotation = ReviewedAnnotation.read(params.long("id")) diff --git a/grails-app/controllers/be/cytomine/api/ontology/RestUserAnnotationController.groovy b/grails-app/controllers/be/cytomine/api/ontology/RestUserAnnotationController.groovy index d0ce30808..343084a93 100644 --- a/grails-app/controllers/be/cytomine/api/ontology/RestUserAnnotationController.groovy +++ b/grails-app/controllers/be/cytomine/api/ontology/RestUserAnnotationController.groovy @@ -203,6 +203,9 @@ class RestUserAnnotationController extends RestController { @RestApiParam(name="maxSize", type="int", paramType = RestApiParamType.PATH,description = "Maximum size of the crop image (w and h)"), @RestApiParam(name="zoom", type="int", paramType = RestApiParamType.PATH,description = "Zoom level"), @RestApiParam(name="draw", type="boolean", paramType = RestApiParamType.PATH,description = "Draw annotation form border on the image"), + @RestApiParam(name="thickness", type="int", paramType = RestApiParamType.QUERY, description = " If draw used, set the thickness of the geometry contour on the crop.", required = false), + @RestApiParam(name="color", type="string", paramType = RestApiParamType.QUERY, description = " If draw used, set the color of the geometry contour on the crop. Color are hexadecimal value", required = false), + @RestApiParam(name="square", type="boolean", paramType = RestApiParamType.QUERY, description = " If draw used, try to extends the ROI around the crop to have a square.", required = false), @RestApiParam(name="complete", type="boolean", paramType = RestApiParamType.PATH,description = "Do not simplify the annotation form") ]) def crop() { diff --git a/src/groovy/be/cytomine/AnnotationDomain.groovy b/src/groovy/be/cytomine/AnnotationDomain.groovy index 2220f9abb..1d5d6ef33 100644 --- a/src/groovy/be/cytomine/AnnotationDomain.groovy +++ b/src/groovy/be/cytomine/AnnotationDomain.groovy @@ -325,6 +325,9 @@ abstract class AnnotationDomain extends CytomineDomain implements Serializable { if (params.draw) { boundaries.draw = true boundaries.location = location.toText() + if(params.color) boundaries.color = params.color + if(params.thickness) boundaries.thickness = params.thickness + if(params.square) boundaries.square = params.square } if (params.get('increaseArea')) { boundaries.increaseArea = params.get('increaseArea')