Markups Node Table for vtkMRMLMarkupsLineNode

Hello Slicer Community,

I’m trying to include a module where annotators can draw major and minor axes on brain images. I found that the vtkMRMLMarkupsLineNode does just the job. In Slicer 4.11 (not sure about previous versions), there is a table widget (perhaps a QTableView ?) that keeps track of all of the vtkMRMLMarkupsLineNodes (see screenshot below). I’d like to take this widget and import it in my module, but I cannot find it in any parent widget or modules accessible through python.

image

Ideally, what I would like is to get the different markup buttons (create fiducial, create line, create curve, etc.) as well as the table underneath (with columns Node, Description, Visible, Color). I don’t need to get the collapsable Display or Control Points Widgets.

Thanks for any guidance.
Best,
Eric

The table widget is a qMRMLSubjectHierarchyTreeView. The buttons above are just simple QPushButtons. You can open Qt Designer and just drag-and-drop these widgets into your module GUI.

For the future, you can find instructions here how to find implementation of a feature that you see on the Slicer GUI here.

Hi Andras,

Thanks for this tip!
While looking around a bit more, I found a way to access the Markups widget and am able to get everything I need

slicer.modules.markups.widgetRepresentation().children()

(QVBoxLayout (QVBoxLayout at: 0x000001C2B981D5C0), QLabel(0x1c2d23aa960, name="createLabel") , QPushButton(0x1c2d23ab0e0, name="createFiducialPushButton") , QPushButton(0x1c2d23aa2e0, name="createLinePushButton") , QPushButton(0x1c2d23aaca0, name="createAnglePushButton") , QPushButton(0x1c2d23aaa20, name="createOpenCurvePushButton") , QPushButton(0x1c2d23aa5e0, name="createClosedCurvePushButton") , ctkExpandableWidget(0x1c2d23aa620, name="ResizableFrame") , qMRMLCollapsibleButton(0x1c2d23acaa0, name="CollapsibleGroupBox") , ctkCollapsibleButton(0x1c2d2390de0, name="controlPointsCollapsibleButton") , ctkCollapsibleButton(0x1c2d3404090, name="resampleCurveCollapsibleButton") , QAction(0x1c2d391da50 text="Cut" toolTip="Cut" shortcut=QKeySequence("Ctrl+X") menuRole=TextHeuristicRole visible=true) , QAction(0x1c2d391de10 text="Copy" toolTip="Copy" shortcut=QKeySequence("Ctrl+C") menuRole=TextHeuristicRole visible=true) , QAction(0x1c2d391df70 text="Paste" toolTip="Paste" shortcut=QKeySequence("Ctrl+V") menuRole=TextHeuristicRole visible=true) )

Thanks!

1 Like