Convert Itk Mesh to VtK Polydata

Hello,

Is there a way to convert ITKMesh to vtkpolydata? I see ITKMeshToPolyData, but that converts ITKMesh to ITKPolydata.

Hi @NahomKidane ,

itk::PolyData is compatible with vtkPolyData.

@matt.mccormick Thank you for the quick reply. Not sure if I am missing something but I didn’t see an example were we change it to vtkpolydata.

using FilterType = itk::MeshToPolyDataFilter< MeshType >;
FilterType::Pointer filter = FilterType::New();
filter->SetInput(meshReader->GetOutput());
filter->Update()

using PolyDataType = FilterType::PolyDataType;
PolyDataType::ConstPointer polyData = filter->GetOutput();
using PolyDataType = FilterType::PolyDataType;

// How would i change it vtkpolydata?
vtkSmartPointer converted = vtkSmartPointer::New();
convertedSurface = polyData;

Hi @matt.mccormick,

Could you give me some idea on how to convert from itk::PolyData to vtkPolyData? Sorry, I not sure how to go about this.

Thank you!

Hi @NahomKidane ,

Yes! Here is an example:

1 Like

@matt.mccormick Thank you!

1 Like