Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions fmriprep/workflows/bold/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ def init_bold_confs_wf(
acompcor.inputs.repetition_time = metadata['RepetitionTime']

# Global and segment regressors
signals_class_labels = ["csf", "white_matter", "global_signal"]
mrg_lbl = pe.Node(niu.Merge(3), name='merge_rois', run_without_submitting=True)
signals_class_labels = [
"csf", "white_matter", "global_signal", "csf_wm", "tcompcor",
]
mrg_lbl = pe.Node(niu.Merge(5), name='merge_rois', run_without_submitting=True)
signals = pe.Node(SignalExtraction(class_labels=signals_class_labels),
name="signals", mem_gb=mem_gb)

Expand Down Expand Up @@ -320,7 +322,7 @@ def init_bold_confs_wf(

# Generate reportlet (Confound correlation)
conf_corr_plot = pe.Node(
ConfoundsCorrelationPlot(reference_column='global_signal', max_dim=70),
ConfoundsCorrelationPlot(reference_column='global_signal', max_dim=20),
name='conf_corr_plot')
ds_report_conf_corr = pe.Node(
DerivativesDataSink(desc='confoundcorr', datatype="figures", dismiss_entities=("echo",)),
Expand All @@ -333,6 +335,13 @@ def _pick_csf(files):
def _pick_wm(files):
return files[1] # after smriprep#189, this is BIDS-compliant.

def _select_cols(table):
import pandas as pd
return [
col for col in pd.read_table(table, nrows=2).columns
if not col.startswith(("a_comp_cor_", "t_comp_cor_", "std_dvars"))
]

workflow.connect([
# Massage ROIs (in T1w space)
(inputnode, acc_tpm, [('t1w_tpms', 'in_files')]),
Expand Down Expand Up @@ -387,6 +396,8 @@ def _pick_wm(files):
(wm_tfm, wm_msk, [('output_image', 'roi_file')]),
(wm_msk, mrg_lbl, [('out', 'in2')]),
(inputnode, mrg_lbl, [('bold_mask', 'in3')]),
(acc_msk, mrg_lbl, [('out', 'in4')]),
(tcompcor, mrg_lbl, [('high_variance_masks', 'in5')]),
(mrg_lbl, signals, [('out', 'label_files')]),

# Collate computed confounds together
Expand Down Expand Up @@ -428,7 +439,8 @@ def _pick_wm(files):
(acompcor, mrg_cc_metadata, [('metadata_file', 'in2')]),
(mrg_cc_metadata, compcor_plot, [('out', 'metadata_files')]),
(compcor_plot, ds_report_compcor, [('out_file', 'in_file')]),
(concat, conf_corr_plot, [('confounds_file', 'confounds_file')]),
(concat, conf_corr_plot, [('confounds_file', 'confounds_file'),
(('confounds_file', _select_cols), 'columns')]),
(conf_corr_plot, ds_report_conf_corr, [('out_file', 'in_file')]),
])

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ install_requires =
nipype >= 1.4
nitime
nitransforms >= 20.0.0rc3,<20.2
niworkflows ~= 1.2.5
niworkflows ~= 1.2.8
numpy
pandas
psutil >= 5.4
Expand Down