[vtkusers] Re: vtkStructuredPointsWriter

Christopher M. Navarro cnavarro at ncsa.uiuc.edu
Wed Oct 9 14:29:30 EDT 2002

The original question remains but I did find a workaround on this.  I 
explicitly set the writer to the scalar original scalar name 'elevation' 
and then added the additional arrays as FieldData.  It's still interesting 
as to why it defaults to 'scalars' when read then written right away.  


On Wed, 9 Oct 2002, Christopher M. Navarro wrote:

> I've noticed that if I first read a structured points file with 
> vtkStructuredPointsReader and then immediately write it with 
> vtkStructuredPointsWriter (or anytime thereafter), the scalar name set in 
> the original foo.vtk file is lost and it defaults to the name "scalars".  
> If I explicitly say 
> points.GetPointData().GetScalars().SetName("elevation")
> it still writes out 'scalars' as the name.  Now, if I set the scalar name 
> explicitly with the writer, it writes out 'elevation'.  ie
> out.SetScalarsName("elevation")
> To further complicate things, if I add more arrays of scalar data with 
> GetPointData().AddArray(myArray) it does not append not merely append the 
> extra arrays when I write the structuredpoints object to file.  It mix and 
> matched the arrays.  In one instance, with the additional arrays, 
> elevation was written second in the file and the name showed up....so it 
> is there, something is just not allowing it to write the name to the file 
> when it shows up first in the file.  To clarify all of this, it would 
> appear that StructuredPointsWriter uses a default name 'scalars' for the 
> first scalar written to file, unless explicitly set within the writer object.  
> With additional arrays, it does not just append them on to the 
> original pointdata, but alters the order (how/why?).  Am I doing something 
> incorrectly?  This all seems pretty straightforward.  As reference I am 
> using java + vtk 4.0.  Any thoughts? 
> -chris

Christopher Navarro
Research Programmer
Automated Learning Group
National Center for Supercomputing Applications
University of Illinois @ Urbana - Champaign
cnavarro at ncsa.uiuc.edu

More information about the vtkusers mailing list