Hi,
I am trying to use Python to generate screen-recorded videos of actions in Slicer. I am trying to do so by initializing a sequence browser and recording the main 3D view of ‘Camera’ in Python. I can do it manually, but would like to do it all programmatically.
I am stuck on how to set the main 3D-view camera to be the proxy node for the sequence browser.
Here is what I have so far:
# create a new sequence browser node
newSequenceBrowserNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSequenceBrowserNode', 'MySBN')
# create a new sequence node
newSequenceNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSequenceNode', 'Seq1')
# pair the sequence browser node and the sequence node
newSequenceBrowserNode.SetAndObserveMasterSequenceNodeID(newSequenceNode.GetID())
# enable recording
newSequenceBrowserNode.SetRecording(newSequenceNode,True)
*** [somehow set the proxy node] ***
# start recording
newSequenceBrowserNode.RecordingActiveOn()
# perform operations that will be recorded
...
# stop recording
newSequenceBrowserNode.RecordingActiveOff()
# use screen capture module to save as video
...
I am able to get the cameraNode, but am unable to set it as the proxy node from which information will be recorded.
layoutManager = slicer.app.layoutManager()
view = layoutManager.threeDWidget(0).threeDView()
threeDViewNode = view.mrmlViewNode()
cameraNode = slicer.modules.cameras.logic().GetViewActiveCameraNode(threeDViewNode)
Any help will be greatly appreciated!