We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7cf14a3 commit ea1b0ccCopy full SHA for ea1b0cc
nibabel/streamlines/trk.py
@@ -556,8 +556,8 @@ def _read_header(fileobj):
556
start_position = fileobj.tell() if hasattr(fileobj, 'tell') else None
557
558
with Opener(fileobj) as f:
559
-
560
- # Read the header into a bytearray.
+ # Reading directly from a file into a (mutable) bytearray enables a zero-copy
+ # cast to a mutable numpy object with frombuffer
561
header_buf = bytearray(header_2_dtype.itemsize)
562
f.readinto(header_buf)
563
header_rec = np.frombuffer(buffer=header_buf, dtype=header_2_dtype)
0 commit comments