[vtkusers] Unable to read all scalars from Cell Data in a VTK file

amit112amit amit112amit at yahoo.co.in
Fri Jan 1 03:55:32 EST 2016


Hi.
I have a VTK legacy file format POLYDATA that opens properly in Paraview. It
has cell data with multiple scalar arrays in it. I can see all of them
listed in Paraview dropdown for choosing what scalar to color the view by. I
am trying to read the VTK file using C++:

vtkPolyDataReader *reader1 = vtkPolyDataReader::New();
  reader1->SetFileName("T7-relaxed-2.vtk");  
  vtkPolyData* ds1 = reader1->GetOutput();  
  ds1->Update();
  vtkDataArray* dsa = ds1->GetCellData()->GetScalars(); 

I expect 'dsa' to have all the 6 scalar arrays from the VTK file. But it
only has the first one. I even tried GetScalars(<name of second or later
scalar array>) but I get an empty data array.

I have same issue with GetPointData()->GetVectors(). I can only fetch the
first vector from the file although there are 2.

How can I read all the scalars and vectors from the VTK file using VTK
functions?

Thanks for your time.

Regards,
Amit



--
View this message in context: http://vtk.1045678.n5.nabble.com/Unable-to-read-all-scalars-from-Cell-Data-in-a-VTK-file-tp5735720.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list