FCP-INDI / C-PAC

Configurable Pipeline for the Analysis of Connectomes
https://fcp-indi.github.io/
GNU Lesser General Public License v3.0
64 stars 41 forks source link

🐛 [User-reported Bug] Pipeline Check Fails when Not Running Brain Extraction #1783

Open nimzodisaster opened 2 years ago

nimzodisaster commented 2 years ago

Describe the bug

Have anatomical image that are already brain stripped. So I set flags in the configuration:

 brain_extraction:
    run: false

and

registration_workflows:
  anatomical_registration:
    run: true
    resolution_for_anat: 2mm
    T1w_brain_template: >-
      /usr/share/fsl/5.0/data/standard/MNI152_T1_${resolution_for_anat}_brain.nii.gz
    T1w_template: '/usr/share/fsl/5.0/data/standard/MNI152_T1_${resolution_for_anat}.nii.gz'
    T1w_brain_template_mask: >-
      /usr/share/fsl/5.0/data/standard/MNI152_T1_${resolution_for_anat}_brain_mask.nii.gz
    reg_with_skull: false

This error appears during the pipeline check.

221001-17:18:24,190 nipype.workflow INFO:
     Connecting n4_bias_correction...
221001-17:18:24,193 nipype.workflow INFO:
     Connecting register_ANTs_anat_to_template...
Process Process-1:
Traceback (most recent call last):
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 1376, in build_workflow
    wf = connect_pipeline(wf, cfg, rpool, pipeline_blocks)
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 1064, in connect_pipeline
    wf = nb.connect_block(wf, cfg, rpool)
  File "/code/CPAC/pipeline/engine.py", line 1277, in connect_block
    pipe_x, opt)
  File "/code/CPAC/registration/registration.py", line 2213, in register_ANTs_anat_to_template
    report_fetched=True)
  File "/code/CPAC/pipeline/engine.py", line 293, in get_data
    report_fetched=report_fetched)
  File "/code/CPAC/pipeline/engine.py", line 269, in get
    raise LookupError(info_msg)
LookupError: When trying to connect node block 'register_FSL_anat_to_template' to workflow 'cpac_107738-100_2_ses-1' after node block 'brain_extraction_T2': 

[!] C-PAC says: None of the listed resources are in the resource pool:

  ['desc-brain_T1w', 'space-longitudinal_desc-brain_T1w']

Options:
- You can enable a node block earlier in the pipeline which produces these resources. Check the 'outputs:' field in a node block's documentation.
- You can directly provide this required data by pulling it from another BIDS directory using 'source_outputs_dir:' in the pipeline configuration, or by placing it directly in your C-PAC output directory.
- If you have done these, and you still get this message, please let us know through any of our support channels at: https://fcp-indi.github.io/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/local/miniconda/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 443, in run_workflow
    subject_id, sub_dict, c, p_name, num_ants_cores
  File "/code/CPAC/pipeline/cpac_pipeline.py", line 1380, in build_workflow
    errorstrings.index('[!] C-PAC says: The listed resource is not '
ValueError: '[!] C-PAC says: The listed resource is not in the resource pool:' is not in list
Traceback (most recent call last):
  File "/code/run.py", line 807, in <module>
    run_main()
  File "/code/run.py", line 788, in run_main
    test_config=(1 if args.analysis_level == "test_config" else 0)
  File "/code/CPAC/pipeline/cpac_runner.py", line 640, in run
    exitcode = exitcode or pid.exitcode
AttributeError: '_io.TextIOWrapper' object has no attribute 'exitcode'

To reproduce

No response

Preconfig

Custom pipeline configuration

No response

Run command

No response

Expected behavior

should not run brain extraction and should set inputs to output

Acceptance criteria

should not run brain extraction and should set inputs to output

Screenshots

No response

C-PAC version

1.8.4

Container platform

No response

Docker and/or Singularity version(s)

No response

Additional context

No response

sgiavasis commented 2 years ago

Hi @nimzodisaster,

Thank you for reporting this. First of all quick question - these already skull-stripped T1w's - are the brain-only images already in your input data directory, with CPAC pointing directly to them?

For example, if you open the CPAC data config YAML that gets generated and written out to the pipeline directory, is it listing the T1w nifti files that are already skull-stripped?

nimzodisaster commented 2 years ago

Yes. The site directory contains skull stripped brain mprage, but skull on funcs. I compared preproc anat outputs have more skull/tissue removed than I started with (actually an improvement in most cases, but not the intended output.). I do not know if this effects the functional preproc pipeline

sgiavasis commented 2 years ago

Okay, got it. This is an issue with flexibility and ingressing processed data. The short term part, in the next upcoming release we'll expand which data the registration block can pull in (it's expecting desc-brain_ which gets produced either from the extraction blocks, or if someone has this in their data directory with that specific naming).

The long term part, we'd like to make this kind of thing more seamless for users. So I'd like to hear what you think would be a good UX flow for this. Example, updating the sidecar JSON's to read SkullStripped: True via BIDS, or would this be too cumbersome? Would you prefer a flag in the data config or pipeline config for certain caveats like this? etc.