Last active
September 11, 2017 17:41
-
-
Save boergens/49feef3e4072a92e3efc7d408ef98609 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webknossos.apiReady(2).then(async (api) => { | |
console.log("starting spine task"); | |
window.taskID = 0; | |
window.done = []; | |
window.done[window.taskID] = false; | |
api.utils.showToast("info", 'Press "7" to automatically place a comment for unsolved tracing (means: mistracing, glia, unsure) and "9" to finish and get next task', 3000); | |
async function wKReadyOverwrite(store, call, action) { | |
window.taskID += 1; | |
const taskIDhere = window.taskID; | |
window.done[taskIDhere] = false; | |
call(action); | |
setTimeout(() => { | |
if (taskIDhere === window.taskID) { | |
api.utils.showToast("info", 'Task time out', 3000); | |
} | |
window.done[taskIDhere] = true | |
}, 25000); | |
} | |
async function actionOverwrite(store, call, action) { | |
if (!window.done[window.taskID]) { | |
call(action); | |
} | |
} | |
api.utils.registerOverwrite("WK_READY", wKReadyOverwrite); | |
api.utils.registerOverwrite("MOVE_PLANE_FLYCAM_ORTHO", actionOverwrite); | |
api.utils.registerOverwrite("MOVE_FLYCAM_ORTHO", actionOverwrite); | |
api.utils.registerOverwrite("CREATE_NODE", actionOverwrite); | |
api.utils.registerKeyHandler("9", () => { | |
api.utils.showToast("info", 'Task finished', 3000); | |
api.tracing.finishAndGetNextTask(); | |
}); | |
api.utils.registerKeyHandler("7", () => { | |
api.tracing.setCommentForNode("unsolved", api.tracing.getActiveNodeId(), api.tracing.getActiveTreeId()); | |
api.utils.showToast("warning", 'Task marked as unsolved (mistracing, glia, unsure).', 3000); | |
api.tracing.finishAndGetNextTask(); | |
}); | |
setTimeout(() => { | |
if (window.taskID === 0) { | |
api.utils.showToast("info", 'Task time out', 3000); | |
} | |
window.done[0] = true | |
}, 25000); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment