# How to show the position of slices？

**URL:** https://discourse.vtk.org/t/how-to-show-the-position-of-slices/8298
**Category:** Web
**Created:** [April 14, 2022, 9:07am UTC](https://discourse.vtk.org/t/how-to-show-the-position-of-slices/8298 "2022-04-14T09:07:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![zhangzhi93](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhangzhi93/32/4954_2.png) [@zhangzhi93](https://discourse.vtk.org/u/zhangzhi93)
#### Post date: [April 14, 2022, 9:07am UTC](https://discourse.vtk.org/t/how-to-show-the-position-of-slices/8298/1 "2022-04-14T09:07:40Z")

</div>

![image](https://discourse.vtk.org/uploads/default/original/2X/d/d3e2ff85a07ad975e53dbcd6f1068d55b2d372eb.jpeg)

I want to achieve this effect that can display the position of i,j,k slices in real time. But the example found is written in python, my main language is JavaScript, and by looking at the source code of this python example, I found that it uses the api of SliceRepresentationProxy. But the official documentation does not have an example of using this api. May I ask how to achieve this effect?

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [April 14, 2022, 4:00pm UTC](https://discourse.vtk.org/t/how-to-show-the-position-of-slices/8298/2 "2022-04-14T16:00:27Z")

</div>

If you can do volume rendering and slice rendering independently, you are mostly there. Just add all the actors into the same renderer/renderWindow.

---

<div class="post-metadata">

### Author: ![zhangzhi93](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhangzhi93/32/4954_2.png) [@zhangzhi93](https://discourse.vtk.org/u/zhangzhi93)
#### Post date: [May 10, 2022, 9:04am UTC](https://discourse.vtk.org/t/how-to-show-the-position-of-slices/8298/3 "2022-05-10T09:04:29Z")

</div>

Hello, I tried to use vtkCutter to achieve the effect of displaying the slice position in the volume, but when I use the vtkOutlineFilter of the image, the code will report an error. In the official example, vtkCubeSource is used.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/4c0bce1d54d450c017935fbe199757ebd4aa0369.png)  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/bf61bfd8e417366d4419193574c3131717b42e71.png)

## Another problem

I try to get the plane instance of the slice through the vtkResliceCursorWidget instance, by using the getPlaneSourceFromViewType method. But after I add the actor, only one line is shown, why is that?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/f/fc99b0793188f3e893d0b3ed6dea43d1f5a0ab99.png)

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 10, 2022, 2:14pm UTC](https://discourse.vtk.org/t/how-to-show-the-position-of-slices/8298/4 "2022-05-10T14:14:09Z")

</div>

The current version of vtkCutter is probably only trying to cut Polygons and fails when they are missing. Cutting the outline should result in 4 points or less. I don’t think that’s what you are trying to do…

I don’t know anything on `vtkResliceCursorWidget` so I’ll skip the second problem.
