Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignore_initial_volumes param to ConfoundsCorrelationPlot #843

Merged
merged 2 commits into from
Dec 6, 2023
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
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