I use vtkSurfaceDataSetFilter to convert UnStrcuturedGrid Data to PolyData,then transfer the converted data into the method I wrote according to the PolyDataToImageData provided by VTK.
the main function:
vtkSmartPointer<vtkUnstructuredGridReader> reader = vtkSmartPointer<vtkUnstructuredGridReader>::New();
reader->SetFileName(filename.c_str());
reader->Update();
surrfaceFliter->SetInputConnection(reader->GetOutputPort());
vtkSmartPointer<vtkImageData> imageData = vtkSmartPointer<vtkImageData>::New();
vtkSmartPointer<vtkPolyData> pData = vtkSmartPointer<vtkPolyData>::New();
pData = geometryFilter->GetOutput();
vtkPolyData* polydata = surrfaceFliter->GetOutput();
imageData = polyDataToImageData(polydata);
Here is the polyDataToImageData(),and I encountered the following error on the terminal.
I hope someone can provide some suggestions or ideas,thanks!