Hi,
I am trying to extract the attributes associated with the point and cell data from a vtp
file that contains tractography streamlines, together with some associated scalar and tensor data.
So far I have been able to extract the names of the attributes with the code I am attaching (I’m using Python). I would like to:
- Get the attribute type associated with each one.
- Get the actual data associated with each one.
How can I do this?
Relevant code snippet:
import vtk
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName(in_fname)
reader.Update()
in_data = reader.GetOutput()
vtk_data = in_data.GetPointData()
# vtk_data = in_data.GetCellData()
names = []
if vtk_data.GetNumberOfArrays() > 0:
point_data_arr_idx = list(range(vtk_data.GetNumberOfArrays()))
for idx in point_data_arr_idx:
array = vtk_data.GetArray(idx)
names.append(array.GetName())
The test data I am using is attached.
Thanks.
T_CC1.vtp (724.2 KB)