Skip to content

Commit 1bc11f4

Browse files
committed
Merge branch 'master' into enh/DipyImproveTDI
Conflicts: CHANGES
2 parents 59c38d7 + 893d600 commit 1bc11f4

File tree

97 files changed

+6114
-511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+6114
-511
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
.pydevproject
1515
.idea/
1616
/documentation.zip
17+
.DS_Store

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ install:
2626
- source activate testenv
2727
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then pip install ordereddict; fi
2828
- conda install --yes numpy scipy nose traits networkx dateutil
29-
- pip install nibabel --use-mirrors
30-
- pip install python-coveralls --use-mirrors
31-
- pip install nose-cov --use-mirrors
29+
- pip install nibabel
30+
- pip install python-coveralls
31+
- pip install nose-cov
3232
- pip install https://github.com/RDFLib/rdflib/archive/master.zip
3333
- pip install https://github.com/trungdong/prov/archive/rdf.zip
3434
- python setup.py install

CHANGES

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ Next release
22
============
33

44
* ENH: Improved TrackDensityMap of dipy (https://github.com/nipy/nipype/pull/1091)
5-
* FIX: Enable absolute path definitions in DCMStack (https://github.com/nipy/nipype/pull/1089)
6-
* ENH: New algorithm: mesh.WarpPoints applies displacements fields to point sets.
7-
* ENH: Improved FieldMap-Based (FMB) workflow for correction of susceptibility distortions
8-
in EPI seqs. (https://github.com/nipy/nipype/pull/1019)
9-
* ENH: Added interface to simulate DWIs using the multi-tensor model
10-
(https://github.com/nipy/nipype/pull/1085)
5+
* ENH: New interface for FSL fslcpgeom utility (https://github.com/nipy/nipype/pull/1152)
6+
* FIX: Enable absolute path definitions in DCMStack (https://github.com/nipy/nipype/pull/1089,
7+
replaced by https://github.com/nipy/nipype/pull/1093)
118
* ENH: New mesh.MeshWarpMaths to operate on surface-defined warpings
129
(https://github.com/nipy/nipype/pull/1016)
1310
* FIX: Refactor P2PDistance, change name to ComputeMeshWarp, add regression tests,
@@ -17,6 +14,7 @@ Next release
1714
* FIX: FUGUE is now properly listing outputs. (https://github.com/nipy/nipype/pull/978)
1815
* ENH: Improved FieldMap-Based (FMB) workflow for correction of susceptibility distortions in EPI seqs.
1916
(https://github.com/nipy/nipype/pull/1019)
17+
* FIX: In the FSLXcommand _list_outputs function fixed for loop range (https://github.com/nipy/nipype/pull/1071)
2018
* ENH: Dropped support for now 7 years old Python 2.6 (https://github.com/nipy/nipype/pull/1069)
2119
* FIX: terminal_output is not mandatory anymore (https://github.com/nipy/nipype/pull/1070)
2220
* ENH: Added "nipype_cmd" tool for running interfaces from the command line (https://github.com/nipy/nipype/pull/795)
@@ -58,6 +56,13 @@ Next release
5856
* ENH: Added csvReader() utility (https://github.com/nipy/nipype/pull/1044)
5957
* FIX: typo in nipype.interfaces.freesurfer.utils.py Tkregister2 (https://github.com/nipy/nipype/pull/1083)
6058
* FIX: SSHDataGrabber outputs now return full path to the grabbed/downloaded files. (https://github.com/nipy/nipype/pull/1086)
59+
* FIX: Add QA output for TSNR to resting workflow (https://github.com/nipy/nipype/pull/1088)
60+
* FIX: Change N4BiasFieldCorrection to use short tag for dimensionality (backward compatible) (https://github.com/nipy/nipype/pull/1096)
61+
* ENH: Added -newgrid input to Warp in AFNI (3dWarp wrapper) (https://github.com/nipy/nipype/pull/1128)
62+
* FIX: Fixed AFNI Copy interface to use positional inputs as required (https://github.com/nipy/nipype/pull/1131)
63+
* ENH: Added a check in Dcm2nii to check if nipype created the config.ini file and remove if true (https://github.com/nipy/nipype/pull/1132)
64+
* ENH: Use a while loop to wait for Xvfb (up to a max wait time "xvfb_max_wait" in config file, default 10)
65+
(https://github.com/nipy/nipype/pull/1142)
6166

6267
Release 0.10.0 (October 10, 2014)
6368
============

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ to `NeuroStars.org <http://neurostars.org>`_ with a *nipype* tag. `NeuroStars.or
7777
http://neurostars.org/t/nipype/
7878
7979

80-
To participate in the Nipype development related discussion please use the following mailing list::
80+
To participate in the Nipype development related discussions please use the following mailing list::
8181
82-
http://projects.scipy.org/mailman/listinfo/nipy-devel
83-
82+
http://mail.python.org/mailman/listinfo/neuroimaging
83+
8484
Please add *[nipype]* to the subject line when posting on the mailing list.
8585

8686

@@ -124,5 +124,5 @@ There are interfaces to some GNU code but these are entirely optional.
124124
All trademarks referenced herein are property of their respective
125125
holders.
126126

127-
Copyright (c) 2009-2014, NIPY Developers
127+
Copyright (c) 2009-2015, NIPY Developers
128128
All rights reserved.

bin/nipype2boutiques

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
3+
# vi: set ft=python sts=4 ts=4 sw=4 et:
4+
import sys
5+
from nipype.utils.nipype2boutiques import main
6+
7+
if __name__ == '__main__':
8+
main(sys.argv)

doc/quickstart.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,13 @@ Developer guides
5050
devel/gitwash/index
5151

5252
.. include:: links_names.txt
53+
54+
Useful links for beginners
55+
===========================
56+
57+
Getting started with Python - Tutorials. `Available here`__
58+
59+
Python for Beginners `Available here`__
60+
61+
__ http://www.codecademy.com/en/tracks/python
62+
__ https://www.python.org/about/gettingstarted/

doc/users/config_file.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ Execution
125125
all pending jobs and checking for job completion. To be nice to cluster
126126
schedulers the default is set to 60 seconds.
127127

128+
*xvfb_max_wait*
129+
Maximum time (in seconds) to wait for Xvfb to start, if the _redirect_x parameter of an Interface is True.
130+
128131
Example
129132
~~~~~~~
130133

doc/users/tutorial_101.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ This results in a workflow containing two isolated nodes:
9999

100100
**5. Connecting nodes to each other**
101101

102-
We want to connect the output produced by realignment to the input of
103-
smoothing. This is done as follows.
102+
We want to connect the output produced by the node realignment to the input of
103+
the node smoothing. This is done as follows.
104104

105105
.. testcode::
106106

107107
workflow.connect(realigner, 'realigned_files', smoother, 'in_files')
108108

109-
or alternatively, a more flexible notation can be used. Although not shown here,
110-
the following notation can be used to connect multiple outputs from one node to
109+
110+
Although not shown here, the following notation can be used to connect multiple outputs from one node to
111111
multiple inputs (see step 7 below).
112112

113113
.. testcode::
@@ -189,3 +189,22 @@ inside which are three folders: realign, smooth and artdetect (the names
189189
of the nodes). The outputs of these routines are in these folders.
190190

191191
.. include:: ../links_names.txt
192+
193+
.. glossary::
194+
195+
pipeline
196+
Connected series of processes (processes can be run parallel and or sequential)
197+
198+
workflow
199+
(kind of synonymous to pipeline) = hosting the nodes
200+
201+
node
202+
= switching-point within a pipeline, you can give it a name (in the above example e.g. realigner),
203+
a node usually requires an or several inputs and will produce an or several outputs
204+
205+
interface
206+
= specific software (e.g. FSL, SPM ...) are wrapped in interfaces, within a node instances of an
207+
interface can be run
208+
209+
modules
210+
for each interface the according modules have to be imported in the usual pythonic manner

examples/fmri_ants_openfmri.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def create_reg_workflow(name='registration'):
124124
'transformed_files',
125125
'transformed_mean',
126126
'anat2target',
127+
'mean2anat_mask'
127128
]),
128129
name='outputspec')
129130

@@ -171,6 +172,13 @@ def create_reg_workflow(name='registration'):
171172
register.connect(mean2anat, 'out_matrix_file',
172173
mean2anatbbr, 'in_matrix_file')
173174

175+
"""
176+
Create a mask of the median image coregistered to the anatomical image
177+
"""
178+
179+
mean2anat_mask = Node(fsl.BET(mask=True), name='mean2anat_mask')
180+
register.connect(mean2anatbbr, 'out_file', mean2anat_mask, 'in_file')
181+
174182
"""
175183
Convert the BBRegister transformation to ANTS ITK format
176184
"""
@@ -276,6 +284,8 @@ def create_reg_workflow(name='registration'):
276284
register.connect(warpall, 'output_image', outputnode, 'transformed_files')
277285
register.connect(mean2anatbbr, 'out_matrix_file',
278286
outputnode, 'func2anat_transform')
287+
register.connect(mean2anat_mask, 'mask_file',
288+
outputnode, 'mean2anat_mask')
279289
register.connect(reg, 'composite_transform',
280290
outputnode, 'anat2target_transform')
281291

@@ -333,7 +343,8 @@ def create_fs_reg_workflow(name='registration'):
333343
'transformed_files',
334344
'min_cost_file',
335345
'anat2target',
336-
'aparc'
346+
'aparc',
347+
'mean2anat_mask'
337348
]),
338349
name='outputspec')
339350

@@ -349,7 +360,7 @@ def create_fs_reg_workflow(name='registration'):
349360
register.connect(fssource, 'T1', convert, 'in_file')
350361

351362
# Coregister the median to the surface
352-
bbregister = Node(freesurfer.BBRegister(),
363+
bbregister = Node(freesurfer.BBRegister(registered_file=True),
353364
name='bbregister')
354365
bbregister.inputs.init = 'fsl'
355366
bbregister.inputs.contrast_type = 't2'
@@ -359,6 +370,10 @@ def create_fs_reg_workflow(name='registration'):
359370
register.connect(inputnode, 'mean_image', bbregister, 'source_file')
360371
register.connect(inputnode, 'subjects_dir', bbregister, 'subjects_dir')
361372

373+
# Create a mask of the median coregistered to the anatomical image
374+
mean2anat_mask = Node(fsl.BET(mask=True), name='mean2anat_mask')
375+
register.connect(bbregister, 'registered_file', mean2anat_mask, 'in_file')
376+
362377
"""
363378
use aparc+aseg's brain mask
364379
"""
@@ -500,6 +515,8 @@ def create_fs_reg_workflow(name='registration'):
500515
outputnode, 'out_reg_file')
501516
register.connect(bbregister, 'min_cost_file',
502517
outputnode, 'min_cost_file')
518+
register.connect(mean2anat_mask, 'mask_file',
519+
outputnode, 'mean2anat_mask')
503520
register.connect(reg, 'composite_transform',
504521
outputnode, 'anat2target_transform')
505522
register.connect(merge, 'out', outputnode, 'transforms')
@@ -964,6 +981,8 @@ def get_subs(subject_id, conds, run_id, model_id, task_id):
964981
subs.append(('/model%03d/task%03d_' % (model_id, task_id), '/'))
965982
subs.append(('_bold_dtype_mcf_bet_thresh_dil', '_mask'))
966983
subs.append(('_output_warped_image', '_anat2target'))
984+
subs.append(('median_flirt_brain_mask', 'median_brain_mask'))
985+
subs.append(('median_bbreg_brain_mask', 'median_brain_mask'))
967986
return subs
968987

969988
subsgen = pe.Node(niu.Function(input_names=['subject_id', 'conds', 'run_id',
@@ -998,6 +1017,7 @@ def get_subs(subject_id, conds, run_id, model_id, task_id):
9981017
('outputspec.motion_plots',
9991018
'qa.motion.plots'),
10001019
('outputspec.mask', 'qa.mask')])])
1020+
wf.connect(registration, 'outputspec.mean2anat_mask', datasink, 'qa.mask.mean2anat')
10011021
wf.connect(art, 'norm_files', datasink, 'qa.art.@norm')
10021022
wf.connect(art, 'intensity_files', datasink, 'qa.art.@intensity')
10031023
wf.connect(art, 'outlier_files', datasink, 'qa.art.@outlier_files')

examples/rsfmri_vol_surface_preprocessing_nipy.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ def create_reg_workflow(name='registration'):
387387
'transformed_mean',
388388
'segmentation_files',
389389
'anat2target',
390-
'aparc'
390+
'aparc',
391+
'min_cost_file'
391392
]),
392393
name='outputspec')
393394

@@ -505,7 +506,7 @@ def create_reg_workflow(name='registration'):
505506
reg.inputs.args = '--float'
506507
reg.inputs.output_warped_image = 'output_warped_image.nii.gz'
507508
reg.inputs.num_threads = 4
508-
reg.plugin_args = {'qsub_args': '-l nodes=1:ppn=4'}
509+
reg.plugin_args = {'sbatch_args': '-c%d' % 4}
509510
register.connect(stripper, 'out_file', reg, 'moving_image')
510511
register.connect(inputnode,'target_image', reg,'fixed_image')
511512

@@ -531,6 +532,7 @@ def create_reg_workflow(name='registration'):
531532
warpmean.inputs.terminal_output = 'file'
532533
warpmean.inputs.args = '--float'
533534
warpmean.inputs.num_threads = 4
535+
warpmean.plugin_args = {'sbatch_args': '-c%d' % 4}
534536

535537
register.connect(inputnode,'target_image', warpmean,'reference_image')
536538
register.connect(inputnode, 'mean_image', warpmean, 'input_image')
@@ -554,6 +556,8 @@ def create_reg_workflow(name='registration'):
554556
register.connect(reg, 'composite_transform',
555557
outputnode, 'anat2target_transform')
556558
register.connect(merge, 'out', outputnode, 'transforms')
559+
register.connect(bbregister, 'min_cost_file',
560+
outputnode, 'min_cost_file')
557561

558562
return register
559563

@@ -593,6 +597,7 @@ def create_workflow(files,
593597
realign.inputs.slice_times = slice_times
594598
realign.inputs.tr = TR
595599
realign.inputs.slice_info = 2
600+
realign.plugin_args = {'sbatch_args': '-c%d' % 4}
596601

597602

598603
# Comute TSNR on realigned data regressing polynomials upto order 2
@@ -615,6 +620,13 @@ def create_workflow(files,
615620
registration.inputs.inputspec.subjects_dir = subjects_dir
616621
registration.inputs.inputspec.target_image = target_file
617622

623+
"""Quantify TSNR in each freesurfer ROI
624+
"""
625+
get_roi_tsnr = MapNode(fs.SegStats(default_color_table=True),
626+
iterfield=['in_file'], name='get_aparc_tsnr')
627+
get_roi_tsnr.inputs.avgwf_txt_file = True
628+
wf.connect(tsnr, 'tsnr_file', get_roi_tsnr, 'in_file')
629+
wf.connect(registration, 'outputspec.aparc', get_roi_tsnr, 'segmentation_file')
618630

619631
"""Use :class:`nipype.algorithms.rapidart` to determine which of the
620632
images in the functional series are outliers based on deviations in
@@ -754,7 +766,8 @@ def merge_files(in1, in2):
754766
warpall.inputs.terminal_output = 'file'
755767
warpall.inputs.reference_image = target_file
756768
warpall.inputs.args = '--float'
757-
warpall.inputs.num_threads = 1
769+
warpall.inputs.num_threads = 2
770+
warpall.plugin_args = {'sbatch_args': '-c%d' % 2}
758771

759772
# transform to target
760773
wf.connect(collector, 'out', warpall, 'input_image')
@@ -874,13 +887,14 @@ def get_names(files, suffix):
874887
substitutions += [("_filtermotion%d" % i,"") for i in range(11)[::-1]]
875888
substitutions += [("_filter_noise_nosmooth%d" % i,"") for i in range(11)[::-1]]
876889
substitutions += [("_makecompcorfilter%d" % i,"") for i in range(11)[::-1]]
890+
substitutions += [("_get_aparc_tsnr%d/" % i, "run%d_" % (i + 1)) for i in range(11)[::-1]]
877891

878-
substitutions += [("T1_out_brain_pve_0_maths_warped","compcor_csf"),
879-
("T1_out_brain_pve_1_maths_warped","compcor_gm"),
892+
substitutions += [("T1_out_brain_pve_0_maths_warped", "compcor_csf"),
893+
("T1_out_brain_pve_1_maths_warped", "compcor_gm"),
880894
("T1_out_brain_pve_2_maths_warped", "compcor_wm"),
881-
("output_warped_image_maths","target_brain_mask"),
882-
("median_brain_mask","native_brain_mask"),
883-
("corr_","")]
895+
("output_warped_image_maths", "target_brain_mask"),
896+
("median_brain_mask", "native_brain_mask"),
897+
("corr_", "")]
884898

885899
regex_subs = [('_combiner.*/sar', '/smooth/'),
886900
('_combiner.*/ar', '/unsmooth/'),
@@ -910,6 +924,11 @@ def get_names(files, suffix):
910924
wf.connect(filter1, 'out_pf', datasink, 'resting.qa.compmaps.@mc_pF')
911925
wf.connect(filter2, 'out_f', datasink, 'resting.qa.compmaps')
912926
wf.connect(filter2, 'out_pf', datasink, 'resting.qa.compmaps.@p')
927+
wf.connect(registration, 'outputspec.min_cost_file', datasink, 'resting.qa.mincost')
928+
wf.connect(tsnr, 'tsnr_file', datasink, 'resting.qa.tsnr.@map')
929+
wf.connect([(get_roi_tsnr, datasink, [('avgwf_txt_file', 'resting.qa.tsnr'),
930+
('summary_file', 'resting.qa.tsnr.@summary')])])
931+
913932
wf.connect(bandpass, 'out_files', datasink, 'resting.timeseries.@bandpassed')
914933
wf.connect(smooth, 'out_file', datasink, 'resting.timeseries.@smoothed')
915934
wf.connect(createfilter1, 'out_files',

0 commit comments

Comments
 (0)