# How to use vtkImageReslice for vtkUnstructuredGrid

**URL:** https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847
**Category:** Support
**Created:** [July 24, 2020, 7:59am UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847 "2020-07-24T07:59:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![aldis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aldis/32/2136_2.png) [@aldis](https://discourse.vtk.org/u/aldis)
#### Post date: [July 24, 2020, 7:59am UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/1 "2020-07-24T07:59:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [July 24, 2020, 3:57pm UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/2 "2020-07-24T15:57:42Z")

</div>

`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/](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.

---

<div class="post-metadata">

### Author: ![aldis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aldis/32/2136_2.png) [@aldis](https://discourse.vtk.org/u/aldis)
#### Post date: [July 31, 2020, 5:47am UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/3 "2020-07-31T05:47:37Z")

</div>

Thank you for your answer.When I use vtkcutter, once I update him, he will have a segfault.Hope you can help me.

---

<div class="post-metadata">

### Author: ![aldis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aldis/32/2136_2.png) [@aldis](https://discourse.vtk.org/u/aldis)
#### Post date: [July 31, 2020, 5:49am UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/4 "2020-07-31T05:49:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [July 31, 2020, 2:35pm UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/5 "2020-07-31T14:35:39Z")

</div>

Sorry, but you have not provided nearly enough information to provide any help. Sharing your code would be very helpful.

---

<div class="post-metadata">

### Author: ![aldis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aldis/32/2136_2.png) [@aldis](https://discourse.vtk.org/u/aldis)
#### Post date: [August 1, 2020, 5:56am UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/6 "2020-08-01T05:56:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [August 3, 2020, 2:23pm UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/7 "2020-08-03T14:23:25Z")

</div>

I don’t see anything obviously wrong in the code. Could you provide a stack trace where the program crashes?

---

<div class="post-metadata">

### Author: ![aldis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aldis/32/2136_2.png) [@aldis](https://discourse.vtk.org/u/aldis)
#### Post date: [August 5, 2020, 2:16am UTC](https://discourse.vtk.org/t/how-to-use-vtkimagereslice-for-vtkunstructuredgrid/3847/8 "2020-08-05T02:16:14Z")

</div>

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
