@@ -40,13 +40,16 @@ def get_data_dims(volume):
40
40
41
41
42
42
def transform_to_affine (streams , header , affine ):
43
- from dipy .tracking .utils import move_streamlines
43
+ try :
44
+ from dipy .tracking .utils import transform_tracking_output
45
+ except ImportError :
46
+ from dipy .tracking .utils import move_streamlines as transform_tracking_output
44
47
45
48
rotation , scale = np .linalg .qr (affine )
46
- streams = move_streamlines (streams , rotation )
49
+ streams = transform_tracking_output (streams , rotation )
47
50
scale [0 :3 , 0 :3 ] = np .dot (scale [0 :3 , 0 :3 ], np .diag (1.0 / header ["voxel_size" ]))
48
51
scale [0 :3 , 3 ] = abs (scale [0 :3 , 3 ])
49
- streams = move_streamlines (streams , scale )
52
+ streams = transform_tracking_output (streams , scale )
50
53
return streams
51
54
52
55
@@ -193,7 +196,14 @@ class MRTrix2TrackVis(DipyBaseInterface):
193
196
output_spec = MRTrix2TrackVisOutputSpec
194
197
195
198
def _run_interface (self , runtime ):
196
- from dipy .tracking .utils import move_streamlines , affine_from_fsl_mat_file
199
+ from dipy .tracking .utils import affine_from_fsl_mat_file
200
+
201
+ try :
202
+ from dipy .tracking .utils import transform_tracking_output
203
+ except ImportError :
204
+ from dipy .tracking .utils import (
205
+ move_streamlines as transform_tracking_output ,
206
+ )
197
207
198
208
dx , dy , dz = get_data_dims (self .inputs .image_file )
199
209
vx , vy , vz = get_vox_dims (self .inputs .image_file )
@@ -243,7 +253,7 @@ def _run_interface(self, runtime):
243
253
axcode = aff2axcodes (reg_affine )
244
254
trk_header ["voxel_order" ] = axcode [0 ] + axcode [1 ] + axcode [2 ]
245
255
246
- final_streamlines = move_streamlines (transformed_streamlines , aff )
256
+ final_streamlines = transform_tracking_output (transformed_streamlines , aff )
247
257
trk_tracks = ((ii , None , None ) for ii in final_streamlines )
248
258
trk .write (out_filename , trk_tracks , trk_header )
249
259
iflogger .info ("Saving transformed Trackvis file as %s" , out_filename )
0 commit comments