Skip to content

Commit 2252579

Browse files
authored
Merge pull request #1730 from nipy/chrisfilo-patch-2
Conform with BIDS Derivatives label names
2 parents 2dcda51 + cb245df commit 2252579

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

nipype/algorithms/confounds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def _run_interface(self, runtime):
182182
if self.inputs.save_all:
183183
out_file = self._gen_fname('dvars', ext='tsv')
184184
np.savetxt(out_file, np.vstack(dvars).T, fmt=b'%0.8f', delimiter=b'\t',
185-
header='std DVARS\tnon-std DVARS\tvx-wise std DVARS')
185+
header='std DVARS\tnon-std DVARS\tvx-wise std DVARS', comments='')
186186
self._results['out_all'] = out_file
187187

188188
return runtime
@@ -255,7 +255,7 @@ def _run_interface(self, runtime):
255255
'out_file': op.abspath(self.inputs.out_file),
256256
'fd_average': float(fd_res.mean())
257257
}
258-
np.savetxt(self.inputs.out_file, fd_res, header='framewise_displacement')
258+
np.savetxt(self.inputs.out_file, fd_res, header='FramewiseDisplacement', comments='')
259259

260260
if self.inputs.save_plot:
261261
tr = None
@@ -364,7 +364,7 @@ def _run_interface(self, runtime):
364364

365365
self._set_header()
366366
np.savetxt(components_file, components, fmt=b"%.10f", delimiter='\t',
367-
header=self._make_headers(components.shape[1]))
367+
header=self._make_headers(components.shape[1]), comments='')
368368
return runtime
369369

370370
def _list_outputs(self):

nipype/algorithms/tests/test_confounds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def test_fd():
2828

2929
with open(res.outputs.out_file) as all_lines:
3030
for line in all_lines:
31-
yield assert_in, 'framewise_displacement', line
31+
yield assert_in, 'FramewiseDisplacement', line
3232
break
3333

34-
yield assert_true, np.allclose(ground_truth, np.loadtxt(res.outputs.out_file), atol=.16)
34+
yield assert_true, np.allclose(ground_truth, np.loadtxt(res.outputs.out_file, skiprows=1), atol=.16)
3535
yield assert_true, np.abs(ground_truth.mean() - res.outputs.fd_average) < 1e-2
3636

3737
rmtree(tempdir)

nipype/interfaces/nilearn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SignalExtractionInputSpec(BaseInterfaceInputSpec):
4848
'with 4D probability maps.')
4949
include_global = traits.Bool(False, usedefault=True,
5050
desc='If True, include an extra column '
51-
'labeled "global", with values calculated from the entire brain '
51+
'labeled "GlobalSignal", with values calculated from the entire brain '
5252
'(instead of just regions).')
5353
detrend = traits.Bool(False, usedefault=True, desc='If True, perform detrending using nilearn.')
5454

@@ -66,7 +66,7 @@ class SignalExtraction(BaseInterface):
6666
>>> seinterface.inputs.in_file = 'functional.nii'
6767
>>> seinterface.inputs.label_files = 'segmentation0.nii.gz'
6868
>>> seinterface.inputs.out_file = 'means.tsv'
69-
>>> segments = ['CSF', 'gray', 'white']
69+
>>> segments = ['CSF', 'GrayMatter', 'WhiteMatter']
7070
>>> seinterface.inputs.class_labels = segments
7171
>>> seinterface.inputs.detrend = True
7272
>>> seinterface.inputs.include_global = True
@@ -129,7 +129,7 @@ def _process_inputs(self):
129129
global_label_data = self._4d(global_label_data, label_data.affine)
130130
global_masker = nl.NiftiLabelsMasker(global_label_data, detrend=self.inputs.detrend)
131131
maskers.insert(0, global_masker)
132-
self.inputs.class_labels.insert(0, 'global')
132+
self.inputs.class_labels.insert(0, 'GlobalSignal')
133133

134134
for masker in maskers:
135135
masker.set_params(detrend=self.inputs.detrend)

nipype/interfaces/tests/test_nilearn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class TestSignalExtraction(unittest.TestCase):
2727
'4d_label_file': '4dlabels.nii',
2828
'out_file': 'signals.tsv'
2929
}
30-
labels = ['csf', 'gray', 'white']
31-
global_labels = ['global'] + labels
30+
labels = ['CSF', 'GrayMatter', 'WhiteMatter']
31+
global_labels = ['GlobalSignal'] + labels
3232

3333
def setUp(self):
3434
self.orig_dir = os.getcwd()

0 commit comments

Comments
 (0)