Skip to content

Instantly share code, notes, and snippets.

View boergens's full-sized avatar

Kevin Michael Boergens boergens

View GitHub Profile
@boergens
boergens / setLineWidth
Created March 22, 2017 18:37
webKnossos set line width
// tested in Firefox 51.0, Windows 7
// in about:config webgl.disable-angle = true and webgl.force-enabled = true
// the maximum value seems to be around 7 for me
trees = app.oxalis.sceneController.skeleton.treeGeometries; for (idx in trees) {trees[idx].getLineWidth = function(){return 7}}
window.webknossos.apiReady(1).then(async (api) => {
var segmentationOn = true;
function toggleAlpha() {
if (segmentationOn) {
app.oxalis.sceneController.setSegmentationAlpha(1)
segmentationOn = false;
} else {
app.oxalis.sceneController.setSegmentationAlpha(50);
segmentationOn = true;
}
window.webknossos.apiReady(2).then(async (api) => {
const welcomeMessage =
`Mr. Motta and Mr. Boergens proudly present
The webKnossos Merger Mode Suite
[8] Shuffles segmentation color of current tree
[9] Toggles segment opacity
[right-click] Adds node and makes segment pink
[delete] Removes node and restores original segment color
webknossos.apiReady(2).then(async (api) => {
async function createNodeOverwrite(store, call, action) {
call(action);
const pos = action.position;
const posx = pos[0];
const posy = pos[1];
const posz = pos[2];
var ids = [];
for (var idx = -1; idx < 2; idx++) {
webknossos.apiReady(2).then(async (api) => {
console.log("starting jumpy queries");
window.collection = [];
window.starter = [];
window.taskCounter = 0;
window.done = 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 createNodeOverwrite(store, call, action) {
const taskCounterHere = window.taskCounter;
call(action);
webknossos.apiReady(2).then(async (api) => {
api.tracing.finishAndGetNewTaskOld = api.tracing.finishAndGetNewTask;
api.tracing.finishAndGetNewTask = function() {
window.taskCounter += 1;
window.collection = [];
api.tracing.finishAndGetNewTaskOld();
}
window.collection = [];
window.taskCounter = 1;
async function createNodeOverwrite(store, call, action) {
webknossos.apiReady(2).then(async (api) => {
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);
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();
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;
webknossos.apiReady(2).then(async (api) => {
console.log("starting jumpy queries");
window.collection = [];
window.starter = [];
window.taskCounter = 0;
window.done = 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 createNodeOverwrite(store, call, action) {
const taskCounterHere = window.taskCounter;
call(action);
@boergens
boergens / test
Created December 28, 2021 14:31
Test
window.webknossos.apiReady(3).then(async (api) => {
const removeToast = api.utils.showToast("info", "You just got toasted", false, 5000);
})