Closed arnegroskurth closed 2 years ago
Hello,
The nrrd.read_header
and nrrd.read_data
functions accept file handles that I think should work for any IOBase
class. Have you tested that yet to see if it fails?
The read_header
function accepts any string iterable and just calls next()
on it to get another line. The read_data
calls close, seek, readline, read, all of which are present in IOBase
.
If these functions are not able to accept any generic IOBase
class, then I agree they should be generalized to do so if possible.
The nrrd.read()
function calls the other two functions after opening the file locally. I'd be okay with adapting nrrd.read()
to accept a file handle/stream instead of a filename. One thing to keep in mind is that the filename is used to determine the detached header or data filename, so this functionality will be broken.
Reading actually works by passing in an instance of io.BytesIO
.
But what about writing an nrrd record to memoy?
Hi, Does anyone know when a new version with this commit should be out?
I can’t give a timeline, but we’re waiting to add some other improvements to the library and then a v1.0.0 release is happening (with breaking changes).
The library seems to be missing an interface to simply parse a nrrd-record from another source then an actual file on disk.
Would e.g. an interface based on a provided instance of _IOBase make sense for you?