Skip to content

Commit 89576e6

Browse files
committed
enh: added version info to fsl, spm and freesurfer
1 parent b2c6696 commit 89576e6

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

nipype/interfaces/freesurfer/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,12 @@ def _gen_fname(self, basename, fname=None, cwd=None, suffix='_fs',
146146
fname = fname_presuffix(basename, suffix=suffix,
147147
use_ext=use_ext, newpath=cwd)
148148
return fname
149+
150+
@property
151+
def version(self):
152+
ver = Info.version()
153+
if ver:
154+
if 'dev' in ver:
155+
return ver.rstrip().split('-')[-1] + '.dev'
156+
else:
157+
return ver.rstrip().split('-v')[-1]

nipype/interfaces/fsl/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def output_type(cls):
113113
try:
114114
return os.environ['FSLOUTPUTTYPE']
115115
except KeyError:
116-
warnings.warn('FSL environment variables not set. setting output type to NIFTI')
116+
warnings.warn(('FSL environment variables not set. setting output '
117+
'type to NIFTI'))
117118
return 'NIFTI'
118119

119120
@staticmethod
@@ -234,6 +235,10 @@ def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True,
234235
use_ext=False, newpath=cwd)
235236
return fname
236237

238+
@property
239+
def version(self):
240+
return Info.version()
241+
237242

238243
def check_fsl():
239244
ver = Info.version()
@@ -248,7 +253,7 @@ def no_fsl():
248253
used with skipif to skip tests that will
249254
fail if FSL is not installed"""
250255

251-
if Info.version() == None:
256+
if Info.version() is None:
252257
return True
253258
else:
254259
return False

nipype/interfaces/spm/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,3 +423,11 @@ def _make_matlab_command(self, contents, postscript=None):
423423
if postscript is not None:
424424
mscript += postscript
425425
return mscript
426+
427+
@property
428+
def version(self):
429+
version_dict = Info.version()
430+
if version_dict:
431+
return '.'.join((version_dict['name'].split('SPM')[-1],
432+
version_dict['release']))
433+
return version_dict

0 commit comments

Comments
 (0)