Skip to content

Commit 2c1e47b

Browse files
committed
RF: MRTrix2TrackVis is a DipyBaseInterface
1 parent 7a99c27 commit 2c1e47b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

nipype/interfaces/mrtrix/convert.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,15 @@
1515

1616
from ... import logging
1717
from ...utils.filemanip import split_filename
18-
from ...utils.misc import package_check
1918
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
3021

3122
iflogger = logging.getLogger('interface')
3223

3324

3425
def transform_to_affine(streams, header, affine):
26+
from dipy.tracking.utils import move_streamlines
3527
rotation, scale = np.linalg.qr(affine)
3628
streams = move_streamlines(streams, rotation)
3729
scale[0:3, 0:3] = np.dot(scale[0:3, 0:3],
@@ -168,7 +160,7 @@ class MRTrix2TrackVisOutputSpec(TraitedSpec):
168160
out_file = File(exists=True)
169161

170162

171-
class MRTrix2TrackVis(BaseInterface):
163+
class MRTrix2TrackVis(DipyBaseInterface):
172164
"""
173165
Converts MRtrix (.tck) tract files into TrackVis (.trk) format
174166
using functions from dipy
@@ -184,6 +176,8 @@ class MRTrix2TrackVis(BaseInterface):
184176
output_spec = MRTrix2TrackVisOutputSpec
185177

186178
def _run_interface(self, runtime):
179+
from dipy.tracking.utils import move_streamlines, \
180+
affine_from_fsl_mat_file
187181
dx, dy, dz = get_data_dims(self.inputs.image_file)
188182
vx, vy, vz = get_vox_dims(self.inputs.image_file)
189183
image_file = nb.load(self.inputs.image_file)

0 commit comments

Comments
 (0)