diff --git a/nipype/interfaces/fsl/__init__.py b/nipype/interfaces/fsl/__init__.py index 1bf8e0ada7..0d2e9664d2 100644 --- a/nipype/interfaces/fsl/__init__.py +++ b/nipype/interfaces/fsl/__init__.py @@ -69,6 +69,8 @@ RobustFOV, CopyGeom, MotionOutliers, + Text2Vest, + Vest2Text, ) from .epi import ( diff --git a/nipype/interfaces/fsl/tests/test_auto_Text2Vest.py b/nipype/interfaces/fsl/tests/test_auto_Text2Vest.py new file mode 100644 index 0000000000..fdc39356a9 --- /dev/null +++ b/nipype/interfaces/fsl/tests/test_auto_Text2Vest.py @@ -0,0 +1,45 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from ..utils import Text2Vest + + +def test_Text2Vest_inputs(): + input_map = dict( + args=dict( + argstr="%s", + ), + environ=dict( + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=0, + ), + out_file=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=1, + ), + output_type=dict(), + ) + inputs = Text2Vest.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_Text2Vest_outputs(): + output_map = dict( + out_file=dict( + extensions=None, + ), + ) + outputs = Text2Vest.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/fsl/tests/test_auto_Vest2Text.py b/nipype/interfaces/fsl/tests/test_auto_Vest2Text.py new file mode 100644 index 0000000000..2732e95d12 --- /dev/null +++ b/nipype/interfaces/fsl/tests/test_auto_Vest2Text.py @@ -0,0 +1,45 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from ..utils import Vest2Text + + +def test_Vest2Text_inputs(): + input_map = dict( + args=dict( + argstr="%s", + ), + environ=dict( + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr="%s", + extensions=None, + mandatory=True, + position=0, + ), + out_file=dict( + argstr="%s", + extensions=None, + position=1, + usedefault=True, + ), + output_type=dict(), + ) + inputs = Vest2Text.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_Vest2Text_outputs(): + output_map = dict( + out_file=dict( + extensions=None, + ), + ) + outputs = Vest2Text.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/fsl/utils.py b/nipype/interfaces/fsl/utils.py index cf9e4c68f0..24ebeec040 100644 --- a/nipype/interfaces/fsl/utils.py +++ b/nipype/interfaces/fsl/utils.py @@ -2834,3 +2834,92 @@ class MotionOutliers(FSLCommand): input_spec = MotionOutliersInputSpec output_spec = MotionOutliersOutputSpec _cmd = "fsl_motion_outliers" + + +class Text2VestInputSpec(FSLCommandInputSpec): + in_file = File( + exists=True, + mandatory=True, + desc="plain text file representing your design, contrast, or f-test matrix", + argstr="%s", + position=0, + ) + + out_file = File( + mandatory=True, + desc=( + "file name to store matrix data in the format used by FSL tools" + " (e.g., design.mat, design.con design.fts)" + ), + argstr="%s", + position=1, + ) + + +class Text2VestOutputSpec(TraitedSpec): + out_file = File(desc="matrix data in the format used by FSL tools") + + +class Text2Vest(FSLCommand): + """ + Use FSL Text2Vest`https://web.mit.edu/fsl_v5.0.10/fsl/doc/wiki/GLM(2f)CreatingDesignMatricesByHand.html`_ + to convert your plain text design matrix data into the format used by the FSL tools. + + Examples + -------- + >>> from nipype.interfaces.fsl import Text2Vest + >>> t2v = Text2Vest() + >>> t2v.inputs.in_file = "design.txt" + >>> t2v.inputs.out_file = "design.mat" + >>> t2v.cmdline + 'Text2Vest design.txt design.mat' + >>> res = t2v.run() # doctest: +SKIP + """ + + input_spec = Text2VestInputSpec + output_spec = Text2VestOutputSpec + + _cmd = "Text2Vest" + + +class Vest2TextInputSpec(FSLCommandInputSpec): + in_file = File( + exists=True, + mandatory=True, + desc="matrix data stored in the format used by FSL tools", + argstr="%s", + position=0, + ) + + out_file = File( + "design.txt", + usedefault=True, + desc="file name to store text output from matrix", + argstr="%s", + position=1, + ) + + +class Vest2TextOutputSpec(TraitedSpec): + out_file = File(desc="plain text representation of FSL matrix") + + +class Vest2Text(FSLCommand): + """ + Use FSL Vest2Text`https://web.mit.edu/fsl_v5.0.10/fsl/doc/wiki/GLM(2f)CreatingDesignMatricesByHand.html`_ + to convert your design.mat design.con and design.fts files into plain text. + + Examples + -------- + >>> from nipype.interfaces.fsl import Vest2Text + >>> v2t = Vest2Text() + >>> v2t.inputs.in_file = "design.mat" + >>> v2t.cmdline + 'Vest2Text design.mat design.txt' + >>> res = v2t.run() # doctest: +SKIP + """ + + input_spec = Vest2TextInputSpec + output_spec = Vest2TextOutputSpec + + _cmd = "Vest2Text" diff --git a/nipype/testing/data/design.mat b/nipype/testing/data/design.mat index e69de29bb2..5f27af3198 100644 --- a/nipype/testing/data/design.mat +++ b/nipype/testing/data/design.mat @@ -0,0 +1,6 @@ +/NumWaves 3 +/NumPoints 3 +/Matrix +0 0 0 +0 0 0 +0 0 0 diff --git a/nipype/testing/data/design.txt b/nipype/testing/data/design.txt new file mode 100644 index 0000000000..d5de7d6a40 --- /dev/null +++ b/nipype/testing/data/design.txt @@ -0,0 +1,3 @@ +0 0 0 +0 0 0 +0 0 0