[vtkusers] Possible bug in python vtkXMLMultiBlockDataWriter

Guillaume Jacquenot guillaume.jacquenot at gmail.com
Tue Sep 23 09:52:42 EDT 2014


Dear VTK users,

I try to write a VTM file from a python script.
I use an instance of vtkXMLMultiBlockDataWriter
My code works on fine small data.
However on large data, the result files are not valid and can not be
imported in Paraview.
Paraview complains about a VTU header file that is not valid: Error parsing
XML in stream at line 1, column 7, byte index 7: not well-formed

As the VTU file is large, the file can not be opened in a text-file
software.
A 'head' on the VTU file reveals the problem, and shows that the XML header
are not correct.
On my file, I got these lines (head -5 file.vtu)

 offset="369942984"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor">
  <UnstructuredGrid>

Obviously the first line is not valid

I corrected the header with
sed '1s/.*/<?xml version="1.0"?>/' file.vtu > newfile.vtu

However, I am afraid that my data are corrupted.

Is it a bug?
Any advice to fix?
Any advice to check my data are not corrupted?


The bug occur with VTK 5.10 and VTK 6.1


Here is basically the code I use to write a VTM file

import vtk
VTKMajorVersion = vtk.vtkVersion.GetVTKMajorVersion()

w = vtk.vtkXMLMultiBlockDataWriter()
w.SetByteOrderToLittleEndian()
w.SetIdTypeToInt64()
w.SetCompressorTypeToNone()
w.SetFileName(outputFilename)
if VTKMajorVersion <= 5:
    w.SetInput(rr)
else:
    w.SetInputData(rr)
w.Update()

Guillaume Jacquenot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140923/f2709b53/attachment.html>


More information about the vtkusers mailing list