MRIQC IndexError

mriqc

#1

Hi, I’m using mriqc v0.14.2, and it keeps crashing with this “IndexError: list index out of range” error. The crash happened for some of the subjects in entirety (all of the runs), and partially for other subjects (some of the runs), but for some subjects it didn’t crash at all. Here’s an example of the error log:

Node: workflow_enumerator.funcMRIQC.ReportsWorkflow.GenerateReport
Working directory: /hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/GenerateReport

Node inputs:

function_str = def individual_html(in_iqms, in_plots=None, api_id=None):
from pathlib import Path
import datetime
from json import load
from mriqc import logging, version as ver
from mriqc.utils.misc import BIDS_COMP
from mriqc.reports import REPORT_TITLES
from mriqc.reports.utils import iqms2html, read_report_snippet
from mriqc.data import IndividualTemplate

report_log = logging.getLogger('mriqc.report')

def _get_details(in_iqms, modality):
    in_prov = in_iqms.pop('provenance', {})
    warn_dict = in_prov.pop('warnings', None)
    sett_dict = in_prov.pop('settings', None)

    wf_details = []
    if modality == 'bold':
        bold_exclude_index = in_iqms.get('dumb_trs')
        if bold_exclude_index is None:
            report_log.warning('Building bold report: no exclude index was found')
        elif bold_exclude_index > 0:
            msg = """\

Non-steady state (strong T1 contrast) has been detected in the
first {} volumes
. They were excluded before generating any QC measures and plots."""
wf_details.append(msg.format(bold_exclude_index))

        hmc_fsl = sett_dict.pop('hmc_fsl')
        if hmc_fsl is not None:
            msg = 'Framewise Displacement was computed using '
            if hmc_fsl:
                msg += 'FSL <code>mcflirt</code>'
            else:
                msg += 'AFNI <code>3dvolreg</code>'
            wf_details.append(msg)

        fd_thres = sett_dict.pop('fd_thres')
        if fd_thres is not None:
            wf_details.append(
                'Framewise Displacement threshold was defined at %f mm' % fd_thres)
    elif modality in ('T1w', 'T2w'):
        if warn_dict.pop('small_air_mask', False):
            wf_details.append(
                '<span class="problematic">Detected hat mask was too small</span>')

        if warn_dict.pop('large_rot_frame', False):
            wf_details.append(
                '<span class="problematic">Detected a zero-filled frame, has the original '
                'image been rotated?</span>')

    return in_prov, wf_details, sett_dict

in_iqms = Path(in_iqms)
with in_iqms.open() as jsonfile:
    iqms_dict = load(jsonfile)

# Now, the in_iqms file should be correctly named
out_file = str(Path(in_iqms.with_suffix(".html").name).resolve())

# Extract and prune metadata
metadata = iqms_dict.pop('bids_meta', None)
mod = metadata.pop('modality', None)
prov, wf_details, _ = _get_details(iqms_dict, mod)

file_id = [metadata.pop(k, None)
           for k in list(BIDS_COMP.keys())]
file_id = [comp for comp in file_id if comp is not None]

if in_plots is None:
    in_plots = []
else:
    if any(('melodic_reportlet' in k for k in in_plots)):
        REPORT_TITLES['bold'].insert(3, 'ICA components')

    in_plots = [(REPORT_TITLES[mod][i], read_report_snippet(v))
                for i, v in enumerate(in_plots)]

pred_qa = None  # metadata.pop('mriqc_pred', None)
config = {
    'modality': mod,
    'dataset': metadata.pop('dataset', None),
    'bids_name': in_iqms.with_suffix("").name,
    'timestamp': datetime.datetime.now().strftime("%Y-%m-%d, %H:%M"),
    'version': ver,
    'imparams': iqms2html(iqms_dict, 'iqms-table'),
    'svg_files': in_plots,
    'workflow_details': wf_details,
    'webapi_url': prov.pop('webapi_url'),
    'webapi_port': prov.pop('webapi_port'),
    'provenance': iqms2html(prov, 'provenance-table'),
    'md5sum': prov['md5sum'],
    'metadata': iqms2html(metadata, 'metadata-table'),
    'pred_qa': pred_qa
}

if config['metadata'] is None:
    config['workflow_details'].append(
        '<span class="warning">File has no metadata</span> '
        '<span>(sidecar JSON file missing or empty)</span>')

tpl = IndividualTemplate()
tpl.generate_conf(config, out_file)

report_log.info('Generated individual log (%s)', out_file)
return out_file

in_iqms = /hpc/mriqc/sub-1114/func/sub-1114_task-maze_rec-prenorm_run-10_bold.json
in_plots = [’/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/PlotMosaicMean/plot_func_mean_mosaic1.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/PlotMosaicSD/plot_func_stddev_mosaic2_stddev.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/BigPlot/sub-1114_task-maze_rec-prenorm_run-10_bold_valid_volreg_fmriplot.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/PlotSpikes/plot_spikes.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/ICA/melodic_reportlet.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/PlotMosaicZoomed/plot_anat_mosaic1_zoomed.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/PlotMosaicNoise/plot_anat_mosaic2_noise.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/ReportsWorkflow/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/PlotBrainmask/plot_bmask_contours.svg’, ‘/hpc/temp2/workflow_enumerator/funcMRIQC/SpatialNormalization/in_file…hpc…bids…sub-1114…func…sub-1114_task-maze_rec-prenorm_run-10_bold.nii.gz/EPI2MNI/report.svg’]

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 471, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 555, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_command
result = self._interface.run(cwd=outdir)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/interfaces/base/core.py”, line 521, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/interfaces/utility/wrappers.py”, line 144, in _run_interface
out = function_handle(**args)
File “”, line 77, in individual_html
File “”, line 77, in
IndexError: list index out of range

How can I solve this problem?