I’m using vtk.js in a React application.
I would like to control the color map natively; i.e. have a custom dropdown with color map options then pass those to the vtkVolumeController when I call the setupContent method on the controller.
I am able to do that, but if the user uses the dropdown inside the vtkVolumeController then I’m not sure how to grab that value once it changes so I can use it elsewhere.
I figure my options are either:
A) Listen for the change in vtkVolumeController and save that.
or
B) Remove the vtkVolumeController’s color map selection all together so the user never encounters this error.
Rereading it seems you are in plain vtk.js which means you probably want to wrap vtkVolumeController inside react by building it yourself using its internal components and skipping the drop down. (kind of doing B’)
Okay, thanks. I’m assuming I should use the source code for this, just sort of take what I need and leave out what I don’t? Any issues I should look out for while doing this?
Yes you should embed vtkPiecewiseGaussianWidget inside some react component and manage the rest of the interaction on your own. I don’t see any issue doing so.
Doing it in plain JS (no framework) is a pain, but if we want vtk.js to be framework free we don’t have much choice. So we don’t provide much freedom to tune things up especially knowing that it would be trivial to implement it using any framework out there.