Dear vtk Community ,
during my project to construct a volume renderer using vtk i am facing the challenge to define the curvature data of the volume as the y-axis of the 2D transfer function.
According to vtk documentation the input must be of type char.
SetTransfer2DYAxisArray()
virtual void vtkGPUVolumeRayCastMapper::SetTransfer2DYAxisArray (const char *)
// Set/Get the transfer 2D Y axis array.
My approach was to use numpy to calculate the curvature on the entire volume and then create a vtkImageData object with its “Name” set to “Curvature”.
from vtkmodules.util import numpy_support
curvature_np_array = compute_curvature(array_from_image(self.itk_img)) # Curvature as np.array
vtkarr = numpy_support.numpy_to_vtk(curvature_np_array.ravel(), deep=True, array_type=vtk.VTK_FLOAT)
vtkarr.SetNumberOfComponents(1)
vtkarr.SetNumberOfTuples(curvature_np_array.ravel().shape[0])
vtkarr.SetName("Curvature")
self.volume_mapper.SetTransfer2DYAxisArray(vtkarr.GetName())
The compute_curvature function calculates the mean curvature using the “itk.EigenFilter”.
Unfortunately the VolumeMapper ignores this and the Y-axis remains “gradient”.
Can someone help me with this?
David