To avoid any future confusion, it might be worth underlying on this page
that each block is compressed separately and to get the whole data back
it is necessary to parse the VTK header and use its contents to extract
and combine the data from the blocks.
On 14/03/2017 13:27, Andrii Iudin wrote:
> Dear VTK Developers,
> Apologies for sending this question, if this is a wrong mailing list,
> but there has been no reply from the users list and the issue seems to
> be more to do with the specifics of the format, rather than something
> a general user is expected to know.
> We are working on a loader of VTP files into three.js to display these
> files on-line. The VTP files are saved as binary and compressed with
> Zlib. However, when decoding the contents of these files from base64
> and then decompressing, the result is truncated. Only 32768 bytes are
> pako and zlib.js) and also when decompressing in Python. Please see
> the example files attached.
> emd_2557.vtp contains the binary compressed data
> emd_2557_ascii.vtp contains the ASCII data without compression
> Both files are perfectly viewable in Paraview, so the data has to be
> For example, the procedure in Python is the following:
> import base64
> import zlib
> s = "eJyFnXm4V1Pbx8/eKQ1UpnN+DVSKksxJoYkSIhpUFE0nGtC..." # The whole
> string of the first of the Polys except the VTK header
> a = bytearray( base64.b64decode( s ) )
> d = zlib.decompress( bytes( a ) )
> which is 131 + 256 * 24 = 6275. That is, only first 4096 numbers from
> the first of the Polys are being obtained (as can be seen from the
> ASCII file). Is there a way, maybe a parameter that can be set in Zlib
> to allow obtaining the rest?
> Many thanks and best regards,
Powered by www.kitware.com