File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,23 @@ def version():
3737 Version number as string or None if AFNI not found
3838
3939 """
40+ import re
4041 clout = CommandLine (command = 'afni_vcheck' ,
4142 terminal_output = 'allatonce' ).run ()
42- out = clout .runtime .stdout
43- return out .split ('\n ' )[1 ]
43+ out = clout .runtime .stdout .split ('\n ' )[1 ]
44+
45+ # Try to parse the version number
46+ m = re .search (r'[\.\d]*$' , out )
47+ # is the format kept through versions before 16.x?
48+ if m is None or not m .group (0 ):
49+ return out
50+
51+ v = m .group (0 ).split ('.' )
52+ try :
53+ v = [int (n ) for n in v ]
54+ except ValueError :
55+ return out
56+ return tuple (v )
4457
4558 @classmethod
4659 def outputtype_to_ext (cls , outputtype ):
Original file line number Diff line number Diff line change @@ -1235,6 +1235,15 @@ class SkullStrip(AFNICommand):
12351235 input_spec = SkullStripInputSpec
12361236 output_spec = AFNICommandOutputSpec
12371237
1238+ def __init__ (self , ** inputs ):
1239+ from .base import Info
1240+ super (SkullStrip , self ).__init__ (** inputs )
1241+ v = Info .version ()
1242+
1243+ # As of AFNI 16.0.00, redirect_x is not needed
1244+ if isinstance (v [0 ], int ) and v [0 ] > 15 :
1245+ self ._redirect_x = False
1246+
12381247
12391248class TCatInputSpec (AFNICommandInputSpec ):
12401249 in_files = InputMultiPath (
You can’t perform that action at this time.
0 commit comments