# Can't display \`vtkCubeAxesActor2D\` in slice view

**URL:** <https://discourse.slicer.org/t/cant-display-vtkcubeaxesactor2d-in-slice-view/19583>\
**Category:** Development\
**Created:** [September 8, 2021, 7:27pm UTC](https://discourse.slicer.org/t/cant-display-vtkcubeaxesactor2d-in-slice-view/19583 "2021-09-08T19:27:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [September 8, 2021, 7:27pm UTC](https://discourse.slicer.org/t/cant-display-vtkcubeaxesactor2d-in-slice-view/19583/1 "2021-09-08T19:27:47Z")

</div>

Hi,

In an attempt to display `vtkCubeAxesActor2D` I use the code:

```python
# Get renderer and camera
layoutManager = slicer.app.layoutManager()
view = layoutManager.sliceWidget('Red').sliceView()
renderWindow = view.renderWindow()
renderers = renderWindow.GetRenderers()
renderer = renderers.GetItemAsObject(0)
camera = renderer.GetActiveCamera()

# Customize vtkCubeAxesActor2D
cubeAxesActor = vtk.vtkCubeAxesActor2D()
cubeAxesActor.SetBounds(-50, 50, -50, 50, -50, 50) # some boundary points
cubeAxesActor.SetCamera(camera)
cubeAxesActor.SetXAxisVisibility(1)
cubeAxesActor.SetYAxisVisibility(1)
cubeAxesActor.SetZAxisVisibility(1)
cubeAxesActor.SetVisibility(1)
renderer.AddActor(cubeAxesActor)

# Update views
slicer.util.forceRenderAllViews()

```

this snippet of code doesn’t show anything.

I look to the `vtkMRMLRulerDisplayableManager` source code and I feel that I pretty understand how `vtkMRMLRulerDisplayableManager` works but it uses `vtkAxisActor2D` instead.

There is a thing that I can’t understand: what is `layers` in slice view? Is slice view is represented by somehow overlapping square planes and there is foreground layer and background?

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [September 8, 2021, 9:53pm UTC](https://discourse.slicer.org/t/cant-display-vtkcubeaxesactor2d-in-slice-view/19583/2 "2021-09-08T21:53:38Z")

</div>

I just figured out that I should have used boundary in range from 0 to 1:

```python
cubeAxesActor.SetBounds(0.1, 0.9, 0.1, 0.9, 0.1, 0.9)

```

The question about slice’s layers is still actual…

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [September 8, 2021, 10:14pm UTC](https://discourse.slicer.org/t/cant-display-vtkcubeaxesactor2d-in-slice-view/19583/3 "2021-09-08T22:14:40Z")

</div>

Yes a slice view has layers including background volume, foreground volume and labelmap volume. This is why you can’t overlay say 4 volumes at once and see them all at the same time in the same slice viewer. See

[https://slicer.readthedocs.io/en/latest/user\_guide/user\_interface.html?highlight=background%20layer#slice-view](https://slicer.readthedocs.io/en/latest/user_guide/user_interface.html?highlight=background%20layer#slice-view)

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [September 9, 2021, 1:02pm UTC](https://discourse.slicer.org/t/cant-display-vtkcubeaxesactor2d-in-slice-view/19583/4 "2021-09-09T13:02:50Z")

</div>

Thank you for the hint. Probably I need some time to understand
