Get individual control point from a combobox in a scripted module

How to select an individual control point from a combobox?

I attempted to do this by a qMRMLNodeComboBox, with its node type as “vtkMRMLMarkupsFiducialNode”. This can only allow selecting a node which contains multiple control points (or fiducials, I am not sure what to call it in Slicer’s term). Looking at the documentation, I don’t think there is a node type “vtkControlPoint” or something like this. Slicer: vtkMRMLDisplayableNode Class Reference

You can use the qSlicerSimpleMarkupsWidget to show a list of markup control points that the user can choose from. If you don’t need a node selector or adjust options then you can hide those parts.

w = slicer.qSlicerSimpleMarkupsWidget()
w.setMRMLScene(slicer.mrmlScene)
w.setCurrentNode(getNode('F'))
w.setNodeSelectorVisible(False)
w.setOptionsVisible(False)
w.show()

image

Thanks for the answer. I am using qSlicerSimpleMarkupsWidget as a display of the individual control points, but in addition to this, I also wanted to have an option where the user can select a point and get the coordinate in the backend (in the scripted module code), for some other processing.

I wonder what do you mean by “… the user can choose from”? Does it mean when the user click on the list, once one control point is highlighted as shown in your picture, it can be received in the backend?

One possible solution I am trying is to just have a generic combobox, and list a bunch of numbers to the total number of the elements in the markup array, but obviously this is not very “elegant”, as people may say…

You can connect the currentMarkupsControlPointSelectionChanged signal to a function in your module widget class to get notified when the user selects a control point.

1 Like

I see! Thanks a lot!