How to draw lines on surface

I’m trying to draw lines on mesh , like this(I’m using vtkIntersectionPolyDataFilter now, but Inefficient)

class vtkProjectedTerrainPath need a vtkImageData input. How can I get it by converting the vtkPolyData, or any other ways to achive that effect? thanks!

Hi - do your lines represent intersections with your surface? If so, vtkIntersectionPolyDataFilter seems appropriate. I searched for other examples, but didn’t find anything enlightening.

Thanks for answering! The surface actor update every second,but drawing lines costs 0.5 second(when using vtkIntersectionPolyDataFilter),vtkProjectedTerrainPath maybe a better way, but I don’t know how to

There is one Python example, it didn’t look too mysterious. The author created a polyline, terrainPaths and set it as the input data. They then went on to use the Mt. St. Helens data as the source connection. I haven’t tried this yet, and I gather that there are several modes that can be used.

projectedPaths = vtk.vtkProjectedTerrainPath()

Most of the time users wants to have an editable curve, not just one that can only be drawn once. So, I would recommend what we do in 3D Slicer: specify a curve by dropping (and moving) control points on the surface and project the interpolated curve points to the surface.

It is all implemented with VTK-based classes here. The curve generator and projection classes are in the MRML folder.

1 Like