Created
October 14, 2022 14:50
-
-
Save sjh26/42500b8421ac2258c5c4454122c439f8 to your computer and use it in GitHub Desktop.
Example of volume rendering
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 toggleVolumeRenderVisibility(self, visible): | |
volumeNode = <volume node however you get it> | |
NodeCombo = slicer.util.findChild(self.volumerenderWidget, 'VolumeNodeComboBox') | |
VisibilityCheckBox = slicer.util.findChild(self.volumerenderWidget, 'VisibilityCheckBox') | |
volRenLogic = slicer.modules.volumerendering.logic() | |
if volumeNode is not NodeCombo.currentNode(): | |
displayNode = volRenLogic.CreateDefaultVolumeRenderingNodes(volumeNode) | |
displayNode.SetVisibility(visible) | |
displayNode.GetVolumePropertyNode().Copy(volRenLogic.GetPresetByName("CT-AAA")) | |
AutoReleaseGraphicsResourcesCheckBox = slicer.util.findChild(self.volumerenderWidget, 'AutoReleaseGraphicsResourcesCheckBox') | |
QualityControlComboBox = slicer.util.findChild(self.volumerenderWidget, 'QualityControlComboBox') | |
NodeCombo.setCurrentNode(volumeNode) | |
AutoReleaseGraphicsResourcesCheckBox.checked = True | |
QualityControlComboBox.currentText = 'Adaptive' | |
VisibilityCheckBox.checked = visible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment