# Show slice edges in 3D view

**URL:** https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381
**Category:** Feature requests
**Created:** [May 1, 2020, 7:14pm UTC](https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381 "2020-05-01T19:14:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 1, 2020, 7:14pm UTC](https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381/1 "2020-05-01T19:14:58Z")

</div>

Most medical image viewer software uses color coding to make it easier to distinguish slices in 3D views. It would not be hard to do (you can try by copy-pasting a few lines of code into the Python console).

> **Code snippet to show slice edges**
>
> ```python
> for sliceNode in getNodesByClass("vtkMRMLSliceNode"):
> sliceLogic = slicer.app.applicationLogic().GetSliceLogic(sliceNode)
> displayNode = sliceLogic.GetSliceModelNode().GetDisplayNode()
> displayNode.SetEdgeColor(sliceNode.GetLayoutColor())
> displayNode.SetEdgeVisibility(True)
> displayNode.SetLineWidth(3)
> 
> ```

Should we do it, too?

My concern would be that it may make the views a bit too busy:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/1/c1a672ba2b6f39a766975b4a5550c2296940b1db.jpeg)

It might be particularly confusing when the displayed image is smaller than the frame (this happens most of the case):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/d/9d85d37cf479516c564217d415f201f41dd67b69.jpeg)

It could be possible to set the boundary of the slice view to match the background volume boundaries, but it would be a bit more work and could be a bit confusing when we display other content, such as markups or segmentations (which are displayed over the entire slice, not over only the background volume).

**Should we show slice view edges in 3D views?**

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [May 1, 2020, 7:48pm UTC](https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381/2 "2020-05-01T19:48:51Z")

</div>

I like it. Perhaps they could be something like 30% opacity so they aren’t so busy. We would just need to add a `SetEdgeOpacity` method to the display node and tweak the displayable manager. Of course once we can see them it would also be tempting to make the widgets so you could manipulate the slices from the 3D view.

---

<div class="post-metadata">

### Author: ![rkikinis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rkikinis/32/791_2.png) [@rkikinis](https://discourse.slicer.org/u/rkikinis)
#### Post date: [May 1, 2020, 8:10pm UTC](https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381/3 "2020-05-01T20:10:12Z")

</div>

I like it too.

How about adding the ability to turn them on and off from the control panel of the slice viewer.

Ron

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 1, 2020, 8:42pm UTC](https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381/4 "2020-05-01T20:42:15Z")

</div>

> [@pieper](#):
>
> Of course once we can see them it would also be tempting to make the widgets so you could manipulate the slices from the 3D view

I had the same temptation, too. It would make sense, we could move it, maybe rotate it, have a right-click menu to hide it, etc. Unfortunately, it would be quite a bit of more work.

---

<div class="post-metadata">

### Author: ![Davide\_Punzo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/davide_punzo/32/66104_2.png) [@Davide\_Punzo](https://discourse.slicer.org/u/Davide_Punzo)
#### Post date: [October 25, 2024, 9:32am UTC](https://discourse.slicer.org/t/show-slice-edges-in-3d-view/11381/5 "2024-10-25T09:32:02Z")

</div>

PR [ENH: Add option to display slice edges in 3D view by Punzo · Pull Request #8008 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/8008) address this feature. Feedback would be very welcome 🙂, thanks!
