Skip to content

Commit

Permalink
Segmentation code modified to work on client
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierpuigf committed Jul 27, 2015
1 parent 3e44034 commit 522b20e
Show file tree
Hide file tree
Showing 44 changed files with 2,496 additions and 245 deletions.
3 changes: 2 additions & 1 deletion annotationTools/js/draw_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ function StartDrawEvent(event) {
}

function DrawCanvasMouseMove(event){
if (event.target.id != "draw_canvas") return;
draw_anno.DeletePolygon();
var xb = GetEventPosX(event);
var yb = GetEventPosY(event);
console.log(xb,yb);
var scale = main_media.GetImRatio();
var xarr = [draw_x[0], Math.round(xb/scale), Math.round(xb/scale), draw_x[0], draw_x[0]];
var yarr = [draw_y[0],draw_y[0], Math.round(yb/scale), Math.round(yb/scale), draw_y[0]];
console.log(draw_anno);
draw_anno.DrawPolyLine(xarr, yarr);

/*DrawPolygon(draw_anno.div_attach,xarr, yarr,'drawing_bounding_box','stroke="#0000ff" stroke-width="4" fill-opacity="0.0"',scale);
Expand Down
19 changes: 19 additions & 0 deletions annotationTools/js/example.js

Large diffs are not rendered by default.

31 changes: 22 additions & 9 deletions annotationTools/js/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ function handler() {

// Submits the object label in response to the edit/delete popup bubble.
this.SubmitEditLabel = function () {

if (scribble_canvas.scribblecanvas){
scribble_canvas.annotationid = -1;
scribble_canvas.cleanscribbles();
}
submission_edited = 1;
var anno = select_anno;

Expand Down Expand Up @@ -118,13 +123,18 @@ function handler() {
selected_poly = -1;
unselectObjects(); // Perhaps this should go elsewhere...
StopEditEvent();
if (scribble_canvas.scribblecanvas){
scribble_canvas.annotationid = -1;
scribble_canvas.cleanscribbles();
}
};

// Handles when the user clicks on the link for an annotation.
this.AnnotationLinkClick = function (idx) {
if (adjust_event) return;
if (video_mode && LMgetObjectField(LM_xml, idx, 'x', oVP.getcurrentFrame()).length == 0){
// get frame that is closest

var frames = LMgetObjectField(LM_xml, idx, 't');
var id1 = -1;
var id2 = frames.length;
Expand All @@ -136,7 +146,6 @@ function handler() {
}
if (id2 < frames.length) oVP.GoToFrame(frames[id2]);
else oVP.GoToFrame(frames[id1]);

}
if(active_canvas==REST_CANVAS) StartEditEvent(idx,null);
else if(active_canvas==SELECTED_CANVAS) {
Expand All @@ -146,6 +155,7 @@ function handler() {
ChangeLinkColorBG(idx);
}
if (idx != anno_id){
if (video_mode) oVP.HighLightFrames(LMgetObjectField(LM_xml, idx, 't'), LMgetObjectField(LM_xml, idx, 'userlabeled'));
ChangeLinkColorFG(idx);
StartEditEvent(idx,null);
}
Expand All @@ -156,18 +166,21 @@ function handler() {
this.AnnotationLinkMouseOver = function (a) {
if (active_canvas != SELECTED_CANVAS && video_mode && LMgetObjectField(LM_xml, a, 'x', oVP.getcurrentFrame()).length == 0){
ChangeLinkColorFG(a);
oVP.HighLightFrames(LMgetObjectField(LM_xml, a, 't'), LMgetObjectField(LM_xml, a, 'userlabeled'));
selected_poly = a;
}
else if(active_canvas!=SELECTED_CANVAS) selectObject(a);
oVP.HighLightFrames(LMgetObjectField(LM_xml, a, 't'), LMgetObjectField(LM_xml, a, 'userlabeled'));
else if(active_canvas!=SELECTED_CANVAS){
selectObject(a);
console.log('select');
}

};

// Handles when the user moves the mouse away from an annotation link.
this.AnnotationLinkMouseOut = function () {

if(active_canvas!=SELECTED_CANVAS) unselectObjects();
if (video_mode){
oVP.UnHighLightFrames();
if(active_canvas!=SELECTED_CANVAS){
unselectObjects();
}
};

Expand Down Expand Up @@ -308,9 +321,9 @@ function handler() {
/*************************************************************/
// Scribble: Clean scribbles.
if(anno.GetType() == 1) {
scribble_canvas.cleanscribbles();
scribble_canvas.scribble_image = "";
scribble_canvas.colorseg = Math.floor(Math.random()*14);
scribble_canvas.cleanscribbles();
scribble_canvas.scribble_image = "";
scribble_canvas.colorseg = Math.floor(Math.random()*14);
}
/*************************************************************/
/*************************************************************/
Expand Down
Loading

0 comments on commit 522b20e

Please sign in to comment.