Skip to content

Commit 53468eb

Browse files
committed
added test workflows
1 parent 25a599b commit 53468eb

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

circle.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ test:
2929
timeout: 2600
3030
- set -o pipefail && cd doc && make html 2>&1 | tee ~/log.txt
3131
- cat ~/log.txt && if grep -q "ERROR" ~/log.txt; then false; else true; fi
32+
- . /usr/share/fsl/5.0/etc/fslconf/fsl.sh && python ~/nipype/tools/run_examples.py test_spm Linear workflow3d workflow4d:
33+
pwd: ../examples
34+
environment:
35+
SPMMCRCMD: "$HOME/spm12/run_spm12.sh $HOME/mcr/v85/ script"
36+
FORCE_SPMMCR: 1
37+
timeout: 1600
3238
- . /usr/share/fsl/5.0/etc/fslconf/fsl.sh && python ~/nipype/tools/run_examples.py fmri_fsl_feeds Linear l1pipeline:
3339
pwd: ../examples
3440
- . /usr/share/fsl/5.0/etc/fslconf/fsl.sh && python ~/nipype/tools/run_examples.py fmri_spm_dartel Linear level1 l2pipeline:

examples/test_spm.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import nipype.pipeline.engine as pe
2+
from nipype.interfaces import spm
3+
from nipype.interfaces import fsl
4+
import os
5+
6+
in_file = "feeds/data/fmri.nii.gz"
7+
8+
split = pe.Node(fsl.Split(dimension="t", output_type="NIFTI"), name="split")
9+
split.inputs.in_file = os.path.abspath(in_file)
10+
11+
stc = pe.Node(interface=spm.SliceTiming(), name='stc')
12+
stc.inputs.num_slices = 21
13+
stc.inputs.time_repetition = 1.0
14+
stc.inputs.time_acquisition = 2. - 2./32
15+
stc.inputs.slice_order = range(21,0,-1)
16+
stc.inputs.ref_slice = 10
17+
18+
realign_estimate = pe.Node(interface=spm.Realign(), name='realign_estimate')
19+
realign_estimate.inputs.jobtype = "estimate"
20+
21+
realign_write = pe.Node(interface=spm.Realign(), name='realign_write')
22+
realign_write.inputs.jobtype = "write"
23+
24+
realign_estwrite = pe.Node(interface=spm.Realign(), name='realign_estwrite')
25+
realign_estwrite.inputs.jobtype = "estwrite"
26+
realign_estwrite.inputs.register_to_mean = True
27+
28+
smooth = pe.Node(interface=spm.Smooth(), name = 'smooth')
29+
smooth.inputs.fwhm = [6, 6, 6]
30+
31+
workflow3d = pe.Workflow(name='test_3d')
32+
workflow3d.base_dir = "/tmp"
33+
34+
workflow3d.connect([(split, stc, [("out_files", "in_files")]),
35+
(stc, realign_estimate, [('timecorrected_files','in_files')]),
36+
(realign_estimate, realign_write, [('modified_in_files','in_files')]),
37+
(stc, realign_estwrite, [('timecorrected_files','in_files')]),
38+
(realign_write, smooth, [('realigned_files','in_files')])])
39+
40+
workflow3d.run()
41+
42+
43+
stc = pe.Node(interface=spm.SliceTiming(), name='stc')
44+
stc.inputs.in_files = os.path.abspath(in_file)
45+
stc.inputs.num_slices = 25
46+
stc.inputs.time_repetition = 3.0
47+
stc.inputs.time_acquisition = 2. - 2./32
48+
stc.inputs.slice_order = range(25,0,-1)
49+
stc.inputs.ref_slice = 10
50+
51+
realign_estimate = pe.Node(interface=spm.Realign(), name='realign_estimate')
52+
realign_estimate.inputs.jobtype = "estimate"
53+
54+
realign_write = pe.Node(interface=spm.Realign(), name='realign_write')
55+
realign_write.inputs.jobtype = "write"
56+
57+
realign_estwrite = pe.Node(interface=spm.Realign(), name='realign_estwrite')
58+
realign_estwrite.inputs.jobtype = "estwrite"
59+
60+
smooth = pe.Node(interface=spm.Smooth(), name = 'smooth')
61+
smooth.inputs.fwhm = [6, 6, 6]
62+
63+
workflow4d = pe.Workflow(name='test_4d')
64+
workflow4d.base_dir = "/tmp"
65+
66+
workflow4d.connect([(stc, realign_estimate, [('timecorrected_files','in_files')]),
67+
(realign_estimate, realign_write, [('modified_in_files','in_files')]),
68+
(stc, realign_estwrite, [('timecorrected_files','in_files')]),
69+
(realign_write, smooth, [('realigned_files','in_files')])])
70+
71+
workflow4d.run()

0 commit comments

Comments
 (0)