Thanks for good pointers!
Is there discovery process to inspect what parameter nodes are available through MRML?
I.e. is there an option for Slicer to show what node my mouse is hovering over or interacting with?
I looked for anything related to SlicerOpenIGTLink
or just IGT
, and found:
>>> nodes = slicer.mrmlScene.GetNodes()
>>> for node in nodes:
print(node)
...
vtkMRMLCrosshairNode (0x35d0b5f0)
ID: vtkMRMLCrosshairNodedefault
ClassName: vtkMRMLCrosshairNode
Name: Crosshair
...
>>> node = slicer.mrmlScene.GetFirstNodeByName('IGTLConnector')
>>> print(node)
vtkMRMLIGTLConnectorNode (0x3cf120d0)
ID: vtkMRMLIGTLConnectorNode1
ClassName: vtkMRMLIGTLConnectorNode
Name: IGTLConnector
Debug: false
MTime: 439420
Description: (none)
SingletonTag: (none)
HideFromEditors: false
Selectable: true
Selected: false
UndoEnabled: false
Node references:
incoming [incomingNodeRef]: vtkMRMLLinearTransformNode4 vtkMRMLLinearTransformNode5
outgoing [outgoingNodeRef]: (none)
Connector Type: CLIENT
Server Hostname: localhost
Server Port #: 18944
State: CONNECTED
Persistent: 0
Restrict Device Name: 0
Push Outgoing Message Flag: 0
Check CRC: 1
Number of outgoing nodes: 0
Number of incoming nodes: 2
After using the internal python console as a REPEL, I found a working stop and start function:
>>> node.Stop()
1
>>> node.Start()
1
[VTK] Connector is already running!
But where is this node interface documented or define in an extension codebase?
Simply the header?
but usually you can import the module and access the Logic classes.
Is that still feasible for a scripted extension when attempting to control a C++ extension?
In any case, I think I may have to do that for the ViewpointInstance
class, as the extension is scripted, however I can’t find it among the MRML nodes while the Viewpoint extension is loaded and running.
>>> nodes = slicer.mrmlScene.GetNodes()
>>> for node in nodes:
if 'viewpoint' in node.GetName().lower():
print(node)
>>>
How should I go about getting a object handle for this extension class?
If the module doesn’t expose parameter nodes or logic methods you can technically access the GUI but it’s not the way we like to do things.
Understood. Although as a last resort, what would that look like in C++ & Python for example?
If you are working on a longer term project you might propose changes to the modules you are using to have them expose the functionality you need.
Know of any reference PRs I could look at as an example? I’m still learning Slicer’s APIs and extension code layouts. Simply classes with a public vtkMRMLNode
interface?
In the short term, I’d also be fine with something like equivalent of an HTML iframe for QTM, where our custom extension could just render parts of another extension UI within its own pannel.