Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let imageData = null
if (rendered_image) {
imageData = vtkITKHelper.convertItkToVtkImage(rendered_image)
is3D = rendered_image.imageType.dimension === 3
}
let pointSets = null
if (point_sets) {
pointSets = point_sets.map((point_set) => vtk(point_set))
}
let vtkGeometries = null
if (geometries) {
vtkGeometries = geometries.map((geometry) => vtk(geometry))
}
domWidgetView.model.use2D = !is3D
domWidgetView.model.skipOnCroppingPlanesChanged = false
domWidgetView.model.itkVtkViewer = createViewer(domWidgetView.el, {
viewerStyle: viewerStyle,
image: imageData,
pointSets,
geometries: vtkGeometries,
use2D: !is3D,
rotate: false,
})
const viewProxy = domWidgetView.model.itkVtkViewer.getViewProxy()
const renderWindow = viewProxy.getRenderWindow()
// Firefox requires calling .getContext on the canvas, which is
// performed by .initialize()
renderWindow.getViews()[0].initialize()
const viewCanvas = renderWindow.getViews()[0].getCanvas()
const stream = viewCanvas.captureStream(30000./1001.)
const renderer = viewProxy.getRenderer()