Programmatically controlling extensions via separate scripted extension

ruffsl
Thu, 21 Aug 2025 01:19:43 +0000
Support

Is it possible to programmatically control the state of other 3D Slicer extensions via my own scripted extension using the python API? Such as trigger UI events or update their internal state?

E.g: when restoring Slicer from a saved MRML Scene, some extensions need manual prodding to resume operation, such as SlicerOpenIGTLink when activating an existing connection:

github.com/openigtlink/SlicerOpenIGTLink

OpenIGTLinkIF/Widgets/Resources/UI/qSlicerIGTLConnectorPropertyWidget.ui

f806007cc

81. <widget class="QCheckBox" name="ConnectorStateCheckBox">


82.  <property name="text">


83.   <string>Active</string>

Or with SlicerIGT to enable Bullseye View Mode for multiple Scene Cameras:

github.com/SlicerIGT/SlicerIGT

Viewpoint/Viewpoint.py

cc9678a9b

64. self.toggleBullseyeButtonTextState0 = _("Enable Bullseye View Mode")


65. self.toggleBullseyeButtonTextState1 = _("Disable Bullseye View Mode")

Rather than necessitating the user to navigate to there respective extension panels and enable these function after startup, I’d like to script a simple one click button to resume these behaviors.

It also seems that the Vewpoint extension included in SlicerIGT doesn’t save all its own settings with the MRML Scene, so I’d like to re-initialize those camera control parameters as well.

I’m guessing I could rewrite these IGT features internal to my own extension, but I’d prefer to reuse the existing extensions for simpler user control override and existing interactive workflows.

4 posts - 2 participants