How to create vtkUnstructuredGrid from an itk::Image?


I have binary label files in itk::Image. I have gone through a few examples in ITK and VTK. What I understood, we need to create the cell type object for generating a specific mesh in both ITK and Vtk. For example, I need to generate a tetrahedron mesh, and I need to choose typedef MeshType::CellType CellType; in which CellType can be various type of cells.

In VTK, there is an example that they create the mesh cells. However, I do not how to connect the data types between itk and vtk.

How can I create the mesh from itk::Image and from that generate vtkUnstructuredGrid?
Is there any example available to show some tips and tricks?


The answer mostly depends on what you are trying to accomplish. Generally, some classes from ITKVtkGlue could help.

The ITKVtkGlue external module in particular has a class with this functionality:

i.e. itk::MeshToVTKUnstructuredGridFilter.

1 Like

Is it like that, I need to follow the following transformation:

itk::Image ==> create the point sets (link) ==> generate the tetrahedron mesh from the point sets and save as an vtkunstructuredGrid ( MakeTetrahedron() function in this link)

Is this procedure correct?

Thanks for your comment,

I do not know what is the procedure for creating the tetrahedron mesh first. Then I can use the itk::MeshToVTKUnstructuredGridFilter .

You might need BinaryMask3DMeshSource as the first step.

1 Like