Skip to content

Instantly share code, notes, and snippets.

View philippotto's full-sized avatar

Philipp Otto philippotto

View GitHub Profile
import logging
from pathlib import Path
import webknossos as wk
from webknossos.annotation import Annotation
from webknossos.dataset import MagView
from webknossos.geometry import BoundingBox, Mag
def merge_with_fallback_layer(
output_path: Path,
async function applyMapping(api) {
const trees = api.tracing.getAllTrees();
const currentTreeId = api.tracing.getActiveTreeId();
const currentTree = trees[currentTreeId];
const segmentationName = api.data.getVolumeTracingLayerName()
const cellIdSet = new Set()
for (const node of currentTree.nodes.values()) {
const cellId = await api.data.getDataValue(segmentationName, node.position);
window.webknossos.apiReady(3).then(async (api) => {
api.utils.registerKeyHandler("8", () => { alert("You pressed 8"); });
});
window.webknossos.apiReady(3).then(async (api) => {
api.utils.registerKeyHandler("7", () => { alert("You pressed 7"); });
});
@philippotto
philippotto / merger-mode-script.txt
Last active August 13, 2018 07:01 — forked from heikowissler/merger-mode-script.txt
merger-mode-script
window.webknossos.apiReady(3).then(async (api) => {
const welcomeMessage =
`Mr. Motta and Mr. Boergens proudly present
The webKnossos Merger Mode Suite (version 23.04.2017)
[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
@philippotto
philippotto / mergerMode_v2.js
Last active April 22, 2017 22:06
Merger mode for api v2
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
git config --global alias.l "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"