@@ -65,7 +65,6 @@ def __init__(self, tractogram, header=None):
65
65
----------
66
66
tractogram : :class:`Tractogram` object
67
67
Tractogram that will be contained in this :class:`TckFile`.
68
-
69
68
header : dict (optional)
70
69
Metadata associated to this tractogram file.
71
70
@@ -101,7 +100,8 @@ def is_correct_format(cls, fileobj):
101
100
with Opener (fileobj ) as f :
102
101
magic_number = f .fobj .readline ()
103
102
f .seek (- len (magic_number ), os .SEEK_CUR )
104
- return magic_number .strip () == cls .MAGIC_NUMBER
103
+
104
+ return magic_number .strip () == cls .MAGIC_NUMBER
105
105
106
106
@classmethod
107
107
def load (cls , fileobj , lazy_load = False ):
@@ -229,8 +229,8 @@ def _write_header(fileobj, header):
229
229
Parameters
230
230
----------
231
231
fileobj : file-like object
232
- An open file-like object pointing to TCK file (and ready to read
233
- from the beginning of the TCK header).
232
+ An open binary file object pointing to TCK file (and ready to
233
+ write at the beginning of the TCK header).
234
234
"""
235
235
# Fields to exclude
236
236
exclude = [Field .MAGIC_NUMBER , # Handled separately.
@@ -244,7 +244,8 @@ def _write_header(fileobj, header):
244
244
lines .append ("count: {0:010}" .format (header [Field .NB_STREAMLINES ]))
245
245
lines .append ("datatype: Float32LE" ) # Always Float32LE.
246
246
lines .extend (["{0}: {1}" .format (k , v )
247
- for k , v in header .items () if k not in exclude and not k .startswith ("_" )])
247
+ for k , v in header .items ()
248
+ if k not in exclude and not k .startswith ("_" )])
248
249
lines .append ("file: . " ) # Manually add this last field.
249
250
out = "\n " .join ((asstr (line ).replace ('\n ' , '\t ' ) for line in lines ))
250
251
fileobj .write (asbytes (out ))
0 commit comments