I tried adjusting the transfer function on a 3D volume by using the lines of code you mentioned here. However, I do not see any difference in the 3D volume. Can you help me out? What I did, is I loaded the volume, visualized it like you did in the example above, and used the following code:
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 = displayNode.GetVolumePropertyNode()
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, 0, false)