Skip to content

Commit e94b5bf

Browse files
committed
Merge remote-tracking branch 'private/fix/dipy_tests'
* private/fix/dipy_tests: moved the import inside the constructor Fixes #933
2 parents 8d3181a + 90bdd31 commit e94b5bf

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

nipype/interfaces/dipy/preprocess.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
# @Author: oesteban
4-
# @Date: 2014-09-01 10:33:35
5-
# @Last Modified by: oesteban
6-
# @Last Modified time: 2014-09-03 15:07:46
3+
"""Change directory to provide relative paths for doctests
4+
>>> import os
5+
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
6+
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
7+
>>> os.chdir(datadir)
8+
"""
9+
710
from nipype.interfaces.base import (traits, TraitedSpec, BaseInterface,
811
File, isdefined)
912
from nipype.utils.filemanip import split_filename
@@ -23,7 +26,6 @@
2326
else:
2427
from dipy.align.aniso2iso import resample
2528
from dipy.core.gradients import GradientTable
26-
from dipy.denoise.nlmeans import nlmeans
2729

2830

2931
class ResampleInputSpec(TraitedSpec):
@@ -125,6 +127,15 @@ class Denoise(BaseInterface):
125127
"""
126128
input_spec = DenoiseInputSpec
127129
output_spec = DenoiseOutputSpec
130+
131+
def __init__(self, **inputs):
132+
try:
133+
package_check('dipy', version='0.8.0.dev')
134+
except Exception, e:
135+
have_dipy = False
136+
else:
137+
from dipy.denoise.nlmeans import nlmeans
138+
BaseInterface.__init__(self, **inputs)
128139

129140
def _run_interface(self, runtime):
130141
out_file = op.abspath(self._gen_outfilename())

nipype/interfaces/dipy/tracks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# -*- coding: utf-8 -*-
2+
"""Change directory to provide relative paths for doctests
3+
>>> import os
4+
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
5+
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
6+
>>> os.chdir(datadir)
7+
"""
28
from nipype.interfaces.base import (TraitedSpec, BaseInterface, BaseInterfaceInputSpec,
39
File, isdefined, traits)
410
from nipype.utils.filemanip import split_filename

0 commit comments

Comments
 (0)