File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 10
10
11
11
"""
12
12
from __future__ import print_function , division , unicode_literals , absolute_import
13
- from builtins import open
13
+ from io import open
14
14
15
15
import os .path as op
16
16
import nibabel as nb
@@ -55,10 +55,11 @@ def read_mrtrix_tracks(in_file, as_generator=True):
55
55
56
56
57
57
def read_mrtrix_header (in_file ):
58
- fileobj = open (in_file , 'r' , errors = 'ignore ' )
58
+ fileobj = open (in_file , 'rb ' )
59
59
header = {}
60
60
iflogger .info ('Reading header data...' )
61
61
for line in fileobj :
62
+ line = line .decode ()
62
63
if line == 'END\n ' :
63
64
iflogger .info ('Reached the end of the header!' )
64
65
break
@@ -78,7 +79,7 @@ def read_mrtrix_header(in_file):
78
79
def read_mrtrix_streamlines (in_file , header , as_generator = True ):
79
80
offset = header ['offset' ]
80
81
stream_count = header ['count' ]
81
- fileobj = open (in_file , 'r' , errors = 'ignore ' )
82
+ fileobj = open (in_file , 'rb ' )
82
83
fileobj .seek (offset )
83
84
endianness = native_code
84
85
f4dt = np .dtype (endianness + 'f4' )
You can’t perform that action at this time.
0 commit comments