Skip to content

Commit

Permalink
Merge pull request #843 from tsalo/nss-confounds-plot
Browse files Browse the repository at this point in the history
Add `ignore_initial_volumes` param to `ConfoundsCorrelationPlot`
  • Loading branch information
effigies authored Dec 6, 2023
2 parents 546f143 + b243fdf commit f15c091
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions niworkflows/interfaces/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions niworkflows/tests/test_confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")
3 changes: 3 additions & 0 deletions niworkflows/viz/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
-------
Expand Down

0 comments on commit f15c091

Please sign in to comment.