nipreps / mriqc

Automated Quality Control and visual reports for Quality Assessment of structural (T1w, T2w) and functional MRI of the brain
http://mriqc.readthedocs.io
Apache License 2.0
299 stars 132 forks source link

Avoid unexpected exists when performing T1w images with low qualities #1318

Open Clancy-wu opened 3 months ago

Clancy-wu commented 3 months ago

What happened?

The running crashed in performing T1w image with low quality. I knew that this unexpected exist is because the function returns with empty value, and I have checked the original T1w images of the subject who raised errors (see attachments). However, it would be better if the software could skip this situation and continuing the rest processes, and this failed subject could be described in the html output with errors report instead of interrupting whole processes. As a clinical doctor, we can meet with low quality images in many times, so the sudden interruption of whole processes without skip options would be frustrating a lot.

What command did you use?

docker run -it --rm 
-v /home/clancy/data/xxx/xxx:/work_dir nipreps/mriqc:latest /work_dir/BIDS_155 /work_dir/mriqc_155 participant
--n_procs 10 
--omp-nthreads 10 
-w /work_dir/mriqc_work

What version of the software are you running?

24.0

How are you running this software?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

Node: mriqc_wf.anatMRIQC.ComputeIQMs.measures
Working directory: /work_dir/mriqc_work/mriqc_wf/anatMRIQC/ComputeIQMs/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/measures

Node inputs:

air_msk = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/AirMaskWorkflow/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/ArtifactMask/sub-sub052_T1w_conformed.nii_air.nii.gz
artifact_msk = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/AirMaskWorkflow/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/ArtifactMask/sub-sub052_T1w_conformed.nii_art.nii.gz
head_msk = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/HeadMaskWorkflow/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/GradientThreshold/clipped_corrected_enhanced_grad_gradmask.nii.gz
human = True
in_bias = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/synthstrip_wf/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/post_n4/clipped_bias.nii.gz
in_file = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/conform/sub-sub052_T1w_conformed.nii.gz
in_fwhm = [2.44522, 2.63872, 2.7801]
in_noinu = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/ComputeIQMs/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/harmonize/clipped_corrected_harmonized.nii.gz
in_pvms = ['/work_dir/mriqc_work/mriqc_wf/anatMRIQC/brain_tissue_segmentation/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/segmentation/segment_01.nii.gz', '/work_dir/mriqc_work/mriqc_wf/anatMRIQC/brain_tissue_segmentation/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/segmentation/segment_02.nii.gz', '/work_dir/mriqc_work/mriqc_wf/anatMRIQC/brain_tissue_segmentation/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/segmentation/segment_03.nii.gz']
in_segm = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/brain_tissue_segmentation/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/segmentation/segment.nii.gz
in_tpms = <undefined>
mni_tpms = ['/work_dir/mriqc_work/mriqc_wf/anatMRIQC/SpatialNormalization/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/tpms_std2t1w/mapflow/_tpms_std2t1w0/tpl-MNI152NLin2009cAsym_res-01_label-CSF_probseg_trans.nii.gz', '/work_dir/mriqc_work/mriqc_wf/anatMRIQC/SpatialNormalization/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/tpms_std2t1w/mapflow/_tpms_std2t1w1/tpl-MNI152NLin2009cAsym_res-01_label-GM_probseg_trans.nii.gz', '/work_dir/mriqc_work/mriqc_wf/anatMRIQC/SpatialNormalization/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/tpms_std2t1w/mapflow/_tpms_std2t1w2/tpl-MNI152NLin2009cAsym_res-01_label-WM_probseg_trans.nii.gz']
rot_msk = /work_dir/mriqc_work/mriqc_wf/anatMRIQC/AirMaskWorkflow/_in_file_..work_dir..BIDS_155..sub-sub052..anat..sub-sub052_T1w.nii.gz/RotationMask/sub-sub052_T1w_conformed_rotmask.nii.gz

Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/mriqc/engine/plugin.py", line 64, in run_node
    result['result'] = node.run(updatehash=updatehash)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/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 measures.

Traceback:
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.11/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/mriqc/interfaces/anatomical.py", line 116, in _run_interface
        raise RuntimeError(
    RuntimeError: Input inhomogeneity-corrected data seem empty. MRIQC failed to process this dataset.

Additional information / screenshots

File : BIDS/sub-sub052/anat/sub-sub052_T1w sub-sub052_T1w_BIDS File: fmriprep output file for sub-sub052 (the segmentation looks well in fmriprep_v2314) sub-sub052_fmriprep

oesteban commented 3 months ago

This looks like infant T1w data and this particular image is very challenging to the inhomogeneity correction step. Something is going wrong with it, as you can see with the brain tissue segmentation: WM is missing, only GM and CSF regions are present.

Perhaps infants experts could weigh in and point us at some robust inhomogeneity correction / or perhaps an alternative procedure (such as correcting by means other than N4) -- @mgxd ?

oesteban commented 3 months ago

Given the limited amount of resources, I'm marking this as wontfix and keep infants as a potential future line of development.

Thanks for reporting, and happy to reopen if someone feels they want to contribute to this aspect of MRIQC.

droediger commented 1 month ago

Hi @oesteban, I want to add that I'm getting this same behavior on some adult (well, teenage) T2w images where the gm/wm contrast is fairly poor due to motion. In these cases, I suspect the problem is related to Atropos producing segment_*.nii.gz files where, for example, even the most obviously wm voxels have lower probabilities than usual (in the 0.6 to 0.8 range).

Edit: See this relevant thread from Neurostars.

oesteban commented 3 weeks ago

Thanks @droediger, I'll have a look.