Closed
Description
Summary
While trying to report progress, read_mrtrix_streamlines may crash with a ZeroDivisionError in line 142 of interfaces/mrtrix/convert.py. When stream_count < 100, the right hand side of the modulo expression becomes zero, raising the division by zero error.
This line of code is also present in the current master branch.
Actual behavior
traceback
170224-08:52:03,434 workflow INFO:
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 49, in run_node
result['result'] = node.run(updatehash=updatehash)
File "/usr/lib64/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 394, in run
self._run_interface()
File "/usr/lib64/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 504, in _run_interface
self._result = self._run_command(execute)
File "/usr/lib64/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 630, in _run_command
result = self._interface.run()
File "/usr/lib64/python2.7/site-packages/nipype/interfaces/base.py", line 1043, in run
runtime = self._run_wrapper(runtime)
File "/usr/lib64/python2.7/site-packages/nipype/interfaces/base.py", line 1000, in _run_wrapper
runtime = self._run_interface(runtime)
File "/usr/lib64/python2.7/site-packages/nipype/interfaces/utility.py", line 499, in _run_interface
out = function_handle(**args)
File "<string>", line 63, in fiberTracking
File "/usr/lib64/python2.7/site-packages/nipype/interfaces/mrtrix/convert.py", line 149, in read_mrtrix_streamlines
streamlines = list(streamlines)
File "/usr/lib64/python2.7/site-packages/nipype/interfaces/mrtrix/convert.py", line 142, in track_gen
if n_streams % int(stream_count / 100) == 0:
ZeroDivisionError: integer division or modulo by zero
Interface Function failed to run.
Expected behavior
The function should not crash for less than 100 streamlines.
How to replicate the behavior
read streamlines from a file with less than 100 streamlines.
Platform details:
python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"
{'nibabel_version': '2.0.1', 'networkx_version': '1.10', 'numpy_version': '1.10.4', 'sys_platform': 'linux2', 'sys_version': '2.7.12 (default, Jan 9 2017, 15:48:03) \n[GCC 4.9.4]', 'commit_source': 'archive substitution', 'commit_hash': '%h', 'pkg_path': '/usr/lib64/python2.7/site-packages/nipype', 'sys_executable': '/usr/lib/python-exec/python2.7/python', 'traits_version': '4.5.0', 'scipy_version': '0.16.1'}
0.12.1