Hello,
I am writing a CLI module and would like to have a model as an input to then use it as vtkPolyData. I have checked the provided example and inspected some of the C++ modules taking a model as input, for example ModelToLabelMap but it is still unclear to me how to do it.
I am trying some code resembling the C++ code but it is not working because ReadData cannot read the ModelNode:
modelNode = slicer.vtkMRMLModelNode()
modelStorageNode = slicer.vtkMRMLModelStorageNode()
modelStorageNode.SetFileName(sys.argv[1]) # sys.argv[1] is the input model provided by the GUI
modelNode = modelStorageNode.ReadData(modelNode)
polyModel = modelNode.getPolyData()
I have two questions:
- How can this be achieved in Python? (Apologies if this is obvious, I am just getting started with Slicer).
- what is the best way of practically developing a CLI module autogenerated GUI? Currently I am finding myself restarting Slicer every time I modify the GUI xml.
Thank you for any insight,
Luca