From 510261752d90ce96dc7046400890fa02582e8be2 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 6 Dec 2023 10:10:01 -0500 Subject: [PATCH 1/2] Add nss param to ConfoundsCorrelationPlot. --- niworkflows/interfaces/plotting.py | 7 +++++++ niworkflows/viz/plots.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/niworkflows/interfaces/plotting.py b/niworkflows/interfaces/plotting.py index c37aa9b1d3b..79fe0a29042 100644 --- a/niworkflows/interfaces/plotting.py +++ b/niworkflows/interfaces/plotting.py @@ -195,6 +195,12 @@ class _ConfoundsCorrelationPlotInputSpec(BaseInterfaceInputSpec): "correlation with `reference_column` will be " "selected.", ) + ignore_initial_volumes = traits.Int( + 0, + usedefault=True, + desc="Number of non-steady-state volumes at the beginning of the scan " + "to ignore.", + ) class _ConfoundsCorrelationPlotOutputSpec(TraitedSpec): @@ -223,6 +229,7 @@ def _run_interface(self, runtime): max_dim=self.inputs.max_dim, output_file=self._results["out_file"], reference=self.inputs.reference_column, + ignore_initial_volumes=self.inputs.ignore_initial_volumes, ) return runtime diff --git a/niworkflows/viz/plots.py b/niworkflows/viz/plots.py index b725c1bb6c0..ebcf90ebe2b 100644 --- a/niworkflows/viz/plots.py +++ b/niworkflows/viz/plots.py @@ -861,6 +861,7 @@ def confounds_correlation_plot( max_dim=20, output_file=None, reference="global_signal", + ignore_initial_volumes=0, ): """ Generate a bar plot with the correlation of confounds. @@ -889,6 +890,8 @@ def confounds_correlation_plot( of each confound regressor with a reference column. By default, this is the global signal (so that collinearities with the global signal can readily be assessed). + ignore_initial_volumes : :obj:`int` + Number of non-steady-state volumes at the beginning of the scan to ignore. Returns ------- From b243fdf072b567453ce07c02f8dad9fb76d988aa Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 6 Dec 2023 10:12:01 -0500 Subject: [PATCH 2/2] Use new param in tests. --- niworkflows/tests/test_confounds.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/niworkflows/tests/test_confounds.py b/niworkflows/tests/test_confounds.py index 99f2dd89c62..0cd871a417f 100644 --- a/niworkflows/tests/test_confounds.py +++ b/niworkflows/tests/test_confounds.py @@ -178,7 +178,7 @@ def test_ConfoundsCorrelationPlot(): """confounds correlation report test""" confounds_file = os.path.join(datadir, "confounds_test.tsv") cc_rpt = ConfoundsCorrelationPlot( - confounds_file=confounds_file, reference_column="a", + confounds_file=confounds_file, reference_column="a", ignore_initial_volumes=1, ) _smoke_test_report(cc_rpt, "confounds_correlation.svg") @@ -187,6 +187,9 @@ def test_ConfoundsCorrelationPlotColumns(): """confounds correlation report test""" confounds_file = os.path.join(datadir, "confounds_test.tsv") cc_rpt = ConfoundsCorrelationPlot( - confounds_file=confounds_file, reference_column="a", columns=["b", "d", "f"], + confounds_file=confounds_file, + reference_column="a", + columns=["b", "d", "f"], + ignore_initial_volumes=0, ) _smoke_test_report(cc_rpt, "confounds_correlation_cols.svg")