Closed StevenRoger closed 3 years ago
Hi, there will be difficulties integrating cornerstone tools and vtk.js views. At a technical level, vtk.js is inherently 3D, and cornerstone tools work in 2D. As a result, there will likely be lots of cases if you tried to sync the two.
As an alternative, you can check out vtk.js widgets to see if those suit your needs. While we do not have a comprehensive widget suite yet, you can see some examples here (search the page for "Widget") and see a working demo of measurements in ParaView Glance.
Thanks for your help, I tried to use vtkRectangleWidget in react-vtkjs-viewport's View2D.js like this
this.rectangleWidget = vtkRectangleWidget.newInstance({
resetAfterPointPlacement: false,
useHandles: true,
});
...
this.viewWidget = this.widgetManager.addWidget(
this.rectangleWidget,
ViewTypes.SLICE
);
this.widgetManager.grabFocus(this.rectangleWidget);
this.widgetManager.enablePicking();
this.genericRenderWindow.resize();
but error occurred
Am I using it in the wrong way?
That's odd. It might be possible that the vtk.js version of react-vtkjs-viewport needs updating? There shouldn't be any shader compilation issues. Is there any more info when you expand the error?
In the OHIF/Viewer project, I've updated the version of vtk.js to latest, this error still exist. More error info:
Does the error persist if you remove the widget code? It would seem odd that the widget code results in invalid shader code.
No, if i don't use vtkRectangleWidget, the error won't occur. I guess there are some problems with the webpack config in OHIF. All of the examples in Source/Widgets/Widgets3D runs fine.
Related issue: https://github.com/OHIF/Viewers/issues/2215
Hm, if you can provide some reproduction steps or a proof of concept then I can help debug this issue further.
Thx, I found another clue that if i removed all view props before adding the rectangleWidget, the program runs fine.
this.renderer.removeAllViewProps();
this.viewWidget = this.widgetManager.addWidget(this.rectangleWidget);
Before i use the rectangleWidget, i had rendered images and labelmaps. so i think this error was due to my wrong use of vtk.js. But i still can't figure out the reason why i can't do that.
I rendered image by vtkVolume
const volumeActor = vtkVolume.newInstance();
const volumeMapper = vtkVolumeMapper.newInstance();
volumeActor.setMapper(volumeMapper);
volumeMapper.setInputData(vtkImageData);
In this case, can i use rectangleWidget? expect some guidance.
I'm not sure how to reproduce the issue. The rectangle widget should be usable, but I don't know what specifically is missing. (maybe some glsl code is not being included?)
Can you save the entire shader error to a file and attach it here?
@StevenRoger did you get your issue fixed ?
If this is still an issue, please re-open.
I plan to do some measurements and annotations on the vtk's VIEW2D viewport, I have no idea to intergrage cornerstoneTools, Is there any better way to do it? Expect some suggestion.