How to set clipping method of vtkMRMLClipModelsNode


As the title suggests, I’m having trouble finding the right way to programmatically set the clipping method of vtkMRMLClipModelsNode. Code snippet to demonstrate issue:

clipModelNode = slicer.util.getFirstNodeByClassByName('vtkMRMLClipModelsNode', 'ClipModels')
clipModelNode.SetClipType(clipModelNode.ClipIntersection) # works fine
clipModelNode.SetRedSliceClipState(clipModelNode.ClipOff) # works fine
clipModelNode.SetYellowSliceClipState(clipModelNode.ClipPositiveSpace) # works fine
clipModelNode.SetGreenSliceClipState(clipModelNode.ClipNegativeSpace) # works fine
clipModelNode.SetClippingMethod # no attribute error

Any suggestions would be greatly appreciated.

Thank you.

Good catch, the method was not Python-wrapped due to an incorrectly defined enumerated type. The problem is fixed now: BUG: Fix Python wrapping of methods using enum arguments by lassoan · Pull Request #6935 · Slicer/Slicer · GitHub

The SetClippingMethod will be available in Slicer Preview Release downloaded on 2023-04-12 or later.

1 Like

Awesome, thank you for the quick fix!