Error whit build_nuisance_regressors

Hello everyone,

I’m using C-PAC (v1.8.7.dev1) for pre-processing rsfMRI data. I’m running the pipeline on several subjects, and I found the following error when preprocessing only one of them:

250304-16:23:57,555 nipype.workflow INFO:
	 [Node] Executing "build_nuisance_regressors" <CPAC.utils.interfaces.function.function.Function>
/code/CPAC/nuisance/nuisance.py:287: UserWarning: loadtxt: input contained no data: "/gpfs/scratch/martil42/ost_fix/working/pipeline_cpac-ost-fix/cpac_678314_pre/nuisance_regressors_default_163/_scan_fix_acq-normal_run-01/CerebrospinalFluid_mean/sub-678314_ses-pre_task-fix_acq-normal_run-01_bold_resample_calc_tshift_volreg_calc_maths_flirt_roistat.1D"
  regressors = np.loadtxt(regressor_file)
250304-16:23:57,847 nipype.workflow INFO:
	 [Node] Finished "build_nuisance_regressors", elapsed time 0.051391s.
250304-16:23:57,848 nipype.workflow WARNING:
	 Storing result file without outputs
250304-16:23:57,849 nipype.workflow WARNING:
	 [Node] Error on "cpac_678314_pre.nuisance_regressors_default_163.build_nuisance_regressors" (/gpfs/scratch/martil42/ost_fix/working/pipeline_cpac-ost-fix/cpac_678314_pre/nuisance_regressors_default_163/_scan_fix_acq-normal_run-01/build_nuisance_regressors)
250304-16:23:57,851 nipype.workflow ERROR:
	 Node build_nuisance_regressors.a0 failed to run on host cn-0044.
250304-16:23:57,852 nipype.workflow ERROR:
	 Saving crash info to /gpfs/scratch/martil42/ost_fix/log/crash-20250304-162357-martil42-build_nuisance_regressors.a0-c8ac2890-1802-4fae-a5d6-7c2ae06b4e9a.txt
Traceback (most recent call last):
  File "/usr/share/fsl/6.0/lib/python3.10/site-packages/nipype/pipeline/plugins/linear.py", line 47, in run
    node.run(updatehash=updatehash)
  File "/code/CPAC/pipeline/nipype_pipeline_engine/engine.py", line 443, in run
    return super().run(updatehash)
  File "/usr/share/fsl/6.0/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/share/fsl/6.0/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/share/fsl/6.0/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node build_nuisance_regressors.

I’m not sure where the issue might be, since the preprocessing of the same subject (but a different session) and of the remaining subjects has run smoothly, and only this one is giving errors.

Thanks in advance!!

~L


hi @luisagulleiro,

Thanks for reaching out! Would it be possible for you to post the full log file for this error along with the config file you’re using?

Hi @tamsinrogers!

Here is the log file:

crash-20250304-162358-martil42-build_nuisance_regressors.a0-2216c1fa-57fc-4508-9aab-07fddb6ff2ae.txt (3.9 KB)

And here the config file (original is yml, but the forum doesn’t allow that extension):

data_config_ost_fix.txt (36.7 KB)

The participant that is giving trouble is sub-678314_ses-pre.

~L

Hi @luisagulleiro,

This is likely due to a mixup between the orientation of the mask and the data. I would recommend taking a look at your T1w - does it look like it’s been punched out sideways?

If that’s the case, our team has seen this issue before and is working to see where exactly the mixup with the header orients is happening/if it’s patchable. I’ll be in touch with an update if so!

Hi @tamsinrogers,

Thanks for your help! I think the T1w is looking fine:

I overlaid the brain mask created during preprocessing and FSLeyes warns that it has a different orientation/FOV, but not very displaced:

Thanks again!!

@luisagulleiro - hm, interesting. I’ll be in touch as we look further into this issue!

Hi @luisagulleiro,

Can you try overlaying the CSF mask (*CSF_desc-preproc_mask.nii.gz) over the preprocessed T1 and let me know what that looks like?

Hi @tamsinrogers,

Here’s the CSF mask (*CSF_desc-preproc_mask.nii.gz) overlaid over the preprocessed T1 (*desc-preproc_T1w.nii.gz)

hi @luisagulleiro - are you able to attach the pipeline config file you’re using?

Hi @tamsinrogers, here’s the pipeline–it’s based on CPAC’s default pipeline.

new_pipeline.txt (67.9 KB)

Hi @luisagulleiro,

Thanks! Can you try the following with a new directory/fresh run?

  • Under use_priors, set run to Off (line 517)
  • Set lateral_ventricles_mask (line 1452) to None

Both of those steps heavily reduce the footprint of the tissue masks - mainly to be safe and not extract timeseries from the borders of the segmentations (i.e. accidentally getting too much gray matter signal/time series and then regressing it out). This should result in a more liberal CSF mask when overlaid on the T1 - that visualization will allow us to see the coverage.

Hi @tamsinrogers,

Thanks for looking into this! I ran the pipeline with the modifications you suggested and I was able to extract the timeseries from my masks without any problem.