Created
October 4, 2015 03:58
-
-
Save vsaase/436b47f2eb8652446853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File: crash-20151003-165858-brain-b0_avg.pklz | |
Node: hmc_sdc_ecc.eddy_correct.b0_avg | |
Working directory: /tmp/tmpyq3yMf/hmc_sdc_ecc/eddy_correct/b0_avg | |
Node inputs: | |
function_str = S'def b0_average(in_dwi, in_bval, max_b=10.0, out_file=None):\n """\n A function that averages the *b0* volumes from a DWI dataset.\n As current dMRI data are being acquired with all b-values > 0.0,\n the *lowb* volumes are selected by specifying the parameter max_b.\n\n .. warning:: *b0* should be already registered (head motion artifact should\n be corrected).\n\n """\n import numpy as np\n import nibabel as nb\n import os.path as op\n\n if out_file is None:\n fname, ext = op.splitext(op.basename(in_dwi))\n if ext == ".gz":\n fname, ext2 = op.splitext(fname)\n ext = ext2 + ext\n out_file = op.abspath("%s_avg_b0%s" % (fname, ext))\n\n imgs = np.array(nb.four_to_three(nb.load(in_dwi)))\n index = b0_indices(in_bval, max_b=max_b)\n b0s = [im.get_data().astype(np.float32)\n for im in imgs[index]]\n b0 = np.average(np.array(b0s), axis=0)\n\n hdr = imgs[0].get_header().copy()\n hdr.set_data_shape(b0.shape)\n hdr.set_xyzt_units(\'mm\')\n hdr.set_data_dtype(np.float32)\n nb.Nifti1Image(b0, imgs[0].get_affine(), hdr).to_filename(out_file)\n return out_file\n' | |
. | |
ignore_exception = False | |
in_bval = /home/brain/nipypetest/Pres2.bval | |
in_dwi = /home/brain/nipypetest/Pres2.nii.gz | |
Traceback: | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/nipype/pipeline/plugins/linear.py", line 38, in run | |
node.run(updatehash=updatehash) | |
File "/usr/lib/python2.7/dist-packages/nipype/pipeline/engine.py", line 1428, in run | |
self._run_interface() | |
File "/usr/lib/python2.7/dist-packages/nipype/pipeline/engine.py", line 1538, in _run_interface | |
self._result = self._run_command(execute) | |
File "/usr/lib/python2.7/dist-packages/nipype/pipeline/engine.py", line 1664, in _run_command | |
result = self._interface.run() | |
File "/usr/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 1033, in run | |
runtime = self._run_wrapper(runtime) | |
File "/usr/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 983, in _run_wrapper | |
runtime = self._run_interface(runtime) | |
File "/usr/lib/python2.7/dist-packages/nipype/interfaces/utility.py", line 445, in _run_interface | |
out = function_handle(**args) | |
File "<string>", line 23, in b0_average | |
NameError: global name 'b0_indices' is not defined | |
Interface Function failed to run. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment