Hi everyone,
I’m using Python,
I have a tar file that contains some VTK files,
I don’t want to extract the files to the hard disk and then read the file with a reader-
Instead, I assign the VTK file content in run time to a local variable, and I’m looking for a way to read it.
This is the method I’m using for reading directly from a VTK file and it works:
Not many readers support this mode of operation. Even if they did, there’d need to be some way to hand over a Python object as a stream to the filter via the wrappers (@dgobbi). I made one years ago with boost::iostreams, but I’d have to dig it up again (we’d also not want a Boost dependency there anyways).
It’s possible that SetBinaryInputString()/Update() fails because the Python wrappers encode the binary char* as a utf-8 encoded string instead of as binary data.
Have you tried using an ASCII data file with the SetInputString() method to see if that works? If an ASCII data file works but a binary data file does not work, then we will know that the SetBinaryInputString() method is the problem.
Since the file header provides information about whether the data is stored in text or in binary, it’s not inconceivable that SetInputString(in,len) and SetBinaryInputString(in,len) would share the same implementation.