15
15
16
16
from ... import logging
17
17
from ...utils .filemanip import split_filename
18
- from ...utils .misc import package_check
19
18
from ...workflows .misc .utils import get_data_dims , get_vox_dims
20
- from ..base import TraitedSpec , BaseInterface , File , isdefined
21
-
22
- import warnings
23
- have_dipy = True
24
- try :
25
- package_check ('dipy' )
26
- except Exception as e :
27
- have_dipy = False
28
- else :
29
- from dipy .tracking .utils import move_streamlines , affine_from_fsl_mat_file
19
+ from ..base import TraitedSpec , File , isdefined
20
+ from ..dipy .base import DipyBaseInterface , HAVE_DIPY as have_dipy
30
21
31
22
iflogger = logging .getLogger ('interface' )
32
23
33
24
34
25
def transform_to_affine (streams , header , affine ):
26
+ from dipy .tracking .utils import move_streamlines
35
27
rotation , scale = np .linalg .qr (affine )
36
28
streams = move_streamlines (streams , rotation )
37
29
scale [0 :3 , 0 :3 ] = np .dot (scale [0 :3 , 0 :3 ],
@@ -168,7 +160,7 @@ class MRTrix2TrackVisOutputSpec(TraitedSpec):
168
160
out_file = File (exists = True )
169
161
170
162
171
- class MRTrix2TrackVis (BaseInterface ):
163
+ class MRTrix2TrackVis (DipyBaseInterface ):
172
164
"""
173
165
Converts MRtrix (.tck) tract files into TrackVis (.trk) format
174
166
using functions from dipy
@@ -184,6 +176,8 @@ class MRTrix2TrackVis(BaseInterface):
184
176
output_spec = MRTrix2TrackVisOutputSpec
185
177
186
178
def _run_interface (self , runtime ):
179
+ from dipy .tracking .utils import move_streamlines , \
180
+ affine_from_fsl_mat_file
187
181
dx , dy , dz = get_data_dims (self .inputs .image_file )
188
182
vx , vy , vz = get_vox_dims (self .inputs .image_file )
189
183
image_file = nb .load (self .inputs .image_file )
0 commit comments