Dear VTK team,
I read the vtkUnstructuredGrid data from a file, and now I want to use vtkImageReslice to slice and extract it, but I did not find an example of how to use it. I hope Kind people can help me.
Dear VTK team,
vtImageReslice works on
vtkImageData, but it does not work on
vtkUnstructuredGrid data. You’ll want to use
vtkCutter instead. See https://ajpmaclean.github.io/web-test/site/Cxx/VisualizationAlgorithms/CutStructuredGrid/ for an example. It shows cutting a structured grid, but it should work for your
vtkUnstructuredGrid as well.
Thank you for your answer.When I use vtkcutter, once I update him, he will have a segfault.Hope you can help me.
Thank you for your answer.When I use vtkcutter, once I update him, he will have a segfault.Hope you can help me.thank you very much
Sorry, but you have not provided nearly enough information to provide any help. Sharing your code would be very helpful.
My code is as follows
vtkSmartPointer<vtkUnstructuredGrid> uids =input_data();
/*I set my own settings to read the vtkunstructedgrid function, which can be displayed normally through mapper */
vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New(); plane->SetOrigin(0,0,0); plane->SetNormal(1,0,0); vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New(); cutter->SetInputData(0,uids); cutter->GenerateCutScalarsOff(); cutter->SetCutFunction(plane); cutter->Update();//An error occurred when running to this point vtkSmartPointer<vtkDataSetMapper>mappers=vtkSmartPointer<vtkDataSetMapper>::New(); mappers->SetInputData(uids); mappers->AddClippingPlane(plane); vtkSmartPointer<vtkActor> actor1 = vtkSmartPointer<vtkActor>::New(); actor1->SetMapper(mappers); vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New(); ren->AddActor(actor1); vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New(); renWin->AddRenderer(ren); vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New(); iren->SetRenderWindow(renWin); renWin->Render(); iren->Start();
I hope you can help me，Thank you very much.
I don’t see anything obviously wrong in the code. Could you provide a stack trace where the program crashes?
Thank you very much for your help. Now I have found out the reason is because of the problem of my data. At present, the modified data can realize the column. Thanks