13
13
14
14
class ICA_AROMAInputSpec (CommandLineInputSpec ):
15
15
feat_dir = Directory (exists = True , mandatory = True ,
16
- argstr = '-feat %s' ,
17
- xor = ['in_file' , 'mat_file' , 'fnirt_warp_file' , 'motion_parameters' ],
18
- desc = 'If a feat directory exists and temporal filtering '
19
- 'has not been run yet, ICA_AROMA can use the files in '
20
- 'this directory.' )
16
+ argstr = '-feat %s' ,
17
+ xor = ['in_file' , 'mat_file' , 'fnirt_warp_file' , 'motion_parameters' ],
18
+ desc = 'If a feat directory exists and temporal filtering '
19
+ 'has not been run yet, ICA_AROMA can use the files in '
20
+ 'this directory.' )
21
21
in_file = File (exists = True , mandatory = True ,
22
- argstr = '-i %s' , xor = ['feat_dir' ],
23
- desc = 'volume to be denoised' )
22
+ argstr = '-i %s' , xor = ['feat_dir' ],
23
+ desc = 'volume to be denoised' )
24
24
out_dir = Directory ('out' , mandatory = True ,
25
- argstr = '-o %s' ,
26
- desc = 'output directory' )
25
+ argstr = '-o %s' ,
26
+ desc = 'output directory' )
27
27
mask = File (exists = True , argstr = '-m %s' , xor = ['feat_dir' ],
28
- desc = 'path/name volume mask' )
28
+ desc = 'path/name volume mask' )
29
29
dim = traits .Int (argstr = '-dim %d' ,
30
- desc = 'Dimensionality reduction when running '
31
- 'MELODIC (defualt is automatic estimation)' )
30
+ desc = 'Dimensionality reduction when running '
31
+ 'MELODIC (defualt is automatic estimation)' )
32
32
TR = traits .Float (argstr = '-tr %.3f' ,
33
- desc = 'TR in seconds. If this is not specified '
34
- 'the TR will be extracted from the '
35
- 'header of the fMRI nifti file.' )
33
+ desc = 'TR in seconds. If this is not specified '
34
+ 'the TR will be extracted from the '
35
+ 'header of the fMRI nifti file.' )
36
36
melodic_dir = Directory (exists = True , argstr = '-meldir %s' ,
37
- desc = 'path to MELODIC directory if MELODIC has already been run' )
38
- mat_file = File (exists = True , mandatory = True ,
39
- argstr = '-affmat %s' , xor = ['feat_dir' ],
40
- desc = 'path/name of the mat-file describing the '
41
- 'affine registration (e.g. FSL FLIRT) of the '
42
- 'functional data to structural space (.mat file)' )
43
- fnirt_warp_file = File (exists = True , mandatory = True ,
44
- argstr = '-warp %s' , xor = ['feat_dir' ],
45
- desc = 'File name of the warp-file describing '
46
- 'the non-linear registration (e.g. FSL FNIRT) '
47
- 'of the structural data to MNI152 space (.nii.gz)' )
37
+ desc = 'path to MELODIC directory if MELODIC has already been run' )
38
+ mat_file = File (exists = True , argstr = '-affmat %s' , xor = ['feat_dir' ],
39
+ desc = 'path/name of the mat-file describing the '
40
+ 'affine registration (e.g. FSL FLIRT) of the '
41
+ 'functional data to structural space (.mat file)' )
42
+ fnirt_warp_file = File (exists = True , argstr = '-warp %s' , xor = ['feat_dir' ],
43
+ desc = 'File name of the warp-file describing '
44
+ 'the non-linear registration (e.g. FSL FNIRT) '
45
+ 'of the structural data to MNI152 space (.nii.gz)' )
48
46
motion_parameters = File (exists = True , mandatory = True ,
49
- argstr = '-mc %s' , xor = ['feat_dir' ],
50
- desc = 'motion parameters file' )
47
+ argstr = '-mc %s' , xor = ['feat_dir' ],
48
+ desc = 'motion parameters file' )
51
49
denoise_type = traits .Enum ('nonaggr' , 'aggr' , 'both' , 'no' , usedefault = True ,
52
- mandatory = True , argstr = '-den %s' ,
53
- desc = 'Type of denoising strategy: '
54
- '-none: only classification, no denoising '
55
- '-nonaggr (default): non-aggresssive denoising, i.e. partial component regression '
56
- '-aggr: aggressive denoising, i.e. full component regression '
57
- '-both: both aggressive and non-aggressive denoising (two outputs)' )
50
+ mandatory = True , argstr = '-den %s' ,
51
+ desc = 'Type of denoising strategy: '
52
+ '-none: only classification, no denoising '
53
+ '-nonaggr (default): non-aggresssive denoising, i.e. partial component regression '
54
+ '-aggr: aggressive denoising, i.e. full component regression '
55
+ '-both: both aggressive and non-aggressive denoising (two outputs)' )
58
56
59
57
class ICA_AROMAOutputSpec (TraitedSpec ):
60
58
aggr_denoised_file = File (exists = True ,
61
59
desc = 'if generated: aggressively denoised volume' )
62
60
nonaggr_denoised_file = File (exists = True ,
63
61
desc = 'if generated: non aggressively denoised volume' )
64
62
out_dir = Directory (exists = True ,
65
- desc = 'directory contains (in addition to the denoised files): '
66
- 'melodic.ica + classified_motion_components + '
67
- 'classification_overview + feature_scores + melodic_ic_mni)' )
63
+ desc = 'directory contains (in addition to the denoised files): '
64
+ 'melodic.ica + classified_motion_components + '
65
+ 'classification_overview + feature_scores + melodic_ic_mni)' )
68
66
69
67
class ICA_AROMA (CommandLine ):
70
68
"""
69
+ Interface for the ICA_AROMA.py script (v0.3 beta).
70
+
71
+ ICA-AROMA (i.e. 'ICA-based Automatic Removal Of Motion Artifacts') concerns
72
+ a data-driven method to identify and remove motion-related independent
73
+ components from fMRI data. To that end it exploits a small, but robust
74
+ set of theoretically motivated features, preventing the need for classifier
75
+ re-training and therefore providing direct and easy applicability.
76
+
77
+
78
+ See link for further documentation: https://github.com/rhr-pruim/ICA-AROMA
79
+
80
+
71
81
72
82
Example
73
83
-------
74
84
75
85
>>> from nipype.interfaces.fsl import ICA_AROMA
76
86
>>> from nipype.testing import example_data
77
87
>>> AROMA_obj = ICA_AROMA.ICA_AROMA()
78
- >>> AROMA_obj.inputs.in_file=example_data( 'functional.nii')
79
- >>> AROMA_obj.inputs.mat_file=example_data( 'func_to_struct.mat')
80
- >>> AROMA_obj.inputs.fnirt_warp_file=example_data( 'warpfield.nii')
81
- >>> AROMA_obj.inputs.motion_parameters=example_data( 'functional.par')
82
- >>> AROMA_obj.inputs.mask=example_data( 'mask.nii.gz')
83
- >>> AROMA_obj.inputs.denoise_type= 'both'
84
- >>> AROMA_obj.inputs.out_dir= 'ICA_testout'
85
- >>> AROMA_obj.cmdline
86
- u 'ICA_AROMA.py -den both -warp /home/travis/build/nipy/nipype/nipype/testing/data/ warpfield.nii -i /home/travis/build/nipy/nipype/nipype/testing/data/ functional.nii -m /home/travis/build/nipy/nipype/nipype/testing/data/ mask.nii.gz -affmat /home/travis/build/nipy/nipype/nipype/testing/data/func_to_struct.mat -mc /home/travis/build/nipy/nipype/nipype/testing/data/functional.par -o ICA_testout'
87
-
88
+ >>> AROMA_obj.inputs.in_file = 'functional.nii'
89
+ >>> AROMA_obj.inputs.mat_file = 'func_to_struct.mat'
90
+ >>> AROMA_obj.inputs.fnirt_warp_file = 'warpfield.nii'
91
+ >>> AROMA_obj.inputs.motion_parameters = 'functional.par'
92
+ >>> AROMA_obj.inputs.mask = 'mask.nii.gz'
93
+ >>> AROMA_obj.inputs.denoise_type = 'both'
94
+ >>> AROMA_obj.inputs.out_dir = 'ICA_testout'
95
+ >>> AROMA_obj.cmdline # doctest: +ALLOW_UNICODE
96
+ 'ICA_AROMA.py -den both -warp warpfield.nii -i functional.nii -m mask.nii.gz \
97
+ -affmat func_to_struct.mat -mc fsl_mcflirt_movpar.txt -o ICA_testout'
88
98
"""
89
99
_cmd = 'ICA_AROMA.py'
90
100
input_spec = ICA_AROMAInputSpec
91
101
output_spec = ICA_AROMAOutputSpec
92
102
93
103
def _list_outputs (self ):
94
-
95
104
out_dir = os .path .abspath (self .inputs .out_dir )
96
105
outputs ['out_dir' ] = out_dir
97
- #outputs = self.output_spec.get()
98
- #outdir = self.input_spec.outdir
99
- #denoising_strategy = input_spec.denoise_type
100
106
101
107
if self .inputs .denoise_type in ('aggr' , 'both' ):
102
108
outputs ['aggr_denoised_file' ] = os .path .join (out_dir , 'denoised_func_data_aggr.nii.gz' )
103
109
if self .inputs .denoise_type in ('nonaggr' , 'both' ):
104
110
outputs ['nonaggr_denoised_file' ] = os .path .join (out_dir , 'denoised_func_data_nonaggr.nii.gz' )
105
111
106
- return outputs
112
+ return outputs
0 commit comments