Skip to content

Commit aaecb34

Browse files
committed
Merge branch 'fix/mnibias' of github.com:mgxd/nipype into fix/mnibias
2 parents 9990a53 + 4318274 commit aaecb34

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,7 @@ class MNIBiasCorrection(FSCommand):
15101510
>>> from nipype.interfaces.freesurfer import MNIBiasCorrection
15111511
>>> correct = MNIBiasCorrection()
15121512
>>> correct.inputs.in_file = "norm.mgz"
1513+
>>> correct.inputs.out_file = "norm_output.mgz"
15131514
>>> correct.inputs.iterations = 6
15141515
>>> correct.inputs.protocol_iterations = 1000
15151516
>>> correct.inputs.distance = 50

nipype/interfaces/freesurfer/tests/test_preprocess.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ def test_mandatory_outvol(create_files_in_directory):
102102
with pytest.raises(ValueError): mni.run()
103103

104104
# rest of mandatory inputs
105-
mni.inputs.out_file = 'bias_corrected_file'
105+
mni.inputs.out_file = 'bias_corrected_output'
106106

107-
assert mni.cmdline == ('mri_nu_correct.mni --i %s --n 4 --o bias_corrected_file.mgz'
107+
assert mni.cmdline == ('mri_nu_correct.mni --i %s --n 4 --o bias_corrected_output.mgz'
108108
% filelist[0])
109109
# constructor based tests
110-
mni2 = freesurfer.MNIBiasCorrection(in_file=filelist[0], out_file='bias_corrected_file')
111-
assert mni2.cmdline == ('mri_nu_correct.mni --i %s --n 4 --o bias_corrected_file.mgz'
110+
mni2 = freesurfer.MNIBiasCorrection(in_file=filelist[0], out_file='bias_corrected_output')
111+
assert mni2.cmdline == ('mri_nu_correct.mni --i %s --n 4 --o bias_corrected_output.mgz'
112112
% filelist[0])

nipype/interfaces/mrtrix/convert.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
"""
1212
from __future__ import print_function, division, unicode_literals, absolute_import
13-
from builtins import open
13+
from io import open
1414

1515
import os.path as op
1616
import nibabel as nb
@@ -55,10 +55,11 @@ def read_mrtrix_tracks(in_file, as_generator=True):
5555

5656

5757
def read_mrtrix_header(in_file):
58-
fileobj = open(in_file, 'r')
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):
7879
def read_mrtrix_streamlines(in_file, header, as_generator=True):
7980
offset = header['offset']
8081
stream_count = header['count']
81-
fileobj = open(in_file, 'r')
82+
fileobj = open(in_file, 'rb')
8283
fileobj.seek(offset)
8384
endianness = native_code
8485
f4dt = np.dtype(endianness + 'f4')
@@ -90,7 +91,7 @@ def points_per_track(offset):
9091
n_points = 0
9192
track_points = []
9293
iflogger.info('Identifying the number of points per tract...')
93-
all_str = fileobj.read()
94+
all_str = fileobj.read().decode()
9495
num_triplets = int(len(all_str) / bytesize)
9596
pts = np.ndarray(shape=(num_triplets, pt_cols), dtype='f4', buffer=all_str)
9697
nonfinite_list = np.where(np.isfinite(pts[:, 2]) == False)

0 commit comments

Comments
 (0)