Skip to content

Commit 01b27fc

Browse files
authored
Merge pull request #2253 from effigies/fix/confounds-plot
TRACK: Revise confounds in confounds-correlation plots
2 parents 3ca515c + 8731b22 commit 01b27fc

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
20.1.2 (September 04, 2020)
2+
===========================
3+
Bug-fix release in the 20.1.x series.
4+
5+
* FIX: Revise confounds in confounds-correlation plots (#2252)
6+
* FIX: Coerce license path to pathlike (#2180)
7+
* DOC: Update new sMRIPrep location (#2211)
8+
19
20.1.1 (June 04, 2020)
210
======================
311
Bug-fix release in the 20.1.x series.

fmriprep/workflows/bold/confounds.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ def init_bold_confs_wf(
241241
acompcor.inputs.repetition_time = metadata['RepetitionTime']
242242

243243
# Global and segment regressors
244-
gs_select = pe.Node(niu.Select(index=[0, 1]), name="gs_select",
245-
run_without_submitting=True)
246-
signals_class_labels = ["csf", "white_matter", "global_signal"]
247-
merge_rois = pe.Node(niu.Merge(2, ravel_inputs=True), name='merge_rois',
244+
signals_class_labels = [
245+
"global_signal", "csf", "white_matter", "csf_wm", "tcompcor",
246+
]
247+
merge_rois = pe.Node(niu.Merge(3, ravel_inputs=True), name='merge_rois',
248248
run_without_submitting=True)
249249
signals = pe.Node(SignalExtraction(class_labels=signals_class_labels),
250250
name="signals", mem_gb=mem_gb)
@@ -316,7 +316,7 @@ def init_bold_confs_wf(
316316

317317
# Generate reportlet (Confound correlation)
318318
conf_corr_plot = pe.Node(
319-
ConfoundsCorrelationPlot(reference_column='global_signal', max_dim=70),
319+
ConfoundsCorrelationPlot(reference_column='global_signal', max_dim=20),
320320
name='conf_corr_plot')
321321
ds_report_conf_corr = pe.Node(
322322
DerivativesDataSink(desc='confoundcorr', datatype="figures", dismiss_entities=("echo",)),
@@ -326,6 +326,13 @@ def init_bold_confs_wf(
326326
def _last(inlist):
327327
return inlist[-1]
328328

329+
def _select_cols(table):
330+
import pandas as pd
331+
return [
332+
col for col in pd.read_table(table, nrows=2).columns
333+
if not col.startswith(("a_comp_cor_", "t_comp_cor_", "std_dvars"))
334+
]
335+
329336
workflow.connect([
330337
# connect inputnode to each non-anatomical confound node
331338
(inputnode, dvars, [('bold', 'in_file'),
@@ -351,9 +358,9 @@ def _last(inlist):
351358
("bold_mask", "mask_files")]),
352359
# Global signals extraction (constrained by anatomy)
353360
(inputnode, signals, [('bold', 'in_file')]),
354-
(acc_msk_bin, gs_select, [('out_file', 'inlist')]),
355-
(gs_select, merge_rois, [('out', 'in1')]),
356-
(inputnode, merge_rois, [('bold_mask', 'in2')]),
361+
(inputnode, merge_rois, [('bold_mask', 'in1')]),
362+
(acc_msk_bin, merge_rois, [('out_file', 'in2')]),
363+
(tcompcor, merge_rois, [('high_variance_masks', 'in3')]),
357364
(merge_rois, signals, [('out', 'label_files')]),
358365

359366
# Collate computed confounds together
@@ -395,7 +402,8 @@ def _last(inlist):
395402
(acompcor, mrg_cc_metadata, [('metadata_file', 'in2')]),
396403
(mrg_cc_metadata, compcor_plot, [('out', 'metadata_files')]),
397404
(compcor_plot, ds_report_compcor, [('out_file', 'in_file')]),
398-
(concat, conf_corr_plot, [('confounds_file', 'confounds_file')]),
405+
(concat, conf_corr_plot, [('confounds_file', 'confounds_file'),
406+
(('confounds_file', _select_cols), 'columns')]),
399407
(conf_corr_plot, ds_report_conf_corr, [('out_file', 'in_file')]),
400408
])
401409

0 commit comments

Comments
 (0)