Skip to content

Commit 79132b5

Browse files
authored
Merge pull request #3412 from koenhelwegen/rename_dipy_move_streamlines
rename dipy `move_streamlines` to `transform_tracking_output`
2 parents 87d04ae + 537457b commit 79132b5

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

nipype/interfaces/mrtrix/convert.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ def get_data_dims(volume):
4040

4141

4242
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
4447

4548
rotation, scale = np.linalg.qr(affine)
46-
streams = move_streamlines(streams, rotation)
49+
streams = transform_tracking_output(streams, rotation)
4750
scale[0:3, 0:3] = np.dot(scale[0:3, 0:3], np.diag(1.0 / header["voxel_size"]))
4851
scale[0:3, 3] = abs(scale[0:3, 3])
49-
streams = move_streamlines(streams, scale)
52+
streams = transform_tracking_output(streams, scale)
5053
return streams
5154

5255

@@ -193,7 +196,14 @@ class MRTrix2TrackVis(DipyBaseInterface):
193196
output_spec = MRTrix2TrackVisOutputSpec
194197

195198
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+
)
197207

198208
dx, dy, dz = get_data_dims(self.inputs.image_file)
199209
vx, vy, vz = get_vox_dims(self.inputs.image_file)
@@ -243,7 +253,7 @@ def _run_interface(self, runtime):
243253
axcode = aff2axcodes(reg_affine)
244254
trk_header["voxel_order"] = axcode[0] + axcode[1] + axcode[2]
245255

246-
final_streamlines = move_streamlines(transformed_streamlines, aff)
256+
final_streamlines = transform_tracking_output(transformed_streamlines, aff)
247257
trk_tracks = ((ii, None, None) for ii in final_streamlines)
248258
trk.write(out_filename, trk_tracks, trk_header)
249259
iflogger.info("Saving transformed Trackvis file as %s", out_filename)

0 commit comments

Comments
 (0)