Skip to content

Segment Annotation Server API

angelxuanchang edited this page Jan 13, 2018 · 1 revision

Server side API

Endpoints

/scans/segment-annotations/list       # Listing annotations (format=json for json)
/scans/segment-annotations/edit       # Update segment annotation record
/scans/segment-annotations/aggregated # Returns aggregated segment annotations for a modelId or annId
/scans/segment-annotations/view       # Webview of a single annotation
/scans/segment-annotations/submit     # Submit segment annotations    
/query?qt=segments              # Labeled segments (json)
/annotations/edit               # Updating annotation record
/annotations/preview            # Fetch preview image for an annotation

Submitting annotations

Editing annotations

Currently only the status, notes, and verified can be updated.

We use datatables editor a lot, so our client-server API conforms to that.

Client to Server:

{
    "action": "edit",
    "data": { id1: { field1: value1, field2: value2, ... }, ... }
}

Server to Client:

{
   "data": [ updated rows ]
}

Querying

Parameters

Fields: id, itemId, workerId, sessionId, status, notes, taskMode, condition, label

Grouping: $groupBy=[fieldname]

Pagination: $limit=100&$offset=5

Sort: Not supported yet

Other: $cleaned for getting labels and segments from cleaned table

Basic Filtering: [fieldname]=[fieldvalue]

Advanced Filtering:

# label is chest or dishwasher
JSON: { "label": ["chest", "dishwasher"] }
URL query parameter: label[0]=chest&label[1]=dishwasher

# workerId matches A33.*
JSON: { "condition": { "$regex": "A33.*" } }
URL query parameter: condition[$regex]=A33.*

# condition is like scannet%
JSON: { "condition": { "$like": "scannet%" } }
URL query parameter: condition[$like]=scannet%25

# status is null or empty string
JSON: { "status": { "$isnull": "" } }
URL query parameter: status[$isnull]= 

# status is null (not empty string)
JSON: { "status": { "$isnull": true } }
URL query parameter: status[$isnull]=true

# label is tv or worker is A33SGJ8YBTJ1N0
JSON: { "$or": [ { "label": "tv" }, { "workerId": "A33SGJ8YBTJ1N0" }
URL query parameter: $or[0]={"label":"tv"}&$or[1]={"workerId":"A33SGJ8YBTJ1N0"}

Supported operators: $eq, $ne, $regex, $like, $in, $nin, $gt, $gte, $lt, $lte, $exists, $isnull

Aggregation:

# Aggregate and concatenate into a single comma delimited string
JSON: { "$aggr": { "id": "GROUP_CONCAT }, "$groupBy": "itemId" }
URL query parameter: $aggr[id]=GROUP_CONCAT&$groupBy=itemId

Supported aggregation operations: AVG, COUNT, GROUP_CONCAT, MAX, MIN, STD, SUM, VAR, COUNT_DISTINCT

Clone this wiki locally