Skip to content

[FIX] Minor fixes for the NonSteadyStateDetector #1926

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

Merged
merged 3 commits into from
Apr 3, 2017
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
6 changes: 3 additions & 3 deletions nipype/algorithms/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,19 +599,19 @@ class NonSteadyStateDetector(BaseInterface):
output_spec = NonSteadyStateDetectorOutputSpec

def _run_interface(self, runtime):
in_nii = nb.load(self.inputs.in_plots)
in_nii = nb.load(self.inputs.in_file)
global_signal = in_nii.get_data()[:,:,:,:50].mean(axis=0).mean(axis=0).mean(axis=0)

self._results = {
'out_file': _is_outlier(global_signal)
'n_volumes_to_discard': _is_outlier(global_signal)
}

return runtime

def _list_outputs(self):
return self._results

def _is_outlier(points, thresh=3.5):
def is_outlier(points, thresh=3.5):
"""
Returns a boolean array with True if points are outliers and False
otherwise.
Expand Down
4 changes: 2 additions & 2 deletions nipype/algorithms/tests/test_confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from nipype.testing import example_data
from nipype.algorithms.confounds import FramewiseDisplacement, ComputeDVARS, \
_is_outlier
is_outlier
import numpy as np


Expand Down Expand Up @@ -71,5 +71,5 @@ def test_outliers(tmpdir):
in_data = np.random.randn(100)
in_data[0] += 10

assert _is_outlier(in_data) == 1
assert is_outlier(in_data) == 1