How to use the itk-vtk-viewer/src/createViewer function in itk-vtk-viewer

To help you get started, we’ve selected a few itk-vtk-viewer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github InsightSoftwareConsortium / itkwidgets / js / lib / viewer.js View on Github external
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()

itk-vtk-viewer

Web-based image, mesh, and point set viewer

BSD-3-Clause
Latest version published 6 months ago

Package Health Score

58 / 100
Full package analysis

Popular itk-vtk-viewer functions