Back to Projects List
The react-vtkjs-viewport
library is a wrapper around vtk.js
with the idea that it should become a really simple way to get quickly get past the boilerplate required to use vtk-js in a react application.
There have been improvements to loading, rendering and segmentation display, but an extensible tool framework in the vein of cornerstoneTools is severly lacking.
Clear objectives:
interactorStyle
s to a set of manipulators and a single configurable interactorStyle
, where “tool load-outs” can be set via configuration in the constructor (See this)[https://kitware.github.io/vtk-js/examples/InteractorStyleManipulator.html].Open questions:
cornerstoneTools
canvas over the vtk.js
viewport and rewrite the rendering routine.
vtk.js
, and we write a render hook to re-render all of these as SVG projected onto the display coordinates of the device, with a similar “invalidated” pattern to cornerstoneTools
.vtkjs-tools
” be its own repo? Are we shovelling too much into react-vtkjs-viewport that could be used elsewhere? Is this important enough to be formalized in vtk.js itself?Progress:
vtkInteractorStyleMPRSlice
with hard-coded key bindings. Two classes inherited from this class and overrode some functionality: vtkInteractorStyleMPRRotate
and vtkInteractorStyleMPRCrosshairs
. These classes were non extensible.vtkjsToolsBaseInteractorStyle
.Most importantly an imageRendered event is fired when the viewport changes in a way that means the theoretical annotation layer (TBC) knows when to trigger an update.
Next Steps:
BaseAnnotationTool
from cornerstoneTools
.The tool loadouts can be switched by instantiating an interactorStyle with a new loadout, in the example:
// Layout 1:
const istyle = vtkjsToolsInteractorStyleManipulator.newInstance({
manipulators: [
{
vtkManipulatorMixin: vtkMPRWindowLevelManipulatorMixin,
type: INTERACTION_TYPES.MOUSE,
configuration: { button: 1 },
},
{
vtkManipulatorMixin: vtkMPRPanManipulatorMixin,
type: INTERACTION_TYPES.MOUSE,
configuration: { button: 2 },
},
{
vtkManipulatorMixin: vtkMPRZoomManipulatorMixin,
type: INTERACTION_TYPES.MOUSE,
configuration: { button: 3 },
},
{
vtkManipulatorMixin: vtkMPRScrollManipulatorMixin,
type: INTERACTION_TYPES.MOUSE,
configuration: {
scrollEnabled: true,
dragEnabled: false,
},
},
],
});
api.setInteractorStyle({ istyle });
// Layout 2
const istyle = vtkjsToolsInteractorStyleManipulator.newInstance({
manipulators: [
{
vtkManipulatorMixin: vtkMPRRotateManipulatorMixin,
type: INTERACTION_TYPES.MOUSE,
configuration: { button: 1 },
},
{
vtkManipulatorMixin: vtkMPRScrollManipulatorMixin,
type: INTERACTION_TYPES.MOUSE,
configuration: {
scrollEnabled: true,
dragEnabled: false,
},
},
],
});
api.setInteractorStyle({ istyle });