Skip to content

Commit b7ca804

Browse files
committed
add new simulation interface
1 parent 732cef3 commit b7ca804

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

nipype/interfaces/dipy/simulate.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- 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+
"""
8+
9+
from nipype.interfaces.base import (
10+
TraitedSpec, BaseInterface, File)
11+
from nipype.utils.filemanip import split_filename
12+
import os.path as op
13+
import nibabel as nb
14+
import numpy as np
15+
from nipype.utils.misc import package_check
16+
import warnings
17+
18+
from ... import logging
19+
iflogger = logging.getLogger('interface')
20+
21+
have_dipy = True
22+
try:
23+
package_check('dipy', version='0.8.0')
24+
except Exception, e:
25+
have_dipy = False
26+
else:
27+
import numpy as np
28+
from dipy.sims.voxel import (multi_tensor,
29+
all_tensor_evecs)
30+
31+
32+
class SimulateDWIInputSpec(BaseInterfaceInputSpec):
33+
fibers = InputMultiPath(File(exists=True), mandatory=True,
34+
desc='list of fibers principal directions')
35+
vfractions = File(exists=True, mandatory=True,
36+
desc='volume fractions')
37+
S0 = File(exists=True, mandatory=True, desc='baseline T2 signal')
38+
out_file = File('sim_dwi.nii.gz', usedefault=True,
39+
desc='output file with fractions to be simluated')
40+
gradients = File(exists=True, desc='gradients file')
41+
bvec = File(exists=True, desc='bvecs file')
42+
bval = File(exists=True, desc='bvals file')

0 commit comments

Comments
 (0)