[vtkusers] vtkDataArray - write to file

amutka alan.mutka at gmail.com
Fri May 17 16:21:52 EDT 2013


Dear All,
I'm trying to write the array structure types(vtkDoubleArray,
vtkStringArray)  into the XML file by using the VTK file formats. 

I have tried the following:
1. Create one vtkDoubleArray, insert some data, create vtkPolyData and call
vtkPolyData->GetPointsData()->AddArray(my vtkDoubleArray name). Write the
polydata to file with vtkXMLPolyDataWriter. The data are written to
file(checked in notepad) but vtkXMLPolyDataReader reads only array name but
not the data. 
The solution is that there needs to be points created also, so if I create 3
points, then I can add three elements in vtkDoubleArray array. Less or more
elements then number of inserter points creates problems. 

2. In order to write the vtkStringArray I use this code....
vtkSmartPointer<vtkStringArray> labelsMARKER =
vtkSmartPointer<vtkStringArray>::New();
labelsMARKER->SetName("STRINGDATA");
labelsMARKER->SetNumberOfValues(3);
labelsMARKER->SetValue(0,"aa");
labelsMARKER->SetValue(1,"bb");
labelsMARKER->SetValue(2,"cb");

The strings are written into file but it is impossible to get back any data,
only the NULL pointer is returned.

Do You have any experience with this? 

Thank you
Best regards
Alan







--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkDataArray-write-to-file-tp5720757.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list