Skip to content

Commit f15c091

Browse files
authored
Merge pull request #843 from tsalo/nss-confounds-plot
Add `ignore_initial_volumes` param to `ConfoundsCorrelationPlot`
2 parents 546f143 + b243fdf commit f15c091

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

niworkflows/interfaces/plotting.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ class _ConfoundsCorrelationPlotInputSpec(BaseInterfaceInputSpec):
195195
"correlation with `reference_column` will be "
196196
"selected.",
197197
)
198+
ignore_initial_volumes = traits.Int(
199+
0,
200+
usedefault=True,
201+
desc="Number of non-steady-state volumes at the beginning of the scan "
202+
"to ignore.",
203+
)
198204

199205

200206
class _ConfoundsCorrelationPlotOutputSpec(TraitedSpec):
@@ -223,6 +229,7 @@ def _run_interface(self, runtime):
223229
max_dim=self.inputs.max_dim,
224230
output_file=self._results["out_file"],
225231
reference=self.inputs.reference_column,
232+
ignore_initial_volumes=self.inputs.ignore_initial_volumes,
226233
)
227234
return runtime
228235

niworkflows/tests/test_confounds.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def test_ConfoundsCorrelationPlot():
178178
"""confounds correlation report test"""
179179
confounds_file = os.path.join(datadir, "confounds_test.tsv")
180180
cc_rpt = ConfoundsCorrelationPlot(
181-
confounds_file=confounds_file, reference_column="a",
181+
confounds_file=confounds_file, reference_column="a", ignore_initial_volumes=1,
182182
)
183183
_smoke_test_report(cc_rpt, "confounds_correlation.svg")
184184

@@ -187,6 +187,9 @@ def test_ConfoundsCorrelationPlotColumns():
187187
"""confounds correlation report test"""
188188
confounds_file = os.path.join(datadir, "confounds_test.tsv")
189189
cc_rpt = ConfoundsCorrelationPlot(
190-
confounds_file=confounds_file, reference_column="a", columns=["b", "d", "f"],
190+
confounds_file=confounds_file,
191+
reference_column="a",
192+
columns=["b", "d", "f"],
193+
ignore_initial_volumes=0,
191194
)
192195
_smoke_test_report(cc_rpt, "confounds_correlation_cols.svg")

niworkflows/viz/plots.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,7 @@ def confounds_correlation_plot(
861861
max_dim=20,
862862
output_file=None,
863863
reference="global_signal",
864+
ignore_initial_volumes=0,
864865
):
865866
"""
866867
Generate a bar plot with the correlation of confounds.
@@ -889,6 +890,8 @@ def confounds_correlation_plot(
889890
of each confound regressor with a reference column. By default, this
890891
is the global signal (so that collinearities with the global signal
891892
can readily be assessed).
893+
ignore_initial_volumes : :obj:`int`
894+
Number of non-steady-state volumes at the beginning of the scan to ignore.
892895
893896
Returns
894897
-------

0 commit comments

Comments
 (0)