Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set volume rendering preset
def setPresetOffset(self, x, y, dontMoveFirstLast, presetsCombobox):
volRenWidget = slicer.modules.volumerendering.widgetRepresentation()
if volRenWidget is None:
logging.error('Failed to access volume rendering module')
return
# Make sure the proper volume property node is set
volumePropertyNode = presetsCombobox.mrmlVolumePropertyNode()
if volumePropertyNode is None:
logging.error('Failed to access volume properties')
return
volumePropertyNodeWidget = slicer.util.findChild(volRenWidget, 'VolumePropertyNodeWidget')
volumePropertyNodeWidget.setMRMLVolumePropertyNode(volumePropertyNode)
# Adjust the transfer function
volumePropertyNodeWidget.moveAllPoints(x, y, dontMoveFirstLast)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment