How to make vtkLineSource into vtkImageData?

How to make vtkLineSource into vtkImageData? Or how to convert vtkPolyData into vtkImageData?
Now I want to line in volume data of vtkImageData type.
image

What would you like to achieve?

I want to fused the line(now polydata) and the bone of imagedata? And I can move the line freely.

I’m not sure what you mean by fusing and you can do it many different ways, depending on what exactly your end goal is, but one way is: create a closed surface using tube filter, convert that to image using stencil filters, then combine them using image math filter.

Note that there is a high chance that what you would like to achieve is already implemented in 3D Slicer. If you write to the Slicer forum then you can get step-by-step instructions of how to do it in Slicer (probably without any custom programming).