# VTK PolyData To ImageData

**URL:** https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863
**Category:** Support
**Created:** [April 29, 2019, 7:12am UTC](https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863 "2019-04-29T07:12:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Tarun\_Choudhary](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tarun_choudhary/32/347_2.png) [@Tarun\_Choudhary](https://discourse.vtk.org/u/Tarun_Choudhary)
#### Post date: [April 29, 2019, 7:12am UTC](https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863/1 "2019-04-29T07:12:07Z")

</div>

Dear All,

I am trying to create voxel mesh (\*.vtu) from stl geometry; they all form an assembly.  
I have 3 stls and each of them are being converted to \*.vtu separately but when I am bringing them  
all together in multi block data set it shows that the voxel of one component is overlapping with voxel  
of other component, which is not the desired result.

I want to create a voxel mesh of assembly with unique cell scalar for each component (stl) but I cant  
do it all together in one assembly because VTK can create one scalar cell per polydata.

Please help me on this.

Kind Regards,  
Tarun

---

<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: [April 29, 2019, 1:34pm UTC](https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863/2 "2019-04-29T13:34:26Z")

</div>

You need to use a volumetric mesh generator, such as [Cleaver](https://sciinstitute.github.io/cleaver.pages/manual.html) or TetGen.

If you want to experiment with them without writing code, you can try them in 3D Slicer: install [3D Slicer](https://download.slicer.org/), install [Segment Mesher extension](https://github.com/lassoan/SlicerSegmentMesher), load your STL files into Slicer as segmentation, use Segment mesher module to generate volumetric meshes, save volumetric mesh as .vtu file. You may need to tune mesh generation parameters (e.g., increase scale parameter for Cleaver to get higher-resolution mesh) and regenerate mesh until you are satisfied with mesh quality.

---

<div class="post-metadata">

### Author: ![Tarun\_Choudhary](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tarun_choudhary/32/347_2.png) [@Tarun\_Choudhary](https://discourse.vtk.org/u/Tarun_Choudhary)
#### Post date: [April 30, 2019, 12:11pm UTC](https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863/3 "2019-04-30T12:11:31Z")

</div>

Hi Andras,  
Many thanks for your reply. I tried importing stls in 3D slicer as per the instructions you mentioned but I am getting this error message when i click apply button.

Mesh generation using Cleaver is started in working directory: /tmp/Slicer-tarun/SegmentMesher/20190430\_130934\_055

Error: ‘NoneType’ object has no attribute ‘GetColorNode’

---

<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: [April 30, 2019, 1:41pm UTC](https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863/4 "2019-04-30T13:41:45Z")

</div>

We can help with any Slicer related questions at [https://discourse.slicer.org](https://discourse.slicer.org).

---

<div class="post-metadata">

### Author: ![Tarun\_Choudhary](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tarun_choudhary/32/347_2.png) [@Tarun\_Choudhary](https://discourse.vtk.org/u/Tarun_Choudhary)
#### Post date: [April 30, 2019, 1:44pm UTC](https://discourse.vtk.org/t/vtk-polydata-to-imagedata/863/5 "2019-04-30T13:44:20Z")

</div>

Thanks for your reply. I have posted my question there. Please help me
