Insert sequence Browser Toolbar in a python module

Hello!

I am trying to develop a python scripted module using Sequences extension. I already successfully create a sequence (although it appears as a vtkMRMLScalarVolumeNode) and I can display the sequence by using the Sequence Browser Toolbar of 3D slicer 4.11.

I want to insert the sequence browser toolbar in my own module but it does not activate when the sequence is created.

Can you explained me what is missing or what is wrong in my code please? Thank you!

self.sequenceBrowserToolbarButton = slicer.qMRMLSequenceBrowserToolBar()
fourDCTFormLayout.addRow(self.sequenceBrowserToolbarButton)

self.sequenceBrowserToolbarButton.connect('activeBrowserNodeChanged(vtkMRMLNode*)', self.oncreateSequenceButton)

def oncreateSequenceButton(self):
    exitString = logic.createSequence(patient.fourDCT)

    if exitString:
      self.qtMessage(exitString)
      return

MRML widgets such as qMRMLSequenceBrowserToolBar in this case require that the MRML scene be set.


self.sequenceBrowserToolbarButton.setMRMLScene(slicer.mrmlScene)
1 Like

Thank you it worked! Another question: Is it possible to change the width of the widget?

There are various methods for manipulating a QWidget’s size which you can review at https://doc.qt.io/qt-5/qwidget.html

2 Likes