How do I get scalar data from PolyDataReader???

Pieper, Chris cpieper at kcc.com
Wed Sep 1 12:04:44 EDT 1999


This is probably a basic question, but I've been struggling with it for 2
days now...  I'm trying to get a hold of point attribute data which I'm
reading from a vtk format file using vtkPolyDataReader.   I get the geometry
fine and am able to process and render a visualization .  I looked for an
example, but was unable to find one that used attribute data for "custom"
processing.  Any help would be greatly appreciated!!!
 
Here is a portion of my code...
 
vtkPolyDataReader *reader = vtkPolyDataReader::New();
     reader->SetFileName(argv[1]);
     reader->SetScalarsName("isabond");
     reader->Update();
     reader->DebugOn();
 
      cout << "\nfound " << numpts << " points!\n\n";  // this works fine...
(I get 7369 points)
 vtkScalars *bonds = vtkScalars::New();
  bonds = reader->GetOutput()->GetPointData()->GetScalars();
 
 if (bonds) {
  cout << "\nfound " <<  bonds->GetNumberOfScalars() << " scalars\n";
 }
 else {
  cout << "\nscalars must be null...\n"; // <- this is what I get... 
 }
 

Here's part of my vtk data file...
 
POINT_DATA 7369
SCALARS short_scalars short
LOOKUP_TABLE isabond
1
0
0
1
0
0
1
0
0
0
1
0
0
1
...
 
 
 
Thanks in advance for any help!

Chris Pieper 
cpieper at kcc.com 




-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list