Skip to content

Commit 01bea78

Browse files
committed
add mesh2pve interface
1 parent 814349e commit 01bea78

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

nipype/interfaces/mrtrix3/utils.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2+
# vi: set ft=python sts=4 ts=4 sw=4 et:
3+
# -*- coding: utf-8 -*-
4+
5+
"""
6+
Change directory to provide relative paths for doctests
7+
>>> import os
8+
>>> filepath = os.path.dirname(os.path.realpath(__file__ ))
9+
>>> datadir = os.path.realpath(os.path.join(filepath,
10+
... '../../testing/data'))
11+
>>> os.chdir(datadir)
12+
13+
"""
14+
import os
15+
import os.path as op
16+
17+
from nipype.interfaces.base import (
18+
CommandLineInputSpec, CommandLine, traits, TraitedSpec, File)
19+
20+
from nipype.utils.filemanip import split_filename
21+
from nipype.interfaces.traits_extension import isdefined
22+
23+
24+
class Mesh2PVEInputSpec(CommandLineInputSpec):
25+
in_file = File(exists=True, argstr='%s', mandatory=True, position=-3,
26+
desc='input diffusion weighted images')
27+
reference = File(exists=True, argstr='%s', mandatory=True, position=-2,
28+
desc='input diffusion weighted images')
29+
in_first = File(
30+
exists=True, argstr='-first %s',
31+
desc='indicates that the mesh file is provided by FSL FIRST')
32+
33+
out_file = File(
34+
'mesh2volume.nii.gz', argstr='%s', mandatory=True, position=-1,
35+
usedefault=True, desc='output file containing SH coefficients')
36+
37+
38+
class Mesh2PVEOutputSpec(TraitedSpec):
39+
out_file = File(exists=True, desc='the output response file')
40+
41+
42+
class Mesh2PVE(CommandLine):
43+
44+
"""
45+
Performs tractography after selecting the appropriate algorithm
46+
47+
Example
48+
-------
49+
50+
>>> import nipype.interfaces.mrtrix3 as mrt
51+
>>> m2p = mrt.Mesh2PVE()
52+
>>> m2p.inputs.in_file = 'surf.vtk'
53+
>>> m2p.inputs.reference = 'dwi.nii.gz'
54+
>>> m2p.inputs.in_first = 'T1.nii.gz'
55+
>>> m2p.cmdline # doctest: +ELLIPSIS
56+
'mesh2pve -first T1.nii.gz surf.vtk dwi.nii.gz mesh2volume.nii.gz'
57+
>>> resp.run() # doctest: +SKIP
58+
"""
59+
60+
_cmd = 'mesh2pve'
61+
input_spec = Mesh2PVEInputSpec
62+
output_spec = Mesh2PVEOutputSpec
63+
64+
def _list_outputs(self):
65+
outputs = self.output_spec().get()
66+
outputs['out_file'] = op.abspath(self.inputs.out_file)
67+
return outputs

0 commit comments

Comments
 (0)