Skip to content

Commit 3c138b5

Browse files
committed
ENH: added interface for FSL's dual_Regression
1 parent 603f424 commit 3c138b5

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

nipype/interfaces/fsl/model.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,72 @@ def _format_arg(self, name, spec, value):
18151815
return super(Cluster, self)._format_arg(name, spec, value)
18161816

18171817

1818+
class DualRegressionInputSpec(FSLCommandInputSpec):
1819+
in_files = InputMultiPath(File(exists=True), argstr="%s", mandatory=True,
1820+
position=-1, sep=" ",
1821+
desc="List all subjects' preprocessed, standard-space 4D datasets",)
1822+
group_IC_maps_4D = File(exists=True, argstr="%s", mandatory=True, position=1,
1823+
desc="4D image containing spatial IC maps (melodic_IC) from the "
1824+
"whole-group ICA analysis")
1825+
des_norm = traits.Bool(True, argstr="%i", position=2, usedefault=True,
1826+
desc="Whether to variance-normalise the timecourses used as the "
1827+
"stage-2 regressors; True is default and recommended")
1828+
one_sample_group_mean = traits.Bool(argstr="-1", position=3,
1829+
desc="perform 1-sample group-mean test instead of generic "
1830+
"permutation test")
1831+
design_file = File(exists=True, argstr="%s", position=3,
1832+
desc="Design matrix for final cross-subject modelling with "
1833+
"randomise")
1834+
con_file = File(exists=True, argstr="%s", position=4,
1835+
desc="Design contrasts for final cross-subject modelling with "
1836+
"randomise")
1837+
n_perm = traits.Int(argstr="%i", mandatory=True, position=5,
1838+
desc="Number of permutations for randomise; set to 1 for just raw "
1839+
"tstat output, set to 0 to not run randomise at all.")
1840+
out_dir = Directory("output", argstr="%s", usedefault=True, position=6,
1841+
desc="This directory will be created to hold all output and logfiles",
1842+
genfile=True)
1843+
1844+
1845+
class DualRegressionOutputSpec(TraitedSpec):
1846+
out_dir = Directory(exists=True)
1847+
1848+
1849+
class DualRegression(FSLCommand):
1850+
"""Wrapper Script for Dual Regression Workflow
1851+
1852+
Examples
1853+
--------
1854+
1855+
>>> dual_regression = DualRegression()
1856+
>>> dual_regression.inputs.in_files = ["functional.nii", "functional2.nii", "functional3.nii"]
1857+
>>> dual_regression.inputs.group_IC_maps_4D = "allFA.nii"
1858+
>>> dual_regression.inputs.des_norm = False
1859+
>>> dual_regression.inputs.one_sample_group_mean = True
1860+
>>> dual_regression.inputs.n_perm = 10
1861+
>>> dual_regression.inputs.out_dir = "my_output_directory"
1862+
>>> dual_regression.cmdline # doctest: +ALLOW_UNICODE
1863+
u'dual_regression allFA.nii 0 -1 10 my_output_directory functional.nii functional2.nii functional3.nii'
1864+
>>> dual_regression.run() # doctest: +SKIP
1865+
1866+
"""
1867+
input_spec = DualRegressionInputSpec
1868+
output_spec = DualRegressionOutputSpec
1869+
_cmd = 'dual_regression'
1870+
1871+
def _list_outputs(self):
1872+
outputs = self.output_spec().get()
1873+
if isdefined(self.inputs.out_dir):
1874+
outputs['out_dir'] = os.path.abspath(self.inputs.out_dir)
1875+
else:
1876+
outputs['out_dir'] = self._gen_filename("out_dir")
1877+
return outputs
1878+
1879+
def _gen_filename(self, name):
1880+
if name == "out_dir":
1881+
return os.getcwd()
1882+
1883+
18181884
class RandomiseInputSpec(FSLCommandInputSpec):
18191885
in_file = File(exists=True, desc='4D input file', argstr='-i %s',
18201886
position=0, mandatory=True)

0 commit comments

Comments
 (0)