Skip to content

Instantly share code, notes, and snippets.

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')
# Make sure the proper volume property node is set
volumePropertyNode = presetsCombobox.mrmlVolumePropertyNode()
if volumePropertyNode is None:
logging.error('Failed to access volume properties')
volumePropertyNodeWidget = slicer.util.findChild(volRenWidget, 'VolumePropertyNodeWidget')
# 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