Created
June 11, 2020 19:28
-
-
Save cpinter/8a1f71c7eb3ef0ebcaa6c1be6e1c9d4a to your computer and use it in GitHub Desktop.
Set volume rendering preset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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