Dynamic Modeler Module with python?

Slicer: 4.11.0-2020-07-04 r29204 Win10

I want to use Dynamic Modeler Module Plane Cut tool (and others) with python. Is there any documentation published?


No documentation pages have been published yet, although one should probably be created.

You can display all of the input node references for a tool using the following:

planeCutTool = slicer.vtkSlicerDynamicModelerPlaneCutTool()
for i in range(planeCutTool.GetNumberOfInputNodes()):

The node references can be used to create a dynamic modeler node:

dynamicModelerNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLDynamicModelerNode")
dynamicModelerNode.SetToolName("Plane cut")
dynamicModelerNode.SetNodeReferenceID("PlaneCut.InputModel", inputmodelNode.GetID())
dynamicModelerNode.SetNodeReferenceID("PlaneCut.InputPlane", inputPlaneNode.GetID())
dynamicModelerNode.SetNodeReferenceID("PlaneCut.OutputPositiveModel", outputModel.GetID())
1 Like

Thanks so much @Sunderlandkyl.
Just a bit more info:

  • I need to add more than one InputPlane
  • I should like to look around with Parameters (Operation Type)

Thanks on advance!

Sure, then you can use:

  • AddNodeReferenceID instead of SetNodeReferenceID for the plane node
  • SetAttribute(“OperationType”, type), where type is “Union”, “Intersection”, or “Difference”.
1 Like

It works like a charm, wonderfull.

@Sunderlandkyl could you add these to the documentation in header files? Thank you!

1 Like