Skip to content

Commit 6b312fa

Browse files
committed
chore: cosmetic changes & deduplicate _pop definition in ants
cc/ https://github.com/nipreps/niworkflows/pull/408/files#r330252779
1 parent bc6a020 commit 6b312fa

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

niworkflows/anat/ants.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from nipype.interfaces.fsl.maths import ApplyMask
1616
from nipype.interfaces.ants import N4BiasFieldCorrection, Atropos, MultiplyImages
1717

18-
from ..utils.misc import get_template_specs
18+
from ..utils.misc import get_template_specs, select_first as _pop
1919

2020
# niworkflows
2121
from ..interfaces.ants import (
@@ -897,12 +897,6 @@ def init_n4_only_wf(
897897
return wf
898898

899899

900-
def _pop(in_files):
901-
if isinstance(in_files, (list, tuple)):
902-
return in_files[0]
903-
return in_files
904-
905-
906900
def _select_labels(in_segm, labels):
907901
from os import getcwd
908902
import numpy as np

niworkflows/utils/misc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,13 @@ def splitext(fname):
215215
def select_first(in_files):
216216
"""
217217
Select the first file from a list of filenames.
218+
218219
Used to grab the first echo's file when processing
219220
multi-echo data through workflows that only accept
220221
a single file.
221222
223+
Examples
224+
--------
222225
>>> select_first('some/file.nii.gz')
223226
'some/file.nii.gz'
224227
>>> select_first(['some/file1.nii.gz', 'some/file2.nii.gz'])
@@ -227,8 +230,7 @@ def select_first(in_files):
227230
"""
228231
if isinstance(in_files, (list, tuple)):
229232
return in_files[0]
230-
else:
231-
return in_files
233+
return in_files
232234

233235

234236
def _copy_any(src, dst):

0 commit comments

Comments
 (0)