Skip to content

Commit a30b884

Browse files
committed
undo
1 parent 53c62c0 commit a30b884

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nipype/interfaces/mrtrix/convert.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
88
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
99
>>> os.chdir(datadir)
10-
1110
"""
1211
from __future__ import print_function, division, unicode_literals, absolute_import
13-
from builtins import open
12+
from io import open
1413

1514
import os.path as op
1615
import nibabel as nb
@@ -55,10 +54,11 @@ def read_mrtrix_tracks(in_file, as_generator=True):
5554

5655

5756
def read_mrtrix_header(in_file):
58-
fileobj = open(in_file, 'r')
57+
fileobj = open(in_file, 'rb')
5958
header = {}
6059
iflogger.info('Reading header data...')
6160
for line in fileobj:
61+
line = line.decode()
6262
if line == 'END\n':
6363
iflogger.info('Reached the end of the header!')
6464
break
@@ -78,7 +78,7 @@ def read_mrtrix_header(in_file):
7878
def read_mrtrix_streamlines(in_file, header, as_generator=True):
7979
offset = header['offset']
8080
stream_count = header['count']
81-
fileobj = open(in_file, 'r')
81+
fileobj = open(in_file, 'rb')
8282
fileobj.seek(offset)
8383
endianness = native_code
8484
f4dt = np.dtype(endianness + 'f4')
@@ -166,10 +166,8 @@ class MRTrix2TrackVis(BaseInterface):
166166
"""
167167
Converts MRtrix (.tck) tract files into TrackVis (.trk) format
168168
using functions from dipy
169-
170169
Example
171170
-------
172-
173171
>>> import nipype.interfaces.mrtrix as mrt
174172
>>> tck2trk = mrt.MRTrix2TrackVis()
175173
>>> tck2trk.inputs.in_file = 'dwi_CSD_tracked.tck'

0 commit comments

Comments
 (0)