[vtkusers] writing binary files with pyvtk - bug in PyVTK or in VTK?

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Sun Jan 26 00:03:22 EST 2003


Hi,

>>>>> "HF" == Hans Fangohr <H.FANGOHR at soton.ac.uk> writes:

[snip]
    HF> Can you see why VTK has trouble reading the binary file? (Or
    HF> should there be a bug in vtkUnstructuredGridReader.cxx?)

    HF> Maybe my comparing the binary and the ascii-version (as
    HF> attached) an expert can spot the offending byte/structure etc.

It looks like the output of the CELLS data is incorrect (from pyVTK).
Here is what I did.  I read the ascii file and then wrote it as binary
using vtkUnstructuredGridWriter.

r = vtkUnstructuredGridReader ()
r.SetFileName ("example3.vtk")
r.Update()

w = vtkUnstructuredGridWriter ()
w.SetFileTypeToBinary ()
w.SetInput(r.GetOutput())
w.SetFileName("test.vtk")
w.Write()

I then compared the output with the example3b.vtk binary file you
sent. The CELLS information was different and the only difference was
the addition of a few extra newlines in the pyVTK output.  I'm
attaching the fixed example3b.vtk that works just fine.  I have not
looked at the pyVTK code but I guess Pearu should be able to fix it.

cheers,
prabhu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example3b.vtk
Type: application/octet-stream
Size: 1250 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030126/b8d4229a/attachment.obj>


More information about the vtkusers mailing list