Skip to content

Commit

Permalink
add parameters & documentation for annotation crop feature
Browse files Browse the repository at this point in the history
  • Loading branch information
geektortoise committed Feb 15, 2019
1 parent a6ac1c1 commit 3cda89e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 3 additions & 0 deletions src/groovy/be/cytomine/AnnotationDomain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 3cda89e

Please sign in to comment.