Kitware/VolView

how to draw some points in `VtkObliqueThreeView`

Moonsic opened this issue · 4 comments

Hello, please, I have a question, how to draw some points (or some spheres) in the 3D space of VtkObliqueThreeView page?
I want to use these points as a reference point.

Something like that is not implimented, but would be nice.

Yes, thank you for your reply. I can use vtk.js to implement it, but I don't know how to combine it in VolView code, I feel a little difficult. I don't know what method can be implemented in viewProxy.value in VtkObliqueThreeView.vue file. Can you give me some ideas? I want to try to make it. Thank you.

  import vtkSphereSource from '@kitware/vtk.js/Filters/Sources/SphereSource';

  const sphere = vtkSphereSource.newInstance();
  const points = [
    [0.1,0.2,0.3],
    [0.2,0.1,0.5],
    [0.3,0.2,0.1],
    [0.4,0.4,0.4],
  ]
  points.forEach(item=>{
    sphere.setCenter(item);
    sphere.setRadius(0.01);
    const sphereMapper = vtkMapper.newInstance();
    sphereMapper.setInputData(sphere.getOutputData());
    const sphereActor = vtkActor.newInstance();
    sphereActor.setMapper(sphereMapper);
    sphereActor.getProperty().setColor(0.0, 1.0, 0.0);                                                                                                                                         
    renderer.addActor(sphereActor);
  })
  renderWindow.render();

Something like that is not implimented, but would be nice.

floryst has made some important improvements removing proxies recently, so suggest updating to the tip of main.

Then create a MySpheresRepresentation.vue which you put in the ObliqueSliceViewer.vue. This is the pattern for that:
https://github.com/Kitware/VolView/blob/main/src/components/vtk/VtkBaseObliqueSliceRepresentation.vue

Something like useResliceRepresentation.ts runs something like the vanila VTK.js code you got there.
https://github.com/Kitware/VolView/blob/main/src/core/vtk/useResliceRepresentation.ts

floryst has made some important improvements removing proxies recently, so suggest updating to the tip of main.

Then create a MySpheresRepresentation.vue which you put in the ObliqueSliceViewer.vue. This is the pattern for that: https://github.com/Kitware/VolView/blob/main/src/components/vtk/VtkBaseObliqueSliceRepresentation.vue

Something like useResliceRepresentation.ts runs something like the vanila VTK.js code you got there. https://github.com/Kitware/VolView/blob/main/src/core/vtk/useResliceRepresentation.ts

Thank you very much. I did it.