[vtkusers] vtkStructuredPointsWriter

Berk Geveci berk.geveci at kitware.com
Wed Oct 9 15:50:29 EDT 2002

The short answer is : the readers and writers did not catch up with
changes to the attributes/data arrays. 

The long answer is:
In the old days (VTK 3.2 and earlier), the arrays/attributes did not
have names. The names were stored in vtkFieldData instead. Furthermore,
vtkPointData and  vtkCellData were not subclasses of vtkFieldData,
instead they each had an associated vtkFieldData. This meant that the
only way to associate a name with an array was to store it in field
data. This is why the writers had and still have special methods to set
the attribute names stored in the file and also why they use a default
name for each attribute. The new VTK readers/writers we are developing
will not have this problem. They are currently in the
development/testing stage and will be part of the next ParaView release
(to be announced in a few weeks) and hopefully, the next VTK release.


On Wed, 2002-10-09 at 14:04, 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
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers

More information about the vtkusers mailing list