Open PkuClosed opened 6 years ago
@PkuClosed - in a workflow, all paths need to be absolute. so try this form:
import os
from nipype.workflows.dmri.fsl.artifacts import hmc_pipeline
hmc = hmc_pipeline()
hmc.inputs.inputnode.in_file = os.path.abspath('SE8_NODDI-90_20180318074608_6.nii.gz')
hmc.inputs.inputnode.in_bvec = os.path.abspath('SE8_NODDI-90_20180318074608_6.bvec')
hmc.inputs.inputnode.in_bval = os.path.abspath('SE8_NODDI-90_20180318074608_6_corrected.bval')
hmc.inputs.inputnode.in_mask = os.path.abspath('SE8_NODDI-90_20180318074608_6_brain_mask.nii.gz')
hmc.run()
Hi @satra
Thank you for the reply. I tried your code with absolute paths, and still got some errors. Would you please make some suggestions?
180320-20:34:13,452 workflow INFO:
Workflow motion_correct settings: ['check', 'execution', 'logging', 'monitoring']
180320-20:34:13,490 workflow INFO:
Running serially.
180320-20:34:13,491 workflow INFO:
[Node] Setting-up "motion_correct.DWICoregistration.MskDilate" in "/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpouwb5t/motion_correct/DWICoregistration/MskDilate".
180320-20:34:13,509 workflow INFO:
[Node] Running "MskDilate" ("nipype.interfaces.fsl.maths.MathsCommand"), a CommandLine Interface with command:
fslmaths /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/SE8_NODDI-90_20180318074608_6_brain_mask.nii.gz -nan -kernel sphere 5 -dilM /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/SE8_NODDI-90_20180318074608_6_brain_mask_maths.nii.gz
180320-20:34:19,211 workflow WARNING:
[Node] Error on "motion_correct.DWICoregistration.MskDilate" (/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpouwb5t/motion_correct/DWICoregistration/MskDilate)
180320-20:34:19,223 workflow ERROR:
Node MskDilate failed to run on host localhost.
180320-20:34:19,225 workflow ERROR:
Saving crash info to /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203419-pkuclosed-MskDilate-96e505d6-4e96-4ce8-be07-2ec01d591f11.pklz
Traceback (most recent call last):
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/plugins/linear.py", line 44, in run
node.run(updatehash=updatehash)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 487, in run
result = self._run_interface(execute=True)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 571, in _run_interface
return self._run_command(execute)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 650, in _run_command
result = self._interface.run(cwd=outdir)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 516, in run
runtime = self._run_interface(runtime)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 1020, in _run_interface
runtime = run_command(runtime, output=self.terminal_output)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 761, in run_command
Stream('stdout', proc.stdout),
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/support.py", line 253, in __init__
self.default_encoding = locale.getdefaultlocale()[1] or 'UTF-8'
File "/Users/pkuclosed/anaconda2/lib/python2.7/locale.py", line 545, in getdefaultlocale
return _parse_localename(localename)
File "/Users/pkuclosed/anaconda2/lib/python2.7/locale.py", line 477, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
180320-20:34:19,234 workflow INFO:
[Node] Setting-up "motion_correct.SplitDWI" in "/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpZwPcro/motion_correct/SplitDWI".
180320-20:34:19,244 workflow INFO:
[Node] Running "SplitDWI" ("nipype.interfaces.utility.wrappers.Function")
180320-20:34:31,134 workflow INFO:
[Node] Finished "motion_correct.SplitDWI".
180320-20:34:31,137 workflow INFO:
[Node] Setting-up "motion_correct.DWICoregistration.SplitDWIs" in "/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpN1u0Vj/motion_correct/DWICoregistration/SplitDWIs".
180320-20:34:31,142 workflow ERROR:
Node SplitDWIs failed to run on host localhost.
180320-20:34:31,143 workflow ERROR:
Saving crash info to /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203431-pkuclosed-SplitDWIs-ae272bcc-8828-4194-a296-d3f8ccdeab25.pklz
Traceback (most recent call last):
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/plugins/linear.py", line 44, in run
node.run(updatehash=updatehash)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 424, in run
cached, updated = self.is_cached()
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 310, in is_cached
hashed_inputs, hashvalue = self._get_hashval()
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 504, in _get_hashval
self._get_inputs()
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 547, in _get_inputs
self.set_input(key, deepcopy(output_value))
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 292, in set_input
setattr(self.inputs, parameter, deepcopy(val))
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/traits_extension.py", line 112, in validate
self.info_text, value))
TraitError: The trait 'in_file' of a SplitInputSpec instance is an existing file name, but the path '/private/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpZwPcro/motion_correct/SplitDWI/hmc_mov.nii.gz' does not exist.
Error setting node input:
Node: SplitDWIs
input: in_file
results_file: /var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpZwPcro/motion_correct/SplitDWI/result_SplitDWI.pklz
value: /private/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpZwPcro/motion_correct/SplitDWI/hmc_mov.nii.gz
180320-20:34:31,151 workflow INFO:
[Node] Setting-up "motion_correct.DWICoregistration.InitXforms" in "/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpe0a4u_/motion_correct/DWICoregistration/InitXforms".
180320-20:34:31,167 workflow INFO:
[Node] Running "InitXforms" ("nipype.interfaces.utility.wrappers.Function")
180320-20:34:31,175 workflow WARNING:
[Node] Error on "motion_correct.DWICoregistration.InitXforms" (/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpe0a4u_/motion_correct/DWICoregistration/InitXforms)
180320-20:34:31,189 workflow ERROR:
Node InitXforms failed to run on host localhost.
180320-20:34:31,190 workflow ERROR:
Saving crash info to /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203431-pkuclosed-InitXforms-ddabec43-7ac9-4ccd-94a5-6e6fe5a0e7a8.pklz
Traceback (most recent call last):
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/plugins/linear.py", line 44, in run
node.run(updatehash=updatehash)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 487, in run
result = self._run_interface(execute=True)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 571, in _run_interface
return self._run_command(execute)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 650, in _run_command
result = self._interface.run(cwd=outdir)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 516, in run
runtime = self._run_interface(runtime)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/utility/wrappers.py", line 144, in _run_interface
out = function_handle(**args)
File "<string>", line 5, in _checkinitxfm
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/numpy/lib/npyio.py", line 896, in loadtxt
fh = iter(open(fname, 'U'))
IOError: [Errno 2] No such file or directory: '/private/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpZwPcro/motion_correct/SplitDWI/bval_split.txt'
180320-20:34:31,201 workflow INFO:
[Node] Setting-up "motion_correct.DWICoregistration.Bias" in "/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpxl74Ui/motion_correct/DWICoregistration/Bias".
180320-20:34:31,220 workflow INFO:
[Node] Running "Bias" ("nipype.interfaces.ants.segmentation.N4BiasFieldCorrection"), a CommandLine Interface with command:
N4BiasFieldCorrection -d 3 --input-image /private/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpZwPcro/motion_correct/SplitDWI/hmc_ref.nii.gz --mask-image /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/SE8_NODDI-90_20180318074608_6_brain_mask.nii.gz --output hmc_ref_corrected.nii.gz
180320-20:34:31,375 workflow WARNING:
[Node] Error on "motion_correct.DWICoregistration.Bias" (/var/folders/3w/rk8vrs9j06l1p7xbk30p_hfw0000gn/T/tmpxl74Ui/motion_correct/DWICoregistration/Bias)
180320-20:34:31,386 workflow ERROR:
Node Bias failed to run on host localhost.
180320-20:34:31,388 workflow ERROR:
Saving crash info to /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203431-pkuclosed-Bias-587e4058-c888-4a14-8b68-90d2ae77ccc1.pklz
Traceback (most recent call last):
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/plugins/linear.py", line 44, in run
node.run(updatehash=updatehash)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 487, in run
result = self._run_interface(execute=True)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 571, in _run_interface
return self._run_command(execute)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 650, in _run_command
result = self._interface.run(cwd=outdir)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 498, in run
version=self.version)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/ants/base.py", line 125, in version
return Info.version()
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 1283, in version
terminal_output='allatonce').run()
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 516, in run
runtime = self._run_interface(runtime)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 1020, in _run_interface
runtime = run_command(runtime, output=self.terminal_output)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 818, in run_command
result['stdout'] = read_stream(stdout, logger=iflogger)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/utils/filemanip.py", line 674, in read_stream
default_encoding = encoding or locale.getdefaultlocale()[1] or 'UTF-8'
File "/Users/pkuclosed/anaconda2/lib/python2.7/locale.py", line 545, in getdefaultlocale
return _parse_localename(localename)
File "/Users/pkuclosed/anaconda2/lib/python2.7/locale.py", line 477, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
180320-20:34:31,396 workflow INFO:
***********************************
180320-20:34:31,396 workflow ERROR:
could not run node: motion_correct.DWICoregistration.MskDilate
180320-20:34:31,396 workflow INFO:
crashfile: /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203419-pkuclosed-MskDilate-96e505d6-4e96-4ce8-be07-2ec01d591f11.pklz
180320-20:34:31,396 workflow ERROR:
could not run node: motion_correct.DWICoregistration.SplitDWIs
180320-20:34:31,396 workflow INFO:
crashfile: /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203431-pkuclosed-SplitDWIs-ae272bcc-8828-4194-a296-d3f8ccdeab25.pklz
180320-20:34:31,396 workflow ERROR:
could not run node: motion_correct.DWICoregistration.InitXforms
180320-20:34:31,396 workflow INFO:
crashfile: /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203431-pkuclosed-InitXforms-ddabec43-7ac9-4ccd-94a5-6e6fe5a0e7a8.pklz
180320-20:34:31,397 workflow ERROR:
could not run node: motion_correct.DWICoregistration.Bias
180320-20:34:31,397 workflow INFO:
crashfile: /Users/pkuclosed/Desktop/materials/18_spring/PD/converted/SE8/crash-20180320-203431-pkuclosed-Bias-587e4058-c888-4a14-8b68-90d2ae77ccc1.pklz
180320-20:34:31,397 workflow INFO:
***********************************
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/workflows.py", line 602, in run
runner.run(execgraph, updatehash=updatehash, config=self.config)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/plugins/linear.py", line 61, in run
report_nodes_not_run(notrun)
File "/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype/pipeline/plugins/tools.py", line 78, in report_nodes_not_run
raise RuntimeError(('Workflow did not execute cleanly. '
RuntimeError: Workflow did not execute cleanly. Check log for details
Hi @satra
This seems to be some bug for the Mac OS. I am now using a Linux machine and the pipeline seems to be running. I will see how that finishes.
Best, Chuyang
Summary
The Head Motion Correction (HMC) did not perform normally.
Actual behavior
Here is a minimal example:
And the output is as below (sorry it is a bit long):
It seems that nodes did not perform as they should. For example, “Node MskDilate failed to run on host bogon."
Platform details:
I am using a Mac OS.
The output of:
python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)”
is: {'nibabel_version': '2.2.1', 'sys_executable': '/Users/pkuclosed/anaconda2/bin/python', 'networkx_version': '2.0', 'numpy_version': '1.13.3', 'sys_platform': 'darwin', 'sys_version': '2.7.14 |Anaconda custom (64-bit)| (default, Oct 5 2017, 02:28:52) \n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]', 'commit_source': 'installation', 'commit_hash': 'bded0d02', 'pkg_path': '/Users/pkuclosed/anaconda2/lib/python2.7/site-packages/nipype', 'nipype_version': '1.0.1', 'traits_version': '4.6.0', 'scipy_version': '0.19.1'} 1.0.1Execution environment
In the terminal, I typed python. Then I executed the above code line by line.