77
88import os
99import warnings
10- from collections import OrderedDict
1110
1211import numpy as np
1312
2524
2625def create_empty_header ():
2726 ''' Return an empty compliant TCK header. '''
28- header = OrderedDict ()
27+ header = {}
2928
3029 # Default values
3130 header [Field .MAGIC_NUMBER ] = TckFile .MAGIC_NUMBER
@@ -45,14 +44,14 @@ class TckFile(TractogramFile):
4544
4645 Moreover, streamlines coordinates coming from a TCK file are considered
4746 to be in world space (RAS+ and mm space). MRtrix refers to that space
48- as the "real" or "scanner" space _ [1].
47+ as the "real" or "scanner" space [1]_ .
4948
5049 References
5150 ----------
5251 [1] http://www.nitrc.org/pipermail/mrtrix-discussion/2014-January/000859.html
5352 """
5453
55- # Contants
54+ # Constants
5655 MAGIC_NUMBER = "mrtrix tracks"
5756 SUPPORTS_DATA_PER_POINT = False # Not yet
5857 SUPPORTS_DATA_PER_STREAMLINE = False # Not yet
@@ -66,8 +65,9 @@ def __init__(self, tractogram, header=None):
6665 ----------
6766 tractogram : :class:`Tractogram` object
6867 Tractogram that will be contained in this :class:`TckFile`.
69- header : dict (optional)
70- Metadata associated to this tractogram file.
68+ header : None or dict, optional
69+ Metadata associated to this tractogram file. If None, make
70+ default empty header.
7171
7272 Notes
7373 -----
@@ -214,7 +214,7 @@ def save(self, fileobj):
214214 for t in tractogram :
215215 s = t .streamline .astype (dtype )
216216 data = np .r_ [s , self .FIBER_DELIMITER ]
217- f .write (asbytes ( data .tostring () ))
217+ f .write (data .tostring ())
218218 nb_streamlines += 1
219219
220220 header [Field .NB_STREAMLINES ] = nb_streamlines
@@ -283,7 +283,7 @@ def _read_header(fileobj):
283283 Parameters
284284 ----------
285285 fileobj : string or file-like object
286- If string, a filename; otherwise an open file-like object
286+ If string, a filename; otherwise an open binary file-like object
287287 pointing to TCK file (and ready to read from the beginning
288288 of the TCK header). Note that calling this function
289289 does not change the file position.
0 commit comments