[vtkusers] [SOLVED] errors from vtkParallelCoordinatesRepresentation with vtkDelimitedTextReader

Hal Canary hal at cs.unc.edu
Thu Sep 8 14:36:55 EDT 2011


On 09/08/2011 09:42 AM, Hal Canary wrote:
> Hi, everyone,
>
> I'm trying to make use of VTK's vtkParallelCoordinates* classes,
> starting by simply viewing a CSV file, but I'm getting some errors that
> I'm having trouble understanding.
>
>[...]

I've solved my difficulty.  Here's the solution:

#!/usr/bin/env python
import vtk
import random
with open('tmp.csv','w') as tmpcsv:
   tmpcsv.write('"col0","col1"\n')
   for i in xrange(10):
     tmpcsv.write('%g,%g\n' %
       (random.random(), random.random()))
reader = vtk.vtkDelimitedTextReader()
reader.SetHaveHeaders(True)
reader.SetFileName('tmp.csv')
numeric = vtk.vtkStringToNumeric()
numeric.SetInputConnection(reader.GetOutputPort())
rep = vtk.vtkParallelCoordinatesRepresentation()
rep.SetInputConnection(numeric.GetOutputPort())
rep.SetInputArrayToProcess(0,0,0,
	'vtkDataObject::FIELD_ASSOCIATION_ROWS','col0')
rep.SetInputArrayToProcess(1,0,0,
	'vtkDataObject::FIELD_ASSOCIATION_ROWS','col1')
view = vtk.vtkParallelCoordinatesView()
view.SetRepresentation(rep)
view.Render()
view.GetInteractor().Start()


-- 
Hal Canary
http://cs.unc.edu/~hal/



More information about the vtkusers mailing list