Make clipping to be separate module

@pieper @lassoan @chir.set i posted earlier about clipping to be separate module or be much more accessible . its an amazing feature that’s so hard to use . since i accidently discovered it i use it all the time . toggling on and off from segmentation menu is time consuming

please consider this .

Adding a separate module would mean that you need to switch away from the current module (Models, Segmentations, Volume rendering, etc.). It would make the feature a bit less accessible (you would need to do several clicks instead of just scroll down in the module GUI).

Could you describe how you use clipping and how do you think it could be made simpler?

thank you for reply .

i do lots of surgery planning measurement in slicer , despite having the best software for planning . i still find slicer the most accurate and versatile .

when meausreing , i like to split mandibles into halves . allow much better visulaizarion .

i also clip to see condyles in 3d clipped in mid fossa which is great view for clinical correlations .

i can see many uses for it in the future cases

it doesn’t have to be a module , it cant be toggled on and off at least from slice view or 3d view similar to slice interaction tab . or from drop menu in the slice .

another way is to make it like to markup tool . once tab is pressed a tool bar is shown . toggling and slice selection is accessible .

i think it deserve its place in the drop menu or right click for toggling it on and off.

i still think making it a module on its own is great to configure it quickly and full interaction .

Would a Clipping menu item in the Subject Hierarchy tree’s visibility menu help?

However, you may find that adding a direct keyboard shortcut that toggles all clipping on/off works better. To get that, you can copy-paste this code snippet into the Python console:

def toggleClipping():
    if hasattr(slicer, 'clippedDisplayNodes'):
        # Restore clipped state of nodes
        for displayNode in slicer.clippedDisplayNodes:
            displayNode.ClippingOn()
        del slicer.clippedDisplayNodes
    else:
        # Save clipped state of nodes and then disable clipping
        slicer.clippedDisplayNodes = []
        displayNodes = slicer.util.getNodesByClass("vtkMRMLDisplayNode")
        for displayNode in displayNodes:
            if displayNode.GetClipping():
                slicer.clippedDisplayNodes.append(displayNode)
                displayNode.ClippingOff()

shortcut = qt.QShortcut(slicer.util.mainWindow())
shortcut.setKey(qt.QKeySequence("Ctrl+R"))
shortcut.connect("activated()", toggleClipping)

After this you can use Ctrl-R to toggle all clipping in the scene. You can add this code snippet to your application startup file to make the keyboard shortcut persistent.