Hi guys,
I am trying to diyplay 2 volumes at the same time in the 2D Views and i am facing 2 problems.
One of the volume is a CT and the other has some random values, while being of the same size as the CT.
When I add the Volume Node to the scene, that works and I can see it in the Subject Hirarchy; but it is invisible in the 2D views. When i toggle it visible in the subject hirarchy my CT Vlume atomatically dissappears. I think that tas should technically be possible but i am definetly doing something wrong.
Here is my code.
nodeName = "MyNewVolume"
imageSize = [116, 116, 60]
voxelType=vtk.VTK_FLOAT
imageOrigin = [-57.5, -29.5, -57.5]
imageSpacing = [1.0, 1.0, 1.0]
imageDirections = [[1,0,0], [0,0,1], [0,1,0]]
imageData = vtk.vtkImageData()
imageData.SetDimensions(imageSize)
imageData.AllocateScalars(voxelType, 1)
for z in range(0,60):
for y in range(0,116):
for x in range(0,116):
imageData.SetScalarComponentFromDouble(x,y,z,0,0.5*z)
volumeNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLScalarVolumeNode", nodeName)
volumeNode.SetOrigin(imageOrigin)
volumeNode.SetSpacing(imageSpacing)
volumeNode.SetIJKToRASDirections(imageDirections)
volumeNode.SetAndObserveImageData(imageData)
volumeNode.CreateDefaultDisplayNodes()
volumeNode.CreateDefaultStorageNode()
self.displayNode = volumeNode.GetDisplayNode()
self.displayNode.SetVisibility(True)
self.displayNode.SetWindowLevelFromPreset(0)
self.displayNode.SetOpacity(0.3)
I would like both volumes to be visible at the same time. But my defined opacity here is not changing the opacity in the 2D views. So probably there is something wrong aswell.
Thanks for help!