shnizzedy / C-PAC

Configurable Pipeline for the Analysis of Connectomes
GNU Lesser General Public License v3.0
1 stars 0 forks source link

🐛 `gen_motion_stats` not getting all necessary parameters #2

Closed shnizzedy closed 4 years ago

shnizzedy commented 4 years ago

Describe the bug

https://github.com/shnizzedy/C-PAC/blob/33e22b281e907f1008da0371a15513047cfabd11/CPAC/pipeline/cpac_pipeline.py#L2202-L2218

200606-00:00:33,108 nipype.workflow ERROR:
     could not run node: resting_preproc_2014113_1.gen_motion_stats_None_None_None_0.calc_motion_parameters.b0
200606-00:00:33,108 nipype.workflow ERROR:
     could not run node: resting_preproc_2014113_1.gen_motion_stats_None_None_None_0.calc_power_parameters.b0
200606-00:00:33,109 nipype.workflow ERROR:
     could not run node: resting_preproc_2014113_1.gen_motion_stats_None_None_None_0.calculate_FDJ

Versions

Additional context This may be fixed in https://github.com/FCP-INDI/C-PAC/pull/1288

shnizzedy commented 4 years ago

Possibly related: https://github.com/FCP-INDI/C-PAC/issues/1149

shnizzedy commented 4 years ago
Traceback (most recent call last):

  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/linear.py", line 44, in run
    node.run(updatehash=updatehash)

  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 471, in run
    result = self._run_interface(execute=True)

  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 555, in _run_interface
    return self._run_command(execute)

  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_command
    result = self._interface.run(cwd=outdir)

  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 521, in run
    runtime = self._run_interface(runtime)

  File "/code/CPAC/utils/interfaces/function.py", line 152, in _run_interface
    out = function_handle(**args)

  File "/code/CPAC/nuisance/nuisance.py", line 267, in gather_nuisance
    raise ValueError("Regressor type Censor specified in selectors but "

ValueError: Regressor type Censor specified in selectors but the corresponding file was not found!
shnizzedy commented 4 years ago

When we get to the block that's throwing the error

https://github.com/shnizzedy/C-PAC/blob/379277ebabdcff897d377ea23faed0721f9bef27/CPAC/nuisance/nuisance.py#L260-L269

selector['Censor'] looks like

{'method': 'SpikeRegression', 'number_of_previous_trs_to_censor': 1, 'number_of_subsequent_trs_to_censor': 2, 'thresholds': [{'type': 'FD_P', 'value': 0.5}]}

which seems reasonable.

shnizzedy commented 4 years ago

The whole selector looks like

{
    'Bandpass': {
        'bottom_frequency': 0.009,
        'top_frequency': 0.08
    },
    'Censor': {
        'method': 'SpikeRegression',
        'number_of_previous_trs_to_censor': 1,
        'number_of_subsequent_trs_to_censor': 2,
        'thresholds': [{
            'type': 'FD_P',
            'value': 0.5
        }]
    },
    'CerebrospinalFluid': {
        'erode_mask': True,
        'extraction_resolution': 2,
        'summary': {
            'filter': 'Mean',
            'method': 'Mean'
        }
    },
    'GlobalSignal': {
        'summary': {
            'filter': 'Mean',
            'method': 'Mean'
        }
    },
    'Motion': {
        'include_delayed': True,
        'include_delayed_squared': True,
        'include_squared': True
    },
    'PolyOrt': {
        'degree': 2
    },
    'WhiteMatter': {
        'erode_mask': True,
        'extraction_resolution': 2,
        'summary': {
            'filter': 'Mean',
            'method': 'Mean'
        }
    },
    'aCompCor': {
        'extraction_resolution': 2,
        'summary': {
            'components': 5,
            'method': 'DetrendPC'
        },
        'tissues': ['WhiteMatter', 'CerebrospinalFluid']
    }
}
shnizzedy commented 4 years ago

Progress (I think). With the most recent image, I'm hitting the issue of empty roi_stats.csv files mentioned in https://github.com/FCP-INDI/C-PAC/issues/1140#issuecomment-575400720 & https://github.com/FCP-INDI/C-PAC/issues/1201#issuecomment-589827997

shnizzedy commented 4 years ago

Here's the full set of kwargs that are getting through:

{'functional_file_path': '/home/circleci/project/outputs/working/resting_preproc_A00040640_NFB3/func_preproc_afni_mean_3dvolreg_0/_scan_MSIT/func_normalize/sub-A00040640_ses-NFB3_task-MSIT_bold_calc_tshift_resample_volreg_calc_maths.nii.gz',
 'selector': {'Bandpass': {'bottom_frequency': 0.009, 'top_frequency': 0.08},
  'Censor': {'method': 'SpikeRegression',
   'number_of_previous_trs_to_censor': 1,
   'number_of_subsequent_trs_to_censor': 2,
   'thresholds': [{'type': 'FD_P', 'value': 0.5}]},
  'CerebrospinalFluid': {'erode_mask': True,
   'extraction_resolution': 2,
   'summary': {'filter': 'Mean', 'method': 'Mean'}},
  'GlobalSignal': {'summary': {'filter': 'Mean', 'method': 'Mean'}},
  'Motion': {'include_delayed': True,
   'include_delayed_squared': True,
   'include_squared': True},
  'PolyOrt': {'degree': 2},
  'WhiteMatter': {'erode_mask': True,
   'extraction_resolution': 2,
   'summary': {'filter': 'Mean', 'method': 'Mean'}},
  'aCompCor': {'extraction_resolution': 2,
   'summary': {'components': 5, 'method': 'DetrendPC'},
   'tissues': ['WhiteMatter', 'CerebrospinalFluid']}},
 'grey_matter_summary_file_path': None,
 'white_matter_summary_file_path': '/home/circleci/project/outputs/working/resting_preproc_A00040640_NFB3/nuisance_regressor_1_0/_scan_MSIT/_selector_WM-2mmE-M_CSF-2mmE-M_aC-CSF+WM-2mm-DPC5_G-M_M-SDB_P-2_BP-B0.009-T0.08_C-S-1+2-FD-P0.5/WhiteMatter_mean/roi_stats.csv',
 'csf_summary_file_path': '/home/circleci/project/outputs/working/resting_preproc_A00040640_NFB3/nuisance_regressor_1_0/_scan_MSIT/_selector_WM-2mmE-M_CSF-2mmE-M_aC-CSF+WM-2mm-DPC5_G-M_M-SDB_P-2_BP-B0.009-T0.08_C-S-1+2-FD-P0.5/CerebrospinalFluid_mean/roi_stats.csv',
 'acompcor_file_path': '/home/circleci/project/outputs/working/resting_preproc_A00040640_NFB3/nuisance_regressor_1_0/_scan_MSIT/_selector_WM-2mmE-M_CSF-2mmE-M_aC-CSF+WM-2mm-DPC5_G-M_M-SDB_P-2_BP-B0.009-T0.08_C-S-1+2-FD-P0.5/aCompCor_DetrendPC/compcor_regressors.1D',
 'tcompcor_file_path': None,
 'global_summary_file_path': '/home/circleci/project/outputs/working/resting_preproc_A00040640_NFB3/nuisance_regressor_1_0/_scan_MSIT/_selector_WM-2mmE-M_CSF-2mmE-M_aC-CSF+WM-2mm-DPC5_G-M_M-SDB_P-2_BP-B0.009-T0.08_C-S-1+2-FD-P0.5/GlobalSignal_mean/roi_stats.csv',
 'motion_parameters_file_path': '/home/circleci/project/outputs/working/resting_preproc_A00040640_NFB3/func_preproc_afni_mean_3dvolreg_0/_scan_MSIT/func_motion_correct_3dvolreg/sub-A00040640_ses-NFB3_task-MSIT_bold_calc_tshift_resample.1D',
 'custom_file_paths': None,
 'censor_file_path': None}
shnizzedy commented 4 years ago

This issue is resolved in https://github.com/FCP-INDI/C-PAC/pull/1288 + https://github.com/FCP-INDI/C-PAC/pull/1289 + https://github.com/FCP-INDI/C-PAC/pull/1304 + https://github.com/FCP-INDI/C-PAC/pull/1305