[vtkusers] vtkDataSetReader Problem
Yang, Faguo
Faguo.Yang at STJUDE.ORG
Tue Jan 6 10:43:48 EST 2009
Thank you guys. Just as you guys said the problem is the file.
Scalars must have a name "scalars"
Thanks a lot!
yang
-----Original Message-----
From: Larcher Aurélie [mailto:aurelie.larcher at imag.fr]
Sent: 2009年1月6日 3:37
To: Yang, Faguo; vtkusers at vtk.org
Subject: RE: [vtkusers] vtkDataSetReader Problem
Hello Yang,
When I test with the following code
#include "vtkDataSetReader.h"
#include "vtkUnstructuredGrid.h"
#include "vtkDataArray.h"
#include "vtkPointData.h"
void main()
{
vtkDataSetReader* reader = vtkDataSetReader::New();
reader->SetFileName("C:/Images/VTKData/Data/uGridEx.vtk");
reader->Update();
vtkUnstructuredGrid *pGrid =
dynamic_cast<vtkUnstructuredGrid*>(reader->GetOutput());
vtkDataArray *pTemp = pGrid -> GetPointData() -> GetScalars();
cout << "TEST -- " << pTemp[0];
system("PAUSE");
}
I have a result
Debug: Off
Modified Time: 308
/* ... */
MaxId: 26
LookupTable: (none)
Array: 00A31580
I use the vtk file unstructuredGrid in VTKdata : uGridEx.vtk Your file test.vtk is perhaps the problem.
Have you the same result with the vtkUnstructuredGridReader ?
Why is it "mesh_node_data" for SCALARS instead of "scalars" ?
Good luck !
Aurélie
-----Message d'origine-----
De : vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] De la part de Yang, Faguo Envoyé : mardi 6 janvier 2009 06:43 À : vtkusers at vtk.org Objet : [vtkusers] vtkDataSetReader Problem
Dear Guys,
Your help to solve the following problem is higly appreciated:
I am sure that in the test.vtk (an unstructuredGrid) file have the scalar data as follows:
POINT_DATA 40000
SCALARS mesh_node_data float
LOOKUP_TABLE default
39.162 39.183 39.2042 39.2256 39.2473 39.2691 39.2912
39.3135 39.3361
39.3588 39.3818 39.3549 39.2831 39.2114 39.1398 39.0683
38.9969 38.9256
38.8544 38.7833 38.7123 38.6415 38.5707 38.5 38.4295
38.359 38.2887 ...
And try to use the following code to read the data:
vtkDataSetReader* reader = vtkDataSetReader::New();
reader->SetFileName("test.vtk");
reader -> Update();
vtkUnstructuredGrid *pGrid = dynamic_cast<vtkUnstructuredGrid*>(reader->GetOutput());
vtkDataArray *pTemp = pGrid -> GetPointData() -> GetScalars();
however, pTemp always to be NULL.
Anyone can help to find out what is the problem?
Thanks a lot!
yang
Email Disclaimer: www.stjude.org/emaildisclaimer
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Email Disclaimer: www.stjude.org/emaildisclaimer
More information about the vtkusers
mailing list