MRIQC ICA error

Hi,

I’m running a cohort through MRIQC, and noticed that a small subset have crashed with a crash log that looks like this:

Node: workflow_enumerator.funcMRIQC.ICA
Working directory: /N/dc2/scratch/dlevitas/fMRI_data/std/bids/derivatives/mriqc/sub-1004/workflow_enumerator/funcMRIQC/_in_file_..N..dc2..scratch..dlevitas..fMRI_data..std..bids..sub-1004..func..sub-1004_task-std_run-02_bold.nii.gz/ICA

Node inputs:

ICs = <undefined>
approach = <undefined>
args = <undefined>
bg_image = <undefined>
bg_threshold = <undefined>
compress_report = False
cov_weight = <undefined>
dim = <undefined>
dim_est = <undefined>
environ = {'FSLOUTPUTTYPE': 'NIFTI_GZ'}
epsilon = <undefined>
epsilonS = <undefined>
in_files = ['/N/dc2/scratch/dlevitas/fMRI_data/std/bids/derivatives/mriqc/sub-1004/workflow_enumerator/funcMRIQC/_in_file_..N..dc2..scratch..dlevitas..fMRI_data..std..bids..sub-1004..func..sub-1004_task-std_run-02_bold.nii.gz/sanitize/sub-1004_task-std_run-02_bold_valid.nii.gz']
log_power = <undefined>
mask = <undefined>
max_restart = <undefined>
maxit = <undefined>
migp = <undefined>
migpN = <undefined>
migp_factor = <undefined>
migp_shuffle = <undefined>
mix = <undefined>
mm_thresh = <undefined>
no_bet = True
no_mask = True
no_mm = True
non_linearity = <undefined>
num_ICs = <undefined>
out_all = <undefined>
out_dir = <undefined>
out_mean = <undefined>
out_orig = <undefined>
out_pca = <undefined>
out_report = melodic_reportlet.svg
out_stats = <undefined>
out_unmix = <undefined>
out_white = <undefined>
output_type = NIFTI_GZ
pbsc = <undefined>
rem_cmp = <undefined>
remove_deriv = <undefined>
report = <undefined>
report_maps = <undefined>
report_mask = /N/dc2/scratch/dlevitas/fMRI_data/std/bids/derivatives/mriqc/sub-1004/workflow_enumerator/funcMRIQC/fMRIBrainMask/_in_file_..N..dc2..scratch..dlevitas..fMRI_data..std..bids..sub-1004..func..sub-1004_task-std_run-02_bold.nii.gz/erode/sub-1004_task-std_run-02_bold_valid_mcf_tstat_brain_mask_ero.nii.gz
s_con = <undefined>
s_des = <undefined>
sep_vn = <undefined>
sep_whiten = <undefined>
smode = <undefined>
t_con = <undefined>
t_des = <undefined>
tr_sec = <undefined>
update_mask = <undefined>
var_norm = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/legacymultiproc.py", line 69, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 473, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 557, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 637, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 376, in run
    runtime = self._post_run_hook(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/segmentation.py", line 131, in _post_run_hook
    return super(MELODICRPT, self)._post_run_hook(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/mixins/reporting.py", line 47, in _post_run_hook
    self._generate_report()
  File "/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/segmentation.py", line 120, in _generate_report
    report_mask=self.inputs.report_mask)
  File "/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/viz/utils.py", line 597, in plot_melodic_components
    timeseries = np.loadtxt(os.path.join(melodic_dir, "melodic_mix"))
  File "/usr/local/miniconda/lib/python3.7/site-packages/numpy/lib/npyio.py", line 926, in loadtxt
    fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
  File "/usr/local/miniconda/lib/python3.7/site-packages/numpy/lib/_datasource.py", line 262, in open
    return ds.open(path, mode, encoding=encoding, newline=newline)
  File "/usr/local/miniconda/lib/python3.7/site-packages/numpy/lib/_datasource.py", line 618, in open
    raise IOError("%s not found." % path)
OSError: /N/dc2/scratch/dlevitas/fMRI_data/std/bids/derivatives/mriqc/sub-1004/workflow_enumerator/funcMRIQC/_in_file_..N..dc2..scratch..dlevitas..fMRI_data..std..bids..sub-1004..func..sub-1004_task-std_run-02_bold.nii.gz/ICA/melodic_mix not found.

I’ve tried rerunning MRIQC to see if it’s some fluke, but the error persists. The fact that this only occurs on some subjects and not others is making it difficult to diagnose. I was wondering if there are any thoughts on this?

Thanks

This looks like https://github.com/poldracklab/mriqc/issues/779 or a very similar error we are seeing with the same symptoms.

In any case, what is happening is that FSL MELODIC, which is used to extract the ICA components, fails for some reasons (the method may just not converge, or MELODIC fails internally). Long story short, even if MRIQC handled these errors more gracefully (we are working on this), the result is that you can’t have ICA components for that dataset. In other words: you’ll need to run those subjects without the --ica flag.

Sorry about that