@edickie I downloaded ciftify using pip install ciftify to be run on windows subsystem for linux. I have my fmri data preprocessed using fmriprep and obtained as a cifti dtseries file. I want to perform nuissance regression of motion regressors and few other covariates using cifti_clean_img.

The command I gave was:

ciftify_clean_img input.dtseries.nii --output-file=output.dtseries.nii --confounds-tsv=confound_file.tsv

I obtained the following error:

/home/shilpitju/.local/lib/python2.7/site-packages/nilearn/ DeprecationWarning: Python2 support is deprecated and will be removed in the next release. Consider switching to Python 3.6 or 3.7.
Traceback (most recent call last):
File “/home/shilpitju/.local/bin/ciftify_clean_img”, line 11, in
load_entry_point(‘ciftify==2.3.3’, ‘console_scripts’, ‘ciftify_clean_img’)()
File “/home/shilpitju/.local/lib/python2.7/site-packages/ciftify/bin/”, line 376, in main
ret = run_ciftify_clean_img(arguments, tmpdir)
File “/home/shilpitju/.local/lib/python2.7/site-packages/ciftify/bin/”, line 254, in run_ciftify_clean_img
clean_output = clean_image_with_nilearn(trimmed_nifti, confound_signals, settings)
File “/home/shilpitju/.local/lib/python2.7/site-packages/ciftify/bin/”, line 348, in clean_image_with_nilearn
File “/home/shilpitju/.local/lib/python2.7/site-packages/nilearn/image/”, line 926, in clean_img
File “/home/shilpitju/.local/lib/python2.7/site-packages/nilearn/”, line 492, in clean
raise ValueError(“Confound signal has an incorrect length”)
ValueError: Confound signal has an incorrect length

Can you please help me running the command.

Thanks and regards,

Shilpi Modi


It was an error on my part. I was using an earlier version of python and was giving the confound regressors file incorrectly. Now, I installed python 3.7 and gave the following command:

ciftify_clean_img --output-file=/mnt/e/SentCompData_Paper/Derivatives/fmriprep/sub-LTLE29/ses-1/func/sub-LTLE29_denoised_withmotion_acompcorr_ciftify_ses-1_task-SC_acq-TR2500_space-fsLR_den-91k_bold.dtseries.nii --confounds-tsv=/mnt/e/SentCompData_Paper/Derivatives/fmriprep/sub-LTLE29/ses-1/func/sub-LTLE29_ses-1_task-SC_acq-TR2500_desc-confounds_regressors.tsv --cf-cols=a_comp_cor_00 a_comp_cor_01 a_comp_cor_02 a_comp_cor_03 a_comp_cor_04 a_comp_cor_05 cosine00 cosine01 cosine02 trans_x trans_x_derivative1 trans_x_power2 trans_x_derivative1_power2 trans_y trans_y_derivative1 trans_y_derivative1_power2 trans_y_power2 trans_z trans_z_derivative1 trans_z_derivative1_power2 trans_z_power2 rot_x rot_x_derivative1 rot_x_derivative1_power2 rot_x_power2 rot_y rot_y_derivative1 rot_y_derivative1_power2 rot_y_power2 rot_z rot_z_derivative1 rot_z_power2 rot_z_derivative1_power2 --func_input=/mnt/e/SentCompData_Paper/Derivatives/fmriprep/sub-LTLE29/ses-1/func/sub-LTLE29_ses-1_task-SC_acq-TR2500_space-fsLR_den-91k_bold.dtseries.nii --debug --verbose

However, the command didn’t get executed, however python did not give any error.

Can you please help me with it.




I realized that the mistake on my part was not giving commas between the regressor columns to be selected. The command ran after doing so.


  1. the output denoised file is reduced in size. (86192 KB as a fmriprep output cifti file to 43406 KB after ciftify_image_clean)
  2. Can I add few other covariates as regressors such as linear trend in the data, task effects etc?