Create Axes Model using CreateModels CLI

Hi all,

I trying to create a coordinate system model using CreateModels CLI called from a Python terminal. I tried the followings code (inspired from vtkSlicerCreateModelsLogic.h) but I could not guess what are the exact input/output parameters to give to the cli.

modelNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLModelNode')
param = {'axisLength':20.0, 'axisRadius':2.0, 'modelNodeToUpdate':modelNode} slicer.modules.createmodels, 'CreateCoordinate', None, param, wait_for_completion=True )

Where can I find the documentation showing the input/output parameters of the createmodels CLI module (and to any given CLI module in general)?


1 Like

It is not a CLI module but a loadable module. You can verify that by printing the module’s class name:

>>> slicer.modules.createmodels.className()

You can use loadable modules by calling methods of their logic class:

logic = slicer.modules.createmodels.logic()

To get a description of all methods and their parameters, type help(logic) and you get a description like this:

class vtkSlicerCreateModelsLogic(vtkSlicerModuleLogic)
 |  vtkSlicerCreateModelsLogic - slicer logic class for creating simple
 |  models
 |  Superclass: vtkSlicerModuleLogic
 |  This class contains methods that create model nodes useful for
 |  setting up IGT scenes. These methods can be called from other
 |  modules.
 |  Methods defined here:
 |  CreateCoordinate(...)
 |      V.CreateCoordinate(float, float, vtkMRMLModelNode)
 |          -> vtkMRMLModelNode
 |      C++: vtkMRMLModelNode *CreateCoordinate(double axisLength,
 |          double axisRadius, vtkMRMLModelNode *modelNodeToUpdate=NULL)
 |  CreateCube(...)
 |      V.CreateCube(float, float, float, vtkMRMLModelNode)
 |          -> vtkMRMLModelNode
 |      C++: vtkMRMLModelNode *CreateCube(double x, double y, double z,
 |          vtkMRMLModelNode *modelNodeToUpdate=NULL)
 |  CreateCylinder(...)
 |      V.CreateCylinder(float, float, vtkMRMLModelNode)
 |          -> vtkMRMLModelNode
 |      C++: vtkMRMLModelNode *CreateCylinder(double height,
 |          double radius, vtkMRMLModelNode *modelNodeToUpdate=NULL)
 |  CreateNeedle(...)
 |      V.CreateNeedle(float, float, float, bool, vtkMRMLModelNode)
 |          -> vtkMRMLModelNode
 |      C++: vtkMRMLModelNode *CreateNeedle(double length, double radius,
 |          double tipRadius, bool markers,
 |          vtkMRMLModelNode *modelNodeToUpdate=NULL)
 |  CreateSphere(...)
 |      V.CreateSphere(float, vtkMRMLModelNode) -> vtkMRMLModelNode
 |      C++: vtkMRMLModelNode *CreateSphere(double radius,
 |          vtkMRMLModelNode *modelNodeToUpdate=NULL)

Perfect. I’ll try that tomorrow.

Thanks Andras