How to retrieve multiple Sequence browser names with python

Hi everyone,

I’m looking to retrieve every sequence browser names using python. Considering I have multiple sequence browser :
I would like to retrieve an array containing : SequenceBrowser_1, SequenceBrowser_2, etc
I’m not sure which API to use.

Thanks in advance!

Hi. You should use
nodes = slicer.util.getNodesByClass("vtkMRMLSequenceBrowserNode")

Please let me know if that works


Hi thank you for the quick reply, this works!

1 Like

I’ve been looking into the api of vtkMRMLSequenceBrowserNode,
I’m now trying to retrieve the sequence nodes associated with the sequence browser.
I want to retrieve ThorasicSeq_1_Scans and ThorasicSeq_1_Tracker, do you know a way to do it?

I’m able to retrieve ThorasicSeq_1_Scans by using GetMasterSequenceNode but how do I retrieve every sequence nodes of the current SequenceBrowser?

Here’s the information that I have when printing the sequence browser:
vtkMRMLSequenceBrowserNode (000001D310DB9640)
ID: vtkMRMLSequenceBrowserNode1
ClassName: vtkMRMLSequenceBrowserNode
Name: SequenceBrowser_1
Debug: false
MTime: 253532
Description: (none)
SingletonTag: (none)
HideFromEditors: false
Selectable: true
Selected: false
UndoEnabled: false
Node references:
dataNodeRef0: vtkMRMLScalarVolumeNode1
dataNodeRef1: vtkMRMLLinearTransformNode4
rootNodeRef0: (none)
rootNodeRef1: (none)
sequenceNodeRef0: vtkMRMLSequenceNode1
sequenceNodeRef1: vtkMRMLSequenceNode2
Playback active: false
Playback rate (fps): 10
Playback item skipping enabled: true
Playback looped: true
Selected item number: 95
Recording active: false
Recording on master modified only: false
Recording sampling mode: limitedToPlaybackFrameRate
Index display mode: [indexValue]
Index display format: %.2f
Sequence nodes:
Sequence: ThoracicSeq_1__Scans, Proxy: (none), Playback: 1, Recording: 1, OverwriteProxyName: 0, SaveChanges: 0
Sequence: ThoracicSeq_1__Tracker-ThoracicSeq_1__Tracker-Seq, Proxy: (none), Playback: 1, Recording: 1, OverwriteProxyName: 0, SaveChanges: 0

The function is GetSynchronizedSequenceNodes.
Slicer: vtkMRMLSequenceBrowserNode Class Reference

collection = vtk.vtkCollection()
sequenceBrowserNode.GetSynchronizedSequenceNodes(collection, True)
for i in range(collection.GetNumberOfItems()):
   sequenceNode = collection.GetItemAsObject(i)

Thank you! This works!

1 Like