mhe / pynrrd

Simple pure-python module for reading and writing nrrd files.
https://pynrrd.readthedocs.io/
MIT License
116 stars 51 forks source link

Support reading from BytesIO #125

Closed addisonElliott closed 2 years ago

addisonElliott commented 2 years ago

Add logic to correctly handle reading from BytesIO objects. Previously, parsing the data used np.fromfile which does not support BytesIO objects. This is fixed by using np.frombuffer and np.fromstring to read in BytesIO objects.

np.fromfile does not work with BytesIO objects and therefore caused

Additionally, tests for reading/writing from BytesIO objects were enhanced.