const viewer = await createSomakine(container, {
dataset,
accessibleLabel: "Interactive body model",
onSelection: ({ structure }) => {
console.log(structure.id);
},
});
viewer.setLayer("muscle");
viewer.selectStructure(structureId);
viewer.selectStructure(structureId, { side: "left" }); // one side of a paired structure
viewer.selectStructures([structureId, anotherStructureId]); // IDs may span Regions
viewer.setStructureStyle(structureId, { color: "#e19a5b" });
SOMAKINE / ALPHA 0.1
The open body framework.
A host-independent anatomy model, honest visual coverage, and a small semantic viewer API.
Loading anatomy…
Drag to rotate · Right-drag to pan · Ctrl/Cmd-click to multi-select · Scroll to zoom
Loading anatomy…
DEVELOPER SURFACE
A small viewer API, ready for your interface.
Keep layout, controls, and education content in your host application. Somakine owns the verified model, camera, and semantic selection events.
QUICK START
viewer.ts
CORE API
viewer
createSomakine(container, options)- Create a viewer with a verified data pack and host callbacks.
setLocale(locale) · setInteractionMode(mode)- Switch labels and choose primary drag rotation or panning.
setLayer(type | null) · setVisible(ids, options?)- Show one structure type or apply a host-computed visibility set;
{ side }isolates one side. selectStructure(id, options?) · selectStructures(entries, options?)- Highlight one structure or a cross-Region set; entries may be
{ id, side }for mixed sides. Unknown IDs are ignored and visibility is preserved. focusStructure(id, options?)- Explicitly isolate one structure (or one side) and its declared context geometry.
{ side: "left" | "right" }- Restrict select/focus/visible/style to one side of a paired structure;
ViewerSelection.sidereports the resolved side. onSelectionGroup(selections)- Receive the resolved selection records after a single or multi-structure highlight; canvas Ctrl/Cmd-click toggles picked meshes.
setStructureStyle(id, style, options?)- Set a structure-specific colour, emissive, opacity, or surface style; a
{ side }styles one side. Passnullto reset. showBody() · reset()- Restore the complete framed model and initial camera.
dispose()- Release controls, listeners, renderer, and loaded resources.