Extract Voxel Information From vtkVoxelModeller

Hey at all,

i’m new here and i don’t know if this is the right place for my question. But i googled now for several days and can’t find a solution. So i’m stuck without help …

My task is to (3D)-voxel a simple mesh and get the (x,y,z)-coordinates of all 8 vertices of all of the (3D)-voxels.

So a function like:
for voxel in vtkVoxelModeller:
for vertices in voxel:
return the (x,y,z)-coords of the vertex

Does someone has an idea on how to achiev this.
The workflow until voxel is no problem and marching cubes with the voxels also works. But i cant find the coords of the voxels …

We usually convert surface meshes (vtkPolyData) to volumes (vtkImageData) using vtkPolyDataToImageStencil (see implementation for example here).

Marching cubes (or the current faster version, fliyng edge filter) converts volume to surface mesh. You can get point coordinates from vtkPolyData using polydata->GetPoints()->GetPoint(n).

Hey @lassoan,
thanks for your answer, but unfortunately the answer does not solve my problem.

So as you proposed i converted the surface mesh to a volume mesh. With this volume mesh i can also make the voxelisation. But as I said i need the (x,y,z)-coordinates of all 8 vertices of all of the (3D)-voxels which get generated. It’s not important if it’s a voxeled mesh or a voxeled volume.

The problem with marching cubes is that i can only get a surface mesh of a smoothed surface. But i need the 8 edges of every voxel …

Does someone have an idea?

For binary image input you will get a “voxelized” (not smoothed) surface. You may also use the discrete version of marching cubes / flying edges to enforce this or vtkThreshold+vtkGeometryFilter (as in cubes example).