public void addTube(ArrayList<TubePosition> tubePositions) throws FileNotFoundException, IOException, Exception {
double opacity = 1.0;
vtkPoints points = null;
vtkUnsignedCharArray colorArray = null;
vtkFloatArray radiusArray = null;
// initialize the points array
points = new vtkPoints();
// initialize the color array
colorArray = new vtkUnsignedCharArray();
colorArray.SetNumberOfComponents(3);
colorArray.SetName("colors");
// initialize the radius array
radiusArray = new vtkFloatArray();
radiusArray.SetName("radius");
for (TubePosition tubePosition : tubePositions) {
double x = tubePosition.x;
double y = tubePosition.y;
double z = tubePosition.z;
int colorR = (int) tubePosition.r;
int colorG = (int) tubePosition.g;
int colorB = (int) tubePosition.b;
double radius = tubePosition.radius;
points.InsertNextPoint(x, y, z);
colorArray.InsertNextTuple3(colorR, colorG, colorB);
radiusArray.InsertNextValue(radius);
}
// add the lastube
if (points != null) {
addTube(points, colorArray, radiusArray, opacity);