Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ecd5871

Browse files
Merge pull request #3447 from jdkent/enh/add_Text2Vest
[ENH] Add Text2Vest and Vest2Text interfaces
2 parents f8f7fb5 + 62d8c46 commit ecd5871

File tree

6 files changed

+190
-0
lines changed

6 files changed

+190
-0
lines changed

‎nipype/interfaces/fsl/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
RobustFOV,
7070
CopyGeom,
7171
MotionOutliers,
72+
Text2Vest,
73+
Vest2Text,
7274
)
7375

7476
from .epi import (
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ..utils import Text2Vest
3+
4+
5+
def test_Text2Vest_inputs():
6+
input_map = dict(
7+
args=dict(
8+
argstr="%s",
9+
),
10+
environ=dict(
11+
nohash=True,
12+
usedefault=True,
13+
),
14+
in_file=dict(
15+
argstr="%s",
16+
extensions=None,
17+
mandatory=True,
18+
position=0,
19+
),
20+
out_file=dict(
21+
argstr="%s",
22+
extensions=None,
23+
mandatory=True,
24+
position=1,
25+
),
26+
output_type=dict(),
27+
)
28+
inputs = Text2Vest.input_spec()
29+
30+
for key, metadata in list(input_map.items()):
31+
for metakey, value in list(metadata.items()):
32+
assert getattr(inputs.traits()[key], metakey) == value
33+
34+
35+
def test_Text2Vest_outputs():
36+
output_map = dict(
37+
out_file=dict(
38+
extensions=None,
39+
),
40+
)
41+
outputs = Text2Vest.output_spec()
42+
43+
for key, metadata in list(output_map.items()):
44+
for metakey, value in list(metadata.items()):
45+
assert getattr(outputs.traits()[key], metakey) == value
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ..utils import Vest2Text
3+
4+
5+
def test_Vest2Text_inputs():
6+
input_map = dict(
7+
args=dict(
8+
argstr="%s",
9+
),
10+
environ=dict(
11+
nohash=True,
12+
usedefault=True,
13+
),
14+
in_file=dict(
15+
argstr="%s",
16+
extensions=None,
17+
mandatory=True,
18+
position=0,
19+
),
20+
out_file=dict(
21+
argstr="%s",
22+
extensions=None,
23+
position=1,
24+
usedefault=True,
25+
),
26+
output_type=dict(),
27+
)
28+
inputs = Vest2Text.input_spec()
29+
30+
for key, metadata in list(input_map.items()):
31+
for metakey, value in list(metadata.items()):
32+
assert getattr(inputs.traits()[key], metakey) == value
33+
34+
35+
def test_Vest2Text_outputs():
36+
output_map = dict(
37+
out_file=dict(
38+
extensions=None,
39+
),
40+
)
41+
outputs = Vest2Text.output_spec()
42+
43+
for key, metadata in list(output_map.items()):
44+
for metakey, value in list(metadata.items()):
45+
assert getattr(outputs.traits()[key], metakey) == value

‎nipype/interfaces/fsl/utils.py‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,3 +2834,92 @@ class MotionOutliers(FSLCommand):
28342834
input_spec = MotionOutliersInputSpec
28352835
output_spec = MotionOutliersOutputSpec
28362836
_cmd = "fsl_motion_outliers"
2837+
2838+
2839+
class Text2VestInputSpec(FSLCommandInputSpec):
2840+
in_file = File(
2841+
exists=True,
2842+
mandatory=True,
2843+
desc="plain text file representing your design, contrast, or f-test matrix",
2844+
argstr="%s",
2845+
position=0,
2846+
)
2847+
2848+
out_file = File(
2849+
mandatory=True,
2850+
desc=(
2851+
"file name to store matrix data in the format used by FSL tools"
2852+
" (e.g., design.mat, design.con design.fts)"
2853+
),
2854+
argstr="%s",
2855+
position=1,
2856+
)
2857+
2858+
2859+
class Text2VestOutputSpec(TraitedSpec):
2860+
out_file = File(desc="matrix data in the format used by FSL tools")
2861+
2862+
2863+
class Text2Vest(FSLCommand):
2864+
"""
2865+
Use FSL Text2Vest`https://web.mit.edu/fsl_v5.0.10/fsl/doc/wiki/GLM(2f)CreatingDesignMatricesByHand.html`_
2866+
to convert your plain text design matrix data into the format used by the FSL tools.
2867+
2868+
Examples
2869+
--------
2870+
>>> from nipype.interfaces.fsl import Text2Vest
2871+
>>> t2v = Text2Vest()
2872+
>>> t2v.inputs.in_file = "design.txt"
2873+
>>> t2v.inputs.out_file = "design.mat"
2874+
>>> t2v.cmdline
2875+
'Text2Vest design.txt design.mat'
2876+
>>> res = t2v.run() # doctest: +SKIP
2877+
"""
2878+
2879+
input_spec = Text2VestInputSpec
2880+
output_spec = Text2VestOutputSpec
2881+
2882+
_cmd = "Text2Vest"
2883+
2884+
2885+
class Vest2TextInputSpec(FSLCommandInputSpec):
2886+
in_file = File(
2887+
exists=True,
2888+
mandatory=True,
2889+
desc="matrix data stored in the format used by FSL tools",
2890+
argstr="%s",
2891+
position=0,
2892+
)
2893+
2894+
out_file = File(
2895+
"design.txt",
2896+
usedefault=True,
2897+
desc="file name to store text output from matrix",
2898+
argstr="%s",
2899+
position=1,
2900+
)
2901+
2902+
2903+
class Vest2TextOutputSpec(TraitedSpec):
2904+
out_file = File(desc="plain text representation of FSL matrix")
2905+
2906+
2907+
class Vest2Text(FSLCommand):
2908+
"""
2909+
Use FSL Vest2Text`https://web.mit.edu/fsl_v5.0.10/fsl/doc/wiki/GLM(2f)CreatingDesignMatricesByHand.html`_
2910+
to convert your design.mat design.con and design.fts files into plain text.
2911+
2912+
Examples
2913+
--------
2914+
>>> from nipype.interfaces.fsl import Vest2Text
2915+
>>> v2t = Vest2Text()
2916+
>>> v2t.inputs.in_file = "design.mat"
2917+
>>> v2t.cmdline
2918+
'Vest2Text design.mat design.txt'
2919+
>>> res = v2t.run() # doctest: +SKIP
2920+
"""
2921+
2922+
input_spec = Vest2TextInputSpec
2923+
output_spec = Vest2TextOutputSpec
2924+
2925+
_cmd = "Vest2Text"

‎nipype/testing/data/design.mat‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/NumWaves 3
2+
/NumPoints 3
3+
/Matrix
4+
0 0 0
5+
0 0 0
6+
0 0 0

‎nipype/testing/data/design.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0 0 0
2+
0 0 0
3+
0 0 0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /