Programmetically writing streamlines (fibers) with angle, anisotropy like supporting information

Hi all,

I programmatically compute fiber tract in micro-CT images. I have a set of streamlines, each described as two nodes (the coordinates of each node are known), along with their angle with centerline and calculated anisotropy. I want to convert this to .vtk format for visualization and further analysis purposes.

From my digging up until now. I figured out;

  1. I first need to create vtk.PolyData() object from the node coordinates polydata_object.SetPoints(coordinates). One node is one point.
  2. Then, for each line, I could do the following:
    lines = vtkCellArray()
    lines.InsertNextCell(2)
    lines.InsertCellPoint(point_a)
    lines.InsertCellPoint(point_b)
    polydata_object.SetLines(lines)
    

I have a few questions:

  1. First of all, is my approach correct?
  2. When we use .SetLines() does it clear existing lines and add the new one or append to the existing lines?
  3. How do I add the angle and anisotropy information of each line to the above PolyData object?

These might be dumb questions, but I am new to vtk.

Thank you in advance.