Set color cut-offs for volume


I have two volumes: One with a common MNI brain and one with specific scalar values. The goal is to overlay the volume with specific values on top of the MNI brain. Both volumes have the same dimensions. I want to change the colors of the volume with specific scalar values, so that different cut-offs have different colors, i.e. 0-20 red, 20-40 blue et cetera.

I have tried making a copy of a LUT in the Colors module, but the cut-offs I set for “X” do not at all correspond to the specific values in each voxel (F values in Data Probe in the lower left corner).

Is this possible, and if yes – how? I am medium tech savvy, so please describe in relative detail

Operating system: OSX 10.14.6
Slicer version: 4.11.2020

How this works now is that you need to specify colors in the range of 0-255 (any colors below or above this range are ignored). These colors will be mapped to the voxel values that are specified by the window/level properties of the volume display node.

This is how you can set up absolute intensity->RGB mapping for a volume now:

displayNode = volumeNode.GetDisplayNode()

colorTransferFunction = vtk.vtkDiscretizableColorTransferFunction()
offset = -displayNode.GetWindowLevelMin()
scale = 255.0/(displayNode.GetWindowLevelMax()-displayNode.GetWindowLevelMin())
for x, rgb in colors:
    colorTransferFunction.AddRGBPoint((x+offset)*scale, *rgb)

colorNode = slicer.vtkMRMLProceduralColorNode()
colorNode.SetAttribute("Category", "LungCT")


I agree that the current behavior of procedural color nodes is too complicated/misleading, therefore I’ve filed a bug report to improve this.