Hi!

I’m trying to apply a transfer function to my volume-rendering. I have a custom `vtkMRMLColorTableNode`

, but `GetScalarsToColors()`

always returns a `vtkLookupTable`

. Is there a way to get a `vtkTransferFunction`

out of this?

Thanks!

Hi!

I’m trying to apply a transfer function to my volume-rendering. I have a custom `vtkMRMLColorTableNode`

, but `GetScalarsToColors()`

always returns a `vtkLookupTable`

. Is there a way to get a `vtkTransferFunction`

out of this?

Thanks!

Transfer functions are stored in volume rendering property nodes.

1 Like

If you just want the colors in your table to be transferred for volume rendering, you can just click the “Sync with Volumes” checkbox in the properties in the Volume Rendering module. Then uncheck it and you can set the opacities, etc.

1 Like

Thanks to you two, I managed to find the correct function in the source code!

The way I did it was as follows:

- First, get the Volume Rendering Logic via
`volume_rendering_logic = slicer.modules.volumerendering.logic()`

. - Then, create the Volume Rendering Node of the Volume Node by using
`volume_rendering_node = volume_rendering_logic.CreateDefaultVolumeRenderingNodes(volume_node)`

. - Finally, “sync” the Display Node of the volume with the Volume Rendering Display Node via
`volume_logic.CopyDisplayToVolumeRenderingDisplayNode(volume_rendering_node)`

.

Thanks again!