diff --git a/CHANGES b/CHANGES index 6ea2883c72..29efcfdbf9 100644 --- a/CHANGES +++ b/CHANGES @@ -51,6 +51,7 @@ Next release * ENH: Added csvReader() utility (https://github.com/nipy/nipype/pull/1044) * FIX: typo in nipype.interfaces.freesurfer.utils.py Tkregister2 (https://github.com/nipy/nipype/pull/1083) * FIX: SSHDataGrabber outputs now return full path to the grabbed/downloaded files. (https://github.com/nipy/nipype/pull/1086) +* FIX: Add QA output for TSNR to resting workflow (https://github.com/nipy/nipype/pull/1088) Release 0.10.0 (October 10, 2014) ============ diff --git a/examples/rsfmri_vol_surface_preprocessing_nipy.py b/examples/rsfmri_vol_surface_preprocessing_nipy.py index f72de82d13..25e949b31e 100644 --- a/examples/rsfmri_vol_surface_preprocessing_nipy.py +++ b/examples/rsfmri_vol_surface_preprocessing_nipy.py @@ -387,7 +387,8 @@ def create_reg_workflow(name='registration'): 'transformed_mean', 'segmentation_files', 'anat2target', - 'aparc' + 'aparc', + 'min_cost_file' ]), name='outputspec') @@ -505,7 +506,7 @@ def create_reg_workflow(name='registration'): reg.inputs.args = '--float' reg.inputs.output_warped_image = 'output_warped_image.nii.gz' reg.inputs.num_threads = 4 - reg.plugin_args = {'qsub_args': '-l nodes=1:ppn=4'} + reg.plugin_args = {'sbatch_args': '-c%d' % 4} register.connect(stripper, 'out_file', reg, 'moving_image') register.connect(inputnode,'target_image', reg,'fixed_image') @@ -531,6 +532,7 @@ def create_reg_workflow(name='registration'): warpmean.inputs.terminal_output = 'file' warpmean.inputs.args = '--float' warpmean.inputs.num_threads = 4 + warpmean.plugin_args = {'sbatch_args': '-c%d' % 4} register.connect(inputnode,'target_image', warpmean,'reference_image') register.connect(inputnode, 'mean_image', warpmean, 'input_image') @@ -554,6 +556,8 @@ def create_reg_workflow(name='registration'): register.connect(reg, 'composite_transform', outputnode, 'anat2target_transform') register.connect(merge, 'out', outputnode, 'transforms') + register.connect(bbregister, 'min_cost_file', + outputnode, 'min_cost_file') return register @@ -593,6 +597,7 @@ def create_workflow(files, realign.inputs.slice_times = slice_times realign.inputs.tr = TR realign.inputs.slice_info = 2 + realign.plugin_args = {'sbatch_args': '-c%d' % 4} # Comute TSNR on realigned data regressing polynomials upto order 2 @@ -615,6 +620,13 @@ def create_workflow(files, registration.inputs.inputspec.subjects_dir = subjects_dir registration.inputs.inputspec.target_image = target_file + """Quantify TSNR in each freesurfer ROI + """ + get_roi_tsnr = MapNode(fs.SegStats(default_color_table=True), + iterfield=['in_file'], name='get_aparc_tsnr') + get_roi_tsnr.inputs.avgwf_txt_file = True + wf.connect(tsnr, 'tsnr_file', get_roi_tsnr, 'in_file') + wf.connect(registration, 'outputspec.aparc', get_roi_tsnr, 'segmentation_file') """Use :class:`nipype.algorithms.rapidart` to determine which of the images in the functional series are outliers based on deviations in @@ -754,7 +766,8 @@ def merge_files(in1, in2): warpall.inputs.terminal_output = 'file' warpall.inputs.reference_image = target_file warpall.inputs.args = '--float' - warpall.inputs.num_threads = 1 + warpall.inputs.num_threads = 2 + warpall.plugin_args = {'sbatch_args': '-c%d' % 2} # transform to target wf.connect(collector, 'out', warpall, 'input_image') @@ -874,13 +887,14 @@ def get_names(files, suffix): substitutions += [("_filtermotion%d" % i,"") for i in range(11)[::-1]] substitutions += [("_filter_noise_nosmooth%d" % i,"") for i in range(11)[::-1]] substitutions += [("_makecompcorfilter%d" % i,"") for i in range(11)[::-1]] + substitutions += [("_get_aparc_tsnr%d/" % i, "run%d_" % (i + 1)) for i in range(11)[::-1]] - substitutions += [("T1_out_brain_pve_0_maths_warped","compcor_csf"), - ("T1_out_brain_pve_1_maths_warped","compcor_gm"), + substitutions += [("T1_out_brain_pve_0_maths_warped", "compcor_csf"), + ("T1_out_brain_pve_1_maths_warped", "compcor_gm"), ("T1_out_brain_pve_2_maths_warped", "compcor_wm"), - ("output_warped_image_maths","target_brain_mask"), - ("median_brain_mask","native_brain_mask"), - ("corr_","")] + ("output_warped_image_maths", "target_brain_mask"), + ("median_brain_mask", "native_brain_mask"), + ("corr_", "")] regex_subs = [('_combiner.*/sar', '/smooth/'), ('_combiner.*/ar', '/unsmooth/'), @@ -910,6 +924,11 @@ def get_names(files, suffix): wf.connect(filter1, 'out_pf', datasink, 'resting.qa.compmaps.@mc_pF') wf.connect(filter2, 'out_f', datasink, 'resting.qa.compmaps') wf.connect(filter2, 'out_pf', datasink, 'resting.qa.compmaps.@p') + wf.connect(registration, 'outputspec.min_cost_file', datasink, 'resting.qa.mincost') + wf.connect(tsnr, 'tsnr_file', datasink, 'resting.qa.tsnr.@map') + wf.connect([(get_roi_tsnr, datasink, [('avgwf_txt_file', 'resting.qa.tsnr'), + ('summary_file', 'resting.qa.tsnr.@summary')])]) + wf.connect(bandpass, 'out_files', datasink, 'resting.timeseries.@bandpassed') wf.connect(smooth, 'out_file', datasink, 'resting.timeseries.@smoothed') wf.connect(createfilter1, 'out_files',