Hello,
I am trying to expand on the current react-vtkjs-viewport created by OHIF found here: GitHub - OHIF/react-vtkjs-viewport: VTK.js image viewport component in React, which currently allows for a basic paintWidget to be viewed, such as in this example: @vtk-viewport
I’d like to expand the number of wdigets available in this viewport, to more closely match the example provided by vtk.js found here: vtk.js
I’ve began adding the rectangleWidget to the react-vtkjs-viewport by following vtkjs’s example linked above. I can create a new instance of vtkRectangleWidget
along with the pre-existing paintWidget like so:
this.paintWidget = vtkPaintWidget.newInstance();
this.rectangleWidget = vtkRectangleWidget.newInstance({
resetAfterPointPlacement: true,
});
and create a manipulator for the rectangleWidget. However, when I try adding the widget to the widget manager using the following code:
this.rectangleHandle = this.widgetManager.addWidget(
this.rectangleWidget,
ViewTypes.SLICE
);
I receive the following error:
macro.js:64 Error compiling shader '#version 300 es
along with a bunch of source code which looks to be GLSL and webGL code written by kitware.
I also receive the following error:
index.js:383 Uncaught TypeError: Cannot read properties of null (reading 'isAttributeUsed')
at Object.publicAPI.setMapperShaderParameters (index.js:383)
at Object.publicAPI.updateShaders (index.js:367)
at Object.publicAPI.renderPieceDraw (index.js:918)
at Object.publicAPI.renderPiece (index.js:1037)
at publicAPI.volumePass (index.js:74)
at Object.publicAPI.apply (index.js:44)
at Object.publicAPI.traverse (index.js:32)
at publicAPI.traverseVolumePass (index.js:49)
at Object.publicAPI.traverse (index.js:27)
at Object.publicAPI.traverse (index.js:35)
I’m having a hard time pinpointing where the problem is in my code. If I log this.rectangleHandle
to my console after assigning it, it appears to have been properly initialized. Am I missing a step to add this widget? Thank you for any advice you can offer.