Skip to content

Commit d63901f

Browse files
author
dmordom
committed
Created interface for vimage2nifti command from lipvia vista package
1 parent 6deb181 commit d63901f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

nipype/interfaces/vista/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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+
from .vista import (Vnifti2Image)

nipype/interfaces/vista/vista.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
"""
4+
Change directory to provide relative paths for doctests
5+
>>> import os
6+
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
7+
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
8+
>>> os.chdir(datadir)
9+
10+
"""
11+
12+
from nipype.interfaces.base import CommandLineInputSpec, CommandLine, traits, TraitedSpec, File
13+
from nipype.utils.filemanip import split_filename
14+
import os, os.path as op
15+
from nipype.interfaces.traits_extension import isdefined
16+
17+
class Vnifti2ImageInputSpec(CommandLineInputSpec):
18+
in_file = File(exists=True, argstr='-in %s', mandatory=True, position=1, desc='in file')
19+
attributes = File(exists=True, argstr='-attr %s', mandatory=False, position=2, desc='attribute file')
20+
out_file = File(name_template="%s.v", keep_extension=False, argstr='-out %s', hash_files=False,
21+
position= -1, desc='output data file', name_source=["in_file"])
22+
23+
class Vnifti2ImageOutputSpec(TraitedSpec):
24+
out_file = File(exists=True, desc='Output vista file')
25+
26+
class Vnifti2Image(CommandLine):
27+
"""
28+
Convert a nifti file into a vista file.
29+
30+
Example
31+
-------
32+
33+
>>> vimage = Vnifti2Image()
34+
>>> vimage.inputs.in_file = 'image.nii'
35+
>>> vimage.inputs.out_file = 'image.v'
36+
>>> vimage.run() # doctest: +SKIP
37+
"""
38+
39+
_cmd = 'vnifti2image'
40+
input_spec=Vnifti2ImageInputSpec
41+
output_spec=Vnifti2ImageOutputSpec

0 commit comments

Comments
 (0)