the spike threshold should either be in millimeters:
spikeThreshold : [0.5]
or a percent:
spikeThreshold : ['5%']
I will submit a pull request shortly to resolve this.
Thank you for the useful error messages!
File: /mnt/Projects/PACR-AD/Imaging/BIDS/derivatives/cpac/crash/crash-20171216-042910-jdkent-calc_spike_percent.c0.a0-099be92d-949a-4851-9772-a05729e11afb.pklz
Node: resting_preproc_sub-controlGE140_ses-post.gen_motion_stats_0.calc_spike_percent.c0.a0
Working directory: /mnt/Projects/PACR-AD/Imaging/BIDS/derivatives/cpac/working/resting_preproc_sub-controlGE140_ses-post/gen_motion_stats_0/_scan_task-flanker/_threshold_0.5/calc_spike_percent
Node inputs:
fd_file = /mnt/Projects/PACR-AD/Imaging/BIDS/derivatives/cpac/working/resting_preproc_sub-controlGE140_ses-post/gen_motion_stats_0/_scan_task-flanker/calculate_FDJ/FD_J.1D
function_str = def calc_percent(threshold, fd_file):
"""Calculate the de-spiking/scrubbing threshold based on the highest Mean
FD values by some percentage.
:param threshold: user's threshold input, either a float or string
:param fd_file: text file containing the mean framewise displacement
:return: a float value for the calculated threshold
"""
if isinstance(threshold, str):
if '%' in threshold:
percent = int(threshold.replace('%', ''))
percent = percent / 100.0
else:
err = "A string was entered for the de-spiking/scrubbing " \
"threshold, but there is no percent value."
raise Exception(err)
elif isinstance(threshold, float) or isinstance(threshold, int):
return threshold
else:
err = "Invalid input for the de-spiking/scrubbing threshold."
raise Exception(err)
with open(fd_file, 'r') as f:
nums = sorted([float(x.rstrip('\n')) for x in f.readlines()])
# get the threshold value at the top percent mark provided
threshold = nums[int(0-(len(nums) * percent))]
return threshold
ignore_exception = False
threshold = 0.5
Traceback:
Traceback (most recent call last):
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 52, in run_node
result['result'] = node.run(updatehash=updatehash)
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 372, in run
self._run_interface()
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 482, in _run_interface
self._result = self._run_command(execute)
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 613, in _run_command
result = self._interface.run()
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/interfaces/base.py", line 1081, in run
runtime = self._run_wrapper(runtime)
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/interfaces/base.py", line 1029, in _run_wrapper
runtime = self._run_interface(runtime)
File "/usr/local/bin/miniconda/lib/python2.7/site-packages/nipype/interfaces/utility/wrappers.py", line 194, in _run_interface
out = function_handle(**args)
File "<string>", line 17, in calc_percent
Exception: A string was entered for the de-spiking/scrubbing threshold, but there is no percent value.
Interface Function failed to run.
Minor mistype in the default_pipeline.yaml and the test_pipeline.yaml
the spike threshold should either be in millimeters:
spikeThreshold : [0.5]
or a percent:spikeThreshold : ['5%']
I will submit a pull request shortly to resolve this.
Thank you for the useful error messages!