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 1010
1111"""
1212from __future__ import print_function , division , unicode_literals , absolute_import
13- from builtins import open
13+ from io import open
1414
1515import os .path as op
1616import nibabel as nb
@@ -55,10 +55,11 @@ def read_mrtrix_tracks(in_file, as_generator=True):
5555
5656
5757def read_mrtrix_header (in_file ):
58- fileobj = open (in_file , 'r' , errors = 'ignore ' )
58+ fileobj = open (in_file , 'rb ' )
5959 header = {}
6060 iflogger .info ('Reading header data...' )
6161 for line in fileobj :
62+ line = line .decode ()
6263 if line == 'END\n ' :
6364 iflogger .info ('Reached the end of the header!' )
6465 break
@@ -78,7 +79,7 @@ def read_mrtrix_header(in_file):
7879def read_mrtrix_streamlines (in_file , header , as_generator = True ):
7980 offset = header ['offset' ]
8081 stream_count = header ['count' ]
81- fileobj = open (in_file , 'r' , errors = 'ignore ' )
82+ fileobj = open (in_file , 'rb ' )
8283 fileobj .seek (offset )
8384 endianness = native_code
8485 f4dt = np .dtype (endianness + 'f4' )
You can’t perform that action at this time.
0 commit comments