# Convert a .vtk to a 3D voxel-based image

**URL:** https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629
**Category:** ParaView Support
**Created:** [March 5, 2021, 5:18pm UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629 "2021-03-05T17:18:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![aabdallah](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@aabdallah](https://discourse.paraview.org/u/aabdallah)
#### Post date: [March 5, 2021, 5:18pm UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/1 "2021-03-05T17:18:10Z")

</div>

Hello,  
I am a beginner in paraview,

I am trying to convert a .vtk Data file (DATASET POLYDATA) to a 3D voxel-based image having a .raw or .tif format. So I need to voxelise the domain(sample of particles) and to saved the data into a binary file (.raw or .tif) consisting of voxels with a value of either 0 or 255 which represent if the voxel is inside a particle or in a void space.  
The .vtk file corresponds to slices of ellipsoid particles taken from a DEM software.  
I was searching and I found that it could be possible to do using DataSet Resampling Filters but this function was disabled in my case.  
I am using paraview 5.0.1

Thank you for helping me.

Here is an example for the data of a .vtk file of 1 particle with only three slices (to reduce the data):

```
# vtk DataFile Version 2.0
Sway data processing
ASCII
DATASET POLYDATA
POINTS 18 float
0.0027844392648 0.00563003547056 0.00338288761005
0.0027844392648 0.00563003547056 0.00338288761005
0.0027844392648 0.00563003547056 0.00338288761005
0.0027844392648 0.00563003547056 0.00338288761005
0.0027844392648 0.00563003547056 0.00338288761005
0.0027844392648 0.00563003547056 0.00338288761005
-0.00244453183833 -4.5732163164e-05 0.00509855744152
-0.0055502958195 0.00307391120888 0.00413183342481
-0.00548856609027 0.00336799271205 0.00164995802301
-0.00232107237987 0.000542430843166 0.000134806637937
0.0007846916013 -0.00257721252888 0.00110153065465
0.000722961872072 -0.00287129403205 0.00358340605645
-0.007550043483 -0.00513333679056 0.00185047646941
-0.007550043483 -0.00513333679056 0.00185047646941
-0.007550043483 -0.00513333679056 0.00185047646941
-0.007550043483 -0.00513333679056 0.00185047646941
-0.007550043483 -0.00513333679056 0.00185047646941
-0.007550043483 -0.00513333679056 0.00185047646941
POLYGONS 12 60
4 0 1 7 6 
4 1 2 8 7 
4 2 3 9 8 
4 3 4 10 9 
4 4 5 11 10 
4 5 0 6 11 
4 6 7 13 12 
4 7 8 14 13 
4 8 9 15 14 
4 9 10 16 15 
4 10 11 17 16 
4 11 6 12 17
```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 8, 2021, 9:05am UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/2 "2021-03-08T09:05:28Z")

</div>

There is no data to resample, only geometry.

---

<div class="post-metadata">

### Author: ![aabdallah](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@aabdallah](https://discourse.paraview.org/u/aabdallah)
#### Post date: [March 8, 2021, 9:10am UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/3 "2021-03-08T09:10:08Z")

</div>

Thank you very much for your reply,  
So as I understand it is impossible to transfer this geometry to a 3D voxel-based image using Paraview.  
Do you know if there is any free software that can do this job.  
Thank you.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 8, 2021, 9:12am UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/4 "2021-03-08T09:12:22Z")

</div>

It would be possible if you had data arrays on your file, but you do not have any.

It doesn’t make sense to resample a dataset without any data arrays.

---

<div class="post-metadata">

### Author: ![aabdallah](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@aabdallah](https://discourse.paraview.org/u/aabdallah)
#### Post date: [March 8, 2021, 1:27pm UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/5 "2021-03-08T13:27:30Z")

</div>

Thank you very much for your help!

Is it possible by paraview to take slices and export images accordingly, then I will have my “slices” folder which I could construct into a single .tif using imageJ?  
Same way to get “slices” from tomography reconstruction.  
If yes I would really appreciate if you give me the main points on how to do that.

Thank you!!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 8, 2021, 1:28pm UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/6 "2021-03-08T13:28:05Z")

</div>

Slice filter should do the trick.

---

<div class="post-metadata">

### Author: ![aabdallah](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@aabdallah](https://discourse.paraview.org/u/aabdallah)
#### Post date: [March 8, 2021, 1:35pm UTC](https://discourse.paraview.org/t/convert-a-vtk-to-a-3d-voxel-based-image/6629/7 "2021-03-08T13:35:55Z")

</div>

Thanks boss!
