ITK image to mesh to vtk polydata

Dear all,

Recently I am trying to extract the surface geometry from a binary ITK image (resulting from ostu_threshold_image_filter) into ITK mesh. Then convert this ITK MESH to a vtk polydata.

The filters I used include BinaryThresholdImageFilter, BinaryMask3DMeshSource and MeshToPolyDataFilter. I program in python. The result turns out to be of type itk.itkPolyDataPython.itkPolyDataF instead of expected vtkPolyData.

Moreover, I am not sure the result of BinaryMask3DMeshSource output a triangle mesh. Could anyone kindly provide some advise?

Appreciate.

Thanks,

ITK’s mesh infrastructure is still quite far behind VTK (similarly how VTK’s image processing capabilities are much more limited compared to ITK), so I would recommend to use VTK for mesh processing and ITK for image processing. I don’t think there is a functional ITK-VTK glue package available for Python, so if you would want to pass data between ITK and VTK then you may need to write/read files or implement serialization to/from numpy arrays (but check with Kitware folks before you invest too much time into implementing numpy serialization, as maybe there is already some ongoing effort that you can join).

Anyway, most likely you won’t need to implement low-level features from scratch. All the features that you described (and much more sophisticated segmentation methods) are already all conveniently available in segmentations infrastructure and in segment editor effects. You can access these features via GUI (Segmentations and Segment Editor module) or from Python scripting (see script repository for examples).

Thanks for your reply.

I work around by writing/reading files between ITK/VTK meshes.