Show slice edges in 3D view

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
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:

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

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?

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.

1 Like

I like it too.

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

Ron

1 Like

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.