21
21
except Exception , e :
22
22
warnings .warn ('nipy not installed' )
23
23
else :
24
- from nipy .labs .mask import compute_mask
25
- from nipy .algorithms .registration import FmriRealign4d as FR4d
24
+ import nipy
26
25
from nipy import save_image , load_image
27
- from nipy .algorithms .registration import SpaceTimeRealign
28
- from nipy .algorithms .registration .groupwise_registration import SpaceRealign
29
26
30
27
from ..base import (TraitedSpec , BaseInterface , traits ,
31
28
BaseInterfaceInputSpec , isdefined , File ,
@@ -52,7 +49,7 @@ class ComputeMask(BaseInterface):
52
49
output_spec = ComputeMaskOutputSpec
53
50
54
51
def _run_interface (self , runtime ):
55
-
52
+ from nipy . labs . mask import compute_mask
56
53
args = {}
57
54
for key in [k for k , _ in self .inputs .items ()
58
55
if k not in BaseInterfaceInputSpec ().trait_names ()]:
@@ -149,7 +146,7 @@ class FmriRealign4d(BaseInterface):
149
146
keywords = ['slice timing' , 'motion correction' ]
150
147
151
148
def _run_interface (self , runtime ):
152
-
149
+ from nipy . algorithms . registration import FmriRealign4d as FR4d
153
150
all_ims = [load_image (fname ) for fname in self .inputs .in_file ]
154
151
155
152
if not isdefined (self .inputs .tr_slices ):
@@ -202,7 +199,7 @@ def _list_outputs(self):
202
199
class SpaceTimeRealignerInputSpec (BaseInterfaceInputSpec ):
203
200
204
201
in_file = InputMultiPath (exists = True ,
205
- mandatory = True ,
202
+ mandatory = True , min_ver = '0.4.0.dev' ,
206
203
desc = "File to realign" )
207
204
tr = traits .Float (desc = "TR in seconds" , requires = ['slice_times' ])
208
205
slice_times = traits .Either (traits .List (traits .Float ()),
@@ -277,7 +274,12 @@ class SpaceTimeRealigner(BaseInterface):
277
274
output_spec = SpaceTimeRealignerOutputSpec
278
275
keywords = ['slice timing' , 'motion correction' ]
279
276
277
+ def version (self ):
278
+ return nipy .__version__
279
+
280
280
def _run_interface (self , runtime ):
281
+ from nipy .algorithms .registration import SpaceTimeRealign
282
+ from nipy .algorithms .registration .groupwise_registration import SpaceRealign
281
283
282
284
all_ims = [load_image (fname ) for fname in self .inputs .in_file ]
283
285
0 commit comments