# How to make vtkLineSource into vtkImageData?

**URL:** https://discourse.vtk.org/t/how-to-make-vtklinesource-into-vtkimagedata/4444
**Category:** Support
**Created:** [October 19, 2020, 12:24pm UTC](https://discourse.vtk.org/t/how-to-make-vtklinesource-into-vtkimagedata/4444 "2020-10-19T12:24:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wulicheng](https://discourse.vtk.org/user_avatar/discourse.vtk.org/wulicheng/32/1990_2.png) [@wulicheng](https://discourse.vtk.org/u/wulicheng)
#### Post date: [October 19, 2020, 12:24pm UTC](https://discourse.vtk.org/t/how-to-make-vtklinesource-into-vtkimagedata/4444/1 "2020-10-19T12:24:54Z")

</div>

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](https://discourse.vtk.org/uploads/default/original/2X/9/902b6afda45da26e3590f9aa313f34b42186a15e.jpeg)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 19, 2020, 2:15pm UTC](https://discourse.vtk.org/t/how-to-make-vtklinesource-into-vtkimagedata/4444/2 "2020-10-19T14:15:54Z")

</div>

What would you like to achieve?

---

<div class="post-metadata">

### Author: ![wulicheng](https://discourse.vtk.org/user_avatar/discourse.vtk.org/wulicheng/32/1990_2.png) [@wulicheng](https://discourse.vtk.org/u/wulicheng)
#### Post date: [October 20, 2020, 1:20am UTC](https://discourse.vtk.org/t/how-to-make-vtklinesource-into-vtkimagedata/4444/3 "2020-10-20T01:20:14Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 20, 2020, 2:15am UTC](https://discourse.vtk.org/t/how-to-make-vtklinesource-into-vtkimagedata/4444/4 "2020-10-20T02:15:07Z")

</div>

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](https://discourse.slicer.org) then you can get step-by-step instructions of how to do it in Slicer (probably without any custom programming).
