Skip to content

Commit 19aca5b

Browse files
authored
Merge branch 'master' into enh/revising-popen-calls
2 parents 4a7474a + fcff92d commit 19aca5b

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
Upcoming release
22
================
33

4+
45
0.14.0 (<TBD>)
56
==============
67

78
###### [Full changelog](https://github.com/nipy/nipype/milestone/13)
89

910
* MAINT: Revise use of `subprocess.Popen` (https://github.com/nipy/nipype/pull/2289)
11+
* ENH: Memorize version checks (https://github.com/nipy/nipype/pull/2274, https://github.com/nipy/nipype/pull/2295)
1012

1113

1214
0.14.0rc1 (November 21, 2017)

nipype/interfaces/afni/tests/test_auto_Unifize.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def test_Unifize_inputs():
3232
name_source='in_file',
3333
),
3434
outputtype=dict(),
35+
rbt=dict(argstr='-rbt %f %f %f',
36+
),
3537
scale_file=dict(argstr='-ssave %s',
3638
),
3739
t2=dict(argstr='-T2',

nipype/interfaces/afni/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,14 @@ class UnifizeInputSpec(AFNICommandInputSpec):
23292329
argstr='-EPI',
23302330
requires=['no_duplo', 't2'],
23312331
xor=['gm'])
2332+
rbt = traits.Tuple(
2333+
traits.Float(), traits.Float(), traits.Float(),
2334+
desc='Option for AFNI experts only.'
2335+
'Specify the 3 parameters for the algorithm:\n'
2336+
'R = radius; same as given by option \'-Urad\', [default=18.3]\n'
2337+
'b = bottom percentile of normalizing data range, [default=70.0]\n'
2338+
'r = top percentile of normalizing data range, [default=80.0]\n',
2339+
argstr='-rbt %f %f %f')
23322340

23332341

23342342
class UnifizeOutputSpec(TraitedSpec):

nipype/interfaces/fsl/base.py

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,56 +26,47 @@
2626
2727
"""
2828
from __future__ import print_function, division, unicode_literals, absolute_import
29-
from builtins import open, object
3029

3130
from glob import glob
3231
import os
3332

3433
from ... import logging
3534
from ...utils.filemanip import fname_presuffix
36-
from ..base import traits, isdefined, CommandLine, CommandLineInputSpec
35+
from ..base import traits, isdefined, CommandLine, CommandLineInputSpec, PackageInfo
3736
from ...external.due import BibTeX
3837

3938
IFLOGGER = logging.getLogger('interface')
4039

4140

42-
class Info(object):
43-
"""Handle fsl output type and version information.
44-
45-
version refers to the version of fsl on the system
41+
class Info(PackageInfo):
42+
"""
43+
Handle FSL ``output_type`` and version information.
4644
4745
output type refers to the type of file fsl defaults to writing
4846
eg, NIFTI, NIFTI_GZ
4947
48+
Examples
49+
--------
50+
51+
>>> from nipype.interfaces.fsl import Info
52+
>>> Info.version() # doctest: +SKIP
53+
>>> Info.output_type() # doctest: +SKIP
54+
55+
5056
"""
5157

5258
ftypes = {'NIFTI': '.nii',
5359
'NIFTI_PAIR': '.img',
5460
'NIFTI_GZ': '.nii.gz',
5561
'NIFTI_PAIR_GZ': '.img.gz'}
5662

57-
@staticmethod
58-
def version():
59-
"""Check for fsl version on system
60-
61-
Parameters
62-
----------
63-
None
64-
65-
Returns
66-
-------
67-
version : str
68-
Version number as string or None if FSL not found
63+
if os.getenv('FSLDIR'):
64+
version_file = os.path.join(
65+
os.getenv('FSLDIR'), 'etc', 'fslversion')
6966

70-
"""
71-
# find which fsl being used....and get version from
72-
# /path/to/fsl/etc/fslversion
73-
try:
74-
basedir = os.environ['FSLDIR']
75-
except KeyError:
76-
return None
77-
out = open('%s/etc/fslversion' % (basedir)).read()
78-
return out.strip('\n')
67+
@staticmethod
68+
def parse_version(raw_info):
69+
return raw_info.splitlines()[0]
7970

8071
@classmethod
8172
def output_type_to_ext(cls, output_type):

0 commit comments

Comments
 (0)