Nipype ArtifactDetection question

nipype

#1

I’m playing around with nipype’s ArtifactDetection function to create a censor file to use in my GLM, however, I’m confused by what needs to be in the “realignment_parameters” field. My command is:

import nipype.algorithms.rapidart as ra

ad = ra.ArtifactDetect()
ad.inputs.realigned_files = data_dir + '/sub-000*run-01_space-MNI152NLin2009cAsym_desc-smoothAROMAnonaggr_bold.nii.gz'
ad.inputs.mask_type = 'file'
ad.inputs.realignment_parameters = data_dir + '/sub-000*run-01_desc-confounds_regressors.tsv'
ad.inputs.mask_file = data_dir + '/brain_mask.nii.gz'
ad.inputs.parameter_source = 'AFNI'
ad.inputs.norm_threshold = 1
ad.inputs.use_differences = [True, False]
ad.inputs.zintensity_threshold = 3
ad.run() 

Which leads the the following error message:

  File "ArtifactDetect.py", line 20, in <module>
    ad.run() 
  File "/N/u/dlevitas/Carbonate/.local/lib/python2.7/site-packages/nipype-1.1.2-py2.7.egg/nipype/interfaces/base/core.py", line 521, in run
    runtime = self._run_interface(runtime)
  File "/N/u/dlevitas/Carbonate/.local/lib/python2.7/site-packages/nipype-1.1.2-py2.7.egg/nipype/algorithms/rapidart.py", line 624, in _run_interface
    imgf, motparamlist[i], i, cwd=os.getcwd())
  File "/N/u/dlevitas/Carbonate/.local/lib/python2.7/site-packages/nipype-1.1.2-py2.7.egg/nipype/algorithms/rapidart.py", line 486, in _detect_outliers_core
    mc_in = np.loadtxt(motionfile)
  File "/gpfs/hps/soft/rhel7/python/2.7.13a/lib/python2.7/site-packages/numpy-1.13.0.dev0+9c3d247-py2.7-linux-x86_64.egg/numpy/lib/npyio.py", line 1024, in loadtxt
    items = [conv(val) for (conv, val) in zip(converters, vals)]
  File "/gpfs/hps/soft/rhel7/python/2.7.13a/lib/python2.7/site-packages/numpy-1.13.0.dev0+9c3d247-py2.7-linux-x86_64.egg/numpy/lib/npyio.py", line 725, in floatconv
    return float(x)
ValueError: could not convert string to float: csf

So I realize that I can’t input each run’s confounds_regressors.tsv file, but I can’t quite tell from the documentation what I should be using instead.

Thank for you the help.


#2

Nevermind, I was able to fix it by grabbing the motion parameter columns from the confounds_regressors.tsv file