webknossos

API initializer. Will be called as soon as the webKnossos API is ready.

apiReady
Parameters
version (number)
Example
window.webknossos.apiReady(3).then((api) => {
  // Your cool user script / wK plugin
  const nodes = api.tracing.getAllNodes();
  ...
});

All tracing related API methods. This is the newest version of the API (version 3).

new TracingApi(model: OxalisModel)
Version: 3
Parameters
model (OxalisModel)
Example
window.webknossos.apiReady(3).then(api => {
  api.tracing.getActiveNodeId();
  api.tracing.getActiveTreeId();
  ...
}
Instance Members
getActiveNodeId()
getActiveTreeId()
getActiveTreeGroupId()
getActiveGroupId()
setActiveNode(id)
getAllNodes()
getAllTrees()
deleteNode(nodeId, treeId)
centerActiveNode()
createTree()
deleteTree(treeId)
createNode(position, options?)
resetSkeletonTracing()
setCommentForNode(commentText, nodeId, treeId?)
getCommentForNode(nodeId, treeId?)
setTreeName(name, treeId)
setTreeEdgeVisibility(edgesAreVisible, treeId)
setActiveTree(treeId)
setActiveTreeByName(treeName)
setActiveTreeGroup(groupId)
setActiveGroup(groupId)
setTreeColorIndex(treeId, colorIndex)
setTreeVisibility(treeId, isVisible)
getTreeGroups()
setTreeGroup(treeId?, groupId?)
renameSkeletonGroup(groupId, newName)
moveSkeletonGroup(groupId, targetGroupId)
registerSegment(segmentId, somePosition, someAdditionalCoordinates, layerName?)
registerSegmentsForBoundingBox
getSegment(segmentId, layerName)
updateSegment(segmentId, segment, layerName)
removeSegment(segmentId, layerName)
moveSegmentGroup(groupId, targetGroupId, layerName)
createSegmentGroup(name, parentGroupId, volumeLayerName?)
renameSegmentGroup(groupId, newName, volumeLayerName?)
deleteSegmentGroup(groupId, deleteChildren, volumeLayerName?)
renameGroup(groupId, newName)
getTreeName(treeId?)
loadAgglomerateSkeletonForSegmentId(segmentId)
save()
finishAndGetNextTask()
restart(newMaybeCompoundType, newAnnotationId, newControlMode, versions?, keepUrlState)
hardReload()
setNodeRadius(delta, nodeId?, treeId?)
centerNode
centerTDView
measureTreeLength(treeId)
measureAllTrees()
findShortestPathBetweenNodes(sourceNodeId, targetNodeId)
measurePathLengthBetweenNodes(sourceNodeId, targetNodeId)
centerPositionAnimated(position, skipCenteringAnimationInThirdDimension, rotation?)
getCameraPosition()
setCameraPosition(position)
getActiveCellId()
setActiveCell(id)
getAnnotationTool()
setAnnotationTool(tool)
getVolumeTool()
setVolumeTool(tool)
downsampleSegmentation(volumeTracingId)
disableSaving()

All binary data / layer related API methods.

new DataApi(model: OxalisModel)
Parameters
model (OxalisModel)
Example
window.webknossos.apiReady(3).then(api => {
  api.data.getLayerNames();
  api.data.reloadBuckets(...);
  ...
}
Instance Members
getLayerNames()
getVolumeTracingLayerName()
getSegmentationLayerNames()
reloadBuckets(layerName, predicateFn?)
reloadAllBuckets()
setMapping(layerName, mapping, options)
setMappingEnabled(isEnabled, layerName?)
getMappingNames(layerName?)
getActiveMapping(layerName?)
activateMapping(mappingName?, mappingType, layerName?)
isMappingEnabled(layerName?)
getBoundingBox(layerName)
getDataValue(layerName, position, _zoomStep, additionalCoordinates)
getRenderedZoomStepAtPosition(layerName, position)
getUltimatelyRenderedZoomStepAtPosition(layerName, position)
downloadRawDataCuboid(layerName, topLeft, bottomRight)
labelVoxels(voxels, label, additionalCoordinates)
getConfiguration(key)
setConfiguration(key, value)
getAvailableMeshFiles(layerName?)
getActiveMeshFile(layerName?)
setActiveMeshFile(meshFileName, layerName?)
loadPrecomputedMesh(segmentId, seedPosition, layerName, seedAdditionalCoordinates?)
computeMeshOnDemand(segmentId, seedPosition, seedAdditionalCoordinates?)
setMeshVisibility(segmentId, isVisible, layerName?)
removeMesh(segmentId, layerName?)
resetMeshes(layerName?)
getSegmentColor(segmentId, layerName?)
setSegmentColor(segmentId, rgbColor, layerName?)

All user configuration related API methods.

new UserApi(model: OxalisModel)
Parameters
model (OxalisModel)
Example
window.webknossos.apiReady(3).then(api => {
  api.user.getConfiguration(...);
  api.user.setConfiguration(...);
  ...
}
Instance Members
getConfiguration(key)
setConfiguration(key, value)

Utility API methods to control wK.

new UtilsApi(model: OxalisModel)
Parameters
model (OxalisModel)
Example
window.webknossos.apiReady(3).then(api => {
  api.utils.sleep(...);
  api.utils.showToast(...);
  ...
}
Instance Members
sleep(milliseconds)
showToast(type, message, timeout)
registerOverwrite(actionName, overwriteFunction)
registerKeyHandler(key, handler)