From 513be36c7174b065566c2db96ea6c9881da82860 Mon Sep 17 00:00:00 2001 From: rciric Date: Fri, 25 Jan 2019 23:40:30 -0800 Subject: [PATCH 01/34] (#1458) sketch CompCor enhancement --- fmriprep/workflows/bold/confounds.py | 57 ++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index ba66ad8f8..25274a0d0 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -15,6 +15,7 @@ from niworkflows.data import get_template from niworkflows.engine.workflows import LiterateWorkflow as Workflow +from niworkflows.interfaces.confounds import ExpandModel, SpikeRegressors from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms from niworkflows.interfaces.images import SignalExtraction from niworkflows.interfaces.masks import ROIsPlot @@ -22,6 +23,9 @@ RobustACompCor as ACompCor, RobustTCompCor as TCompCor, ) +from niworkflows.interfaces.plotting import ( + CompCorVariancePlot, ConfoundsCorrelationPlot +) from niworkflows.interfaces.segmentation import ICA_AROMARPT from niworkflows.interfaces.utils import ( TPM2ROI, AddTPMs, AddTSVHeader @@ -183,12 +187,13 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): # a/t-CompCor tcompcor = pe.Node( TCompCor(components_file='tcompcor.tsv', header_prefix='t_comp_cor_', pre_filter='cosine', - save_pre_filter=True, percentile_threshold=.05), + save_pre_filter=True, num_components='all', save_metadata=True, + percentile_threshold=.05), name="tcompcor", mem_gb=mem_gb) acompcor = pe.Node( ACompCor(components_file='acompcor.tsv', header_prefix='a_comp_cor_', pre_filter='cosine', - save_pre_filter=True), + save_pre_filter=True, num_components='all', save_metadata=True), name="acompcor", mem_gb=mem_gb) # Set TR if present @@ -213,7 +218,7 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): name="add_motion_headers", mem_gb=0.01, run_without_submitting=True) concat = pe.Node(GatherConfounds(), name="concat", mem_gb=0.01, run_without_submitting=True) - # Generate reportlet + # Generate reportlet (ROIs) mrg_compcor = pe.Node(niu.Merge(2), name='merge_compcor', run_without_submitting=True) rois_plot = pe.Node(ROIsPlot(colors=['b', 'magenta'], generate_report=True), name='rois_plot', mem_gb=mem_gb) @@ -223,6 +228,40 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): name='ds_report_bold_rois', run_without_submitting=True, mem_gb=DEFAULT_MEMORY_MIN_GB) + # Generate reportlet (CompCor) + mrg_cc_metadata = pe.Node(niu.Merge(2), name='merge_compcor_metadata', + run_without_submitting=True) + compcor_plot = pe.Node(CompCorVariancePlot( + variance_thresholds=(0.5, 0.7, 0.9), + metadata_sources=['tCompCor', 'aCompCor']), + name='compcor_plot') + ds_report_compcor = pe.Node( + DerivativesDataSink(suffix='compcor'), + name='ds_report_compcor', run_without_submitting=True, + mem_gb=DEFAULT_MEMORY_MIN_GB) + + # Generate reportlet (Confound correlation) + conf_corr_plot = pe.Node(ConfoundsCorrelationPlot( + reference_column='global_signal'), + name='conf_corr_plot') + ds_report_conf_corr = pe.Node( + DerivativesDataSink(suffix='confounds_correlation'), + name='ds_report_conf_corr', run_without_submitting=True, + mem_gb=DEFAULT_MEMORY_MIN_GB) + + # Expand model to include derivatives and quadratics + model_expand = pe.Node(ExpandModel( + model_formula='(dd1(rps + wm + csf + gsr))^^2 + others'), + name='model_expansion') + + # Add spike regressors + spike_regress = pe.Node(SpikeRegressors( + criteria={ + 'framewise_displacement': ('>', 0.2), + 'dvars': ('>', 20) + }), + name='spike_regressors') + def _pick_csf(files): return files[0] @@ -295,14 +334,24 @@ def _pick_wm(files): (add_dvars_header, concat, [('out_file', 'dvars')]), (add_std_dvars_header, concat, [('out_file', 'std_dvars')]), + # Expand the model with derivatives, quadratics, and spikes + (concat, model_expand, [('confounds_file', 'confounds_file')]), + (model_expand, spike_regress, [('confounds_file', 'confounds_file')]), + # Set outputs - (concat, outputnode, [('confounds_file', 'confounds_file')]), + (spike_regress, outputnode, [('confounds_file', 'confounds_file')]), (inputnode, rois_plot, [('bold', 'in_file'), ('bold_mask', 'in_mask')]), (tcompcor, mrg_compcor, [('high_variance_masks', 'in1')]), (acc_msk, mrg_compcor, [('out', 'in2')]), (mrg_compcor, rois_plot, [('out', 'in_rois')]), (rois_plot, ds_report_bold_rois, [('out_report', 'in_file')]), + (tcompcor, mrg_cc_metadata, [('metadata_file', 'in1')]), + (acompcor, mrg_cc_metadata, [('metadata_file', 'in2')]), + (mrg_cc_metadata, compcor_plot, [('out', 'metadata_files')]), + (compcor_plot, ds_report_compcor, [('out_file', 'in_file')]), + (concat, conf_corr_plot, [('confounds_file', 'confounds_file')]), + (conf_corr_plot, ds_report_conf_corr, [('out_file', 'in_file')]), ]) return workflow From ce35dd6e726749e7b1e68115dfeff1760a5461a7 Mon Sep 17 00:00:00 2001 From: rciric Date: Fri, 25 Jan 2019 23:41:18 -0800 Subject: [PATCH 02/34] (#1458) new reportlets for CompCor and confounds --- fmriprep/viz/config.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fmriprep/viz/config.json b/fmriprep/viz/config.json index 235ab5ce7..2da387013 100644 --- a/fmriprep/viz/config.json +++ b/fmriprep/viz/config.json @@ -133,6 +133,18 @@ "file_pattern": "func/.*ica_aroma", "title": "ICA AROMA", "description": "Maps created with maximum intensity projection (glass brain) with a black brain outline. Right hand side of each map: time series (top in seconds), frequency spectrum (bottom in Hertz). Components classified as signal are plotted in green; noise components in red." + }, + { + "name": "compcor", + "file_pattern": "func/.*compcor", + "title": "CompCor", + "description": "The cumulative variance explained by the first k components of the t/aCompCor decomposition, for all values of k. The number of components that must be included in the model in order to explain some fraction of variance in the decomposition mask can be used as a feature selection criterion for confound regression." + }, + { + "name": "confounds_correlation", + "file_pattern": "func/.*confounds_correlation", + "title": "Correlations among nuisance regressors", + "description": "Left: Heatmap summarising the correlation structure among confound variables. (Cosine bases and PCA-derived CompCor components are orthogonal.) Right: magnitude of the correlation between each confound time series and the mean global signal. Strong correlations might be indicative of partial volume effects and can inform decisions about feature orthogonalisation prior to confound regression." } ] }, From ce4d1307aa9ba82f1e963bbf23e7739ce19cb4ac Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 15:26:28 -0800 Subject: [PATCH 03/34] jsonise and return CompCor metadata --- fmriprep/workflows/bold/confounds.py | 65 ++++++++++++++++++---------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 25274a0d0..a0102847c 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -28,7 +28,7 @@ ) from niworkflows.interfaces.segmentation import ICA_AROMARPT from niworkflows.interfaces.utils import ( - TPM2ROI, AddTPMs, AddTSVHeader + TPM2ROI, AddTPMs, AddTSVHeader, TSV2JSON ) from ...interfaces import ( @@ -131,23 +131,28 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): *preprocessed BOLD* time-series (using a discrete cosine filter with 128s cut-off) for the two *CompCor* variants: temporal (tCompCor) and anatomical (aCompCor). -Six tCompCor components are then calculated from the top 5% variable +tCompCor components are then calculated from the top 5% variable voxels within a mask covering the subcortical regions. This subcortical mask is obtained by heavily eroding the brain mask, which ensures it does not include cortical GM regions. -For aCompCor, six components are calculated within the intersection of +For aCompCor, components are calculated within the intersection of the aforementioned mask and the union of CSF and WM masks calculated in T1w space, after their projection to the native space of each functional run (using the inverse BOLD-to-T1w transformation). The head-motion estimates calculated in the correction step were also placed within the corresponding confounds file. +The confound time series derived from head motion estimates and global +signals were expanded with the inclusion of temporal derivatives and +quadratic terms for each [@satterthwaite]. +Frames that exceeded a threshold of 0.2 mm FD or 20 DVARS were classified +as motion outliers [following @power_fd_dvars]. """ inputnode = pe.Node(niu.IdentityInterface( fields=['bold', 'bold_mask', 'movpar_file', 'skip_vols', 't1_mask', 't1_tpms', 't1_bold_xform']), name='inputnode') outputnode = pe.Node(niu.IdentityInterface( - fields=['confounds_file']), + fields=['confounds_file', 'tcompcor_metadata', 'acompcor_metadata']), name='outputnode') # Get masks ready in T1w space @@ -218,6 +223,29 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): name="add_motion_headers", mem_gb=0.01, run_without_submitting=True) concat = pe.Node(GatherConfounds(), name="concat", mem_gb=0.01, run_without_submitting=True) + # CompCor metadata + tcc_metadata_fmt = pe.Node( + TSV2JSON(index_column='component', drop_columns=['mask'], + additional_metadata={'Method': 'tCompCor'}, enforce_case=True), + name='tcc_metadata_fmt') + acc_metadata_fmt = pe.Node( + TSV2JSON(index_column='component', drop_columns=['mask'], + additional_metadata={'Method': 'aCompCor'}, enforce_case=True), + name='acc_metadata_fmt') + + # Expand model to include derivatives and quadratics + model_expand = pe.Node(ExpandModel( + model_formula='(dd1(rps + wm + csf + gsr))^^2 + others'), + name='model_expansion') + + # Add spike regressors + spike_regress = pe.Node(SpikeRegressors( + criteria={ + 'framewise_displacement': ('>', 0.2), + 'dvars': ('>', 20) + }), + name='spike_regressors') + # Generate reportlet (ROIs) mrg_compcor = pe.Node(niu.Merge(2), name='merge_compcor', run_without_submitting=True) rois_plot = pe.Node(ROIsPlot(colors=['b', 'magenta'], generate_report=True), @@ -231,9 +259,9 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): # Generate reportlet (CompCor) mrg_cc_metadata = pe.Node(niu.Merge(2), name='merge_compcor_metadata', run_without_submitting=True) - compcor_plot = pe.Node(CompCorVariancePlot( - variance_thresholds=(0.5, 0.7, 0.9), - metadata_sources=['tCompCor', 'aCompCor']), + compcor_plot = pe.Node( + CompCorVariancePlot(variance_thresholds=(0.5, 0.7, 0.9), + metadata_sources=['tCompCor', 'aCompCor']), name='compcor_plot') ds_report_compcor = pe.Node( DerivativesDataSink(suffix='compcor'), @@ -241,27 +269,14 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): mem_gb=DEFAULT_MEMORY_MIN_GB) # Generate reportlet (Confound correlation) - conf_corr_plot = pe.Node(ConfoundsCorrelationPlot( - reference_column='global_signal'), + conf_corr_plot = pe.Node( + ConfoundsCorrelationPlot(reference_column='global_signal', max_dim=70), name='conf_corr_plot') ds_report_conf_corr = pe.Node( DerivativesDataSink(suffix='confounds_correlation'), name='ds_report_conf_corr', run_without_submitting=True, mem_gb=DEFAULT_MEMORY_MIN_GB) - # Expand model to include derivatives and quadratics - model_expand = pe.Node(ExpandModel( - model_formula='(dd1(rps + wm + csf + gsr))^^2 + others'), - name='model_expansion') - - # Add spike regressors - spike_regress = pe.Node(SpikeRegressors( - criteria={ - 'framewise_displacement': ('>', 0.2), - 'dvars': ('>', 20) - }), - name='spike_regressors') - def _pick_csf(files): return files[0] @@ -334,12 +349,18 @@ def _pick_wm(files): (add_dvars_header, concat, [('out_file', 'dvars')]), (add_std_dvars_header, concat, [('out_file', 'std_dvars')]), + # Confounds metadata + (tcompcor, tcc_metadata_fmt, [('metadata_file', 'in_file')]), + (acompcor, acc_metadata_fmt, [('metadata_file', 'in_file')]), + # Expand the model with derivatives, quadratics, and spikes (concat, model_expand, [('confounds_file', 'confounds_file')]), (model_expand, spike_regress, [('confounds_file', 'confounds_file')]), # Set outputs (spike_regress, outputnode, [('confounds_file', 'confounds_file')]), + (tcc_metadata_fmt, outputnode, [('out_file', 'tcompcor_metadata')]), + (acc_metadata_fmt, outputnode, [('out_file', 'acompcor_metadata')]), (inputnode, rois_plot, [('bold', 'in_file'), ('bold_mask', 'in_mask')]), (tcompcor, mrg_compcor, [('high_variance_masks', 'in1')]), From 64a65ee678cd0711cab7f53116acd8bb4b807927 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 15:26:56 -0800 Subject: [PATCH 04/34] jsonise and return CompCor metadata --- fmriprep/workflows/bold/base.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 4f410d026..4d3515b0e 100755 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -349,7 +349,8 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, fields=['bold_t1', 'bold_t1_ref', 'bold_mask_t1', 'bold_aseg_t1', 'bold_aparc_t1', 'bold_mni', 'bold_mni_ref' 'bold_mask_mni', 'bold_aseg_mni', 'bold_aparc_mni', 'bold_cifti', 'cifti_variant', 'cifti_variant_key', 'confounds', 'surfaces', - 'aroma_noise_ics', 'melodic_mix', 'nonaggr_denoised_file']), + 'aroma_noise_ics', 'melodic_mix', 'nonaggr_denoised_file', + 'tcompcor_metadata', 'acompcor_metadata']), name='outputnode') # BOLD buffer: an identity used as a pointer to either the original BOLD @@ -390,7 +391,9 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, ('nonaggr_denoised_file', 'inputnode.nonaggr_denoised_file'), ('bold_cifti', 'inputnode.bold_cifti'), ('cifti_variant', 'inputnode.cifti_variant'), - ('cifti_variant_key', 'inputnode.cifti_variant_key') + ('cifti_variant_key', 'inputnode.cifti_variant_key'), + ('tcompcor_metadata', 'inputnode.tcompcor_metadata'), + ('acompcor_metadata', 'inputnode.acompcor_metadata') ]), ]) @@ -577,6 +580,12 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, (bold_confounds_wf, outputnode, [ ('outputnode.confounds_file', 'confounds'), ]), + (bold_confounds_wf, outputnode, [ + ('outputnode.acompcor_metadata', 'acompcor_metadata'), + ]), + (bold_confounds_wf, outputnode, [ + ('outputnode.tcompcor_metadata', 'tcompcor_metadata'), + ]), # Connect bold_bold_trans_wf (bold_split, bold_bold_trans_wf, [ ('out_files', 'inputnode.bold_file')]), @@ -860,16 +869,29 @@ def init_func_derivatives_wf(output_dir, output_spaces, template, freesurfer, 'bold_aseg_t1', 'bold_aparc_t1', 'bold_aseg_mni', 'bold_aparc_mni', 'cifti_variant_key', 'confounds', 'surfaces', 'aroma_noise_ics', 'melodic_mix', - 'nonaggr_denoised_file', 'bold_cifti', 'cifti_variant']), + 'nonaggr_denoised_file', 'bold_cifti', 'cifti_variant', + 'tcompcor_metadata', 'acompcor_metadata']), name='inputnode') ds_confounds = pe.Node(DerivativesDataSink( base_directory=output_dir, desc='confounds', suffix='regressors'), name="ds_confounds", run_without_submitting=True, mem_gb=DEFAULT_MEMORY_MIN_GB) + ds_tcc_metadata = pe.Node(DerivativesDataSink( + base_directory=output_dir, desc='tcompcor', suffix='decomposition'), + name="ds_tcc_metadata", run_without_submitting=True, + mem_gb=DEFAULT_MEMORY_MIN_GB) + ds_acc_metadata = pe.Node(DerivativesDataSink( + base_directory=output_dir, desc='acompcor', suffix='decomposition'), + name="ds_acc_metadata", run_without_submitting=True, + mem_gb=DEFAULT_MEMORY_MIN_GB) workflow.connect([ (inputnode, ds_confounds, [('source_file', 'source_file'), ('confounds', 'in_file')]), + (inputnode, ds_tcc_metadata, [('source_file', 'source_file'), + ('tcompcor_metadata', 'in_file')]), + (inputnode, ds_acc_metadata, [('source_file', 'source_file'), + ('acompcor_metadata', 'in_file')]), ]) # Resample to T1w space From 0008fb1aedea12543b7f38e28cfdf0a9468a4749 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 15:27:40 -0800 Subject: [PATCH 05/34] add references for expanded model and censoring thresholds --- fmriprep/data/boilerplate.bib | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fmriprep/data/boilerplate.bib b/fmriprep/data/boilerplate.bib index bd91f8305..3b69d98c2 100644 --- a/fmriprep/data/boilerplate.bib +++ b/fmriprep/data/boilerplate.bib @@ -220,6 +220,20 @@ @article{power_fd_dvars year = 2014 } +@article{satterthwaite, + author = {Satterthwaite, Theodore D. and Elliott, Mark A. and Gerraty, Raphael T. and Ruparel, Kosha and Loughead, James and Calkins, Monica E. and Eickhoff, Simon B. and Hakonarson, Hakon and Gur, Ruben C. and Gur, Raquel E. and Wolf, Daniel H.}, + doi = {10.1016/j.neuroimage.2012.08.052}, + issn = {10538119}, + journal = {NeuroImage}, + number = 1, + pages = {240--256}, + title = {{An improved framework for confound regression and filtering for control of motion artifact in the preprocessing of resting-state functional connectivity data}}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S1053811912008609}, + volume = 64, + year = 2013 +} + + @article{nilearn, author = {Abraham, Alexandre and Pedregosa, Fabian and Eickenberg, Michael and Gervais, Philippe and Mueller, Andreas and Kossaifi, Jean and Gramfort, Alexandre and Thirion, Bertrand and Varoquaux, Gael}, doi = {10.3389/fninf.2014.00014}, From 4d5d6148a67ff740a4f46e5a0920144c8e2c3cc2 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 16:10:16 -0800 Subject: [PATCH 06/34] acompcor metadata to circle --- .circleci/ds005_outputs.txt | 2 ++ .circleci/ds005_partial_outputs.txt | 1 + .circleci/ds054_outputs.txt | 2 ++ .circleci/ds210_outputs.txt | 1 + 4 files changed, 6 insertions(+) diff --git a/.circleci/ds005_outputs.txt b/.circleci/ds005_outputs.txt index 436618b5e..4322a879d 100644 --- a/.circleci/ds005_outputs.txt +++ b/.circleci/ds005_outputs.txt @@ -37,6 +37,7 @@ fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.nii +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-acompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-MELODIC_mixing.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-L.func.gii @@ -57,6 +58,7 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-T1w_desc-preproc_ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.nii +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-acompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-MELODIC_mixing.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsaverage5_hemi-L.func.gii diff --git a/.circleci/ds005_partial_outputs.txt b/.circleci/ds005_partial_outputs.txt index 6d88d792d..e879072b0 100644 --- a/.circleci/ds005_partial_outputs.txt +++ b/.circleci/ds005_partial_outputs.txt @@ -37,6 +37,7 @@ fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.nii +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-acompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-MELODIC_mixing.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-L.func.gii diff --git a/.circleci/ds054_outputs.txt b/.circleci/ds054_outputs.txt index 57c032c87..f017f5dd7 100644 --- a/.circleci/ds054_outputs.txt +++ b/.circleci/ds054_outputs.txt @@ -23,6 +23,7 @@ fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-CSF_probseg. fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz fmriprep/sub-100185/func +fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-acompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-confounds_regressors.tsv fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz @@ -30,6 +31,7 @@ fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009 fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-brain_mask.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-preproc_bold.nii.gz +fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-acompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-confounds_regressors.tsv fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz diff --git a/.circleci/ds210_outputs.txt b/.circleci/ds210_outputs.txt index 671e5d50f..3d7520c27 100644 --- a/.circleci/ds210_outputs.txt +++ b/.circleci/ds210_outputs.txt @@ -23,6 +23,7 @@ fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz fmriprep/sub-02/func +fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-acompcor_decomposition.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_regressors.tsv fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz From 71ff4dc55cd317d3451c8f350bbf8a1682c6800c Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 16:13:39 -0800 Subject: [PATCH 07/34] add contributor --- .zenodo.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.zenodo.json b/.zenodo.json index c369fbca0..83f961270 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -103,6 +103,11 @@ "affiliation": "University College London", "orcid": "0000-0002-9699-9052" }, + { + "name": "Ciric, Rastko", + "affiliation": "Stanford University", + "orcid": "0000-0001-6347-7939" + }, { "name": "Poldrack, Russell A.", "affiliation": "Department of Psychology, Stanford University", From 6ffe441c101c05b9f01ee190d1c4cfe8bc84e824 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 17:05:06 -0800 Subject: [PATCH 08/34] tcompcor metadata to circle --- .circleci/ds005_outputs.txt | 2 ++ .circleci/ds005_partial_outputs.txt | 1 + .circleci/ds054_outputs.txt | 2 ++ .circleci/ds210_outputs.txt | 1 + 4 files changed, 6 insertions(+) diff --git a/.circleci/ds005_outputs.txt b/.circleci/ds005_outputs.txt index 4322a879d..600da2c33 100644 --- a/.circleci/ds005_outputs.txt +++ b/.circleci/ds005_outputs.txt @@ -40,6 +40,7 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.nii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-acompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-MELODIC_mixing.tsv +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-tcompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-L.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-R.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsnative_hemi-L.func.gii @@ -61,6 +62,7 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.nii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-acompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-MELODIC_mixing.tsv +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-tcompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsaverage5_hemi-L.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsaverage5_hemi-R.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsnative_hemi-L.func.gii diff --git a/.circleci/ds005_partial_outputs.txt b/.circleci/ds005_partial_outputs.txt index e879072b0..25fd41c44 100644 --- a/.circleci/ds005_partial_outputs.txt +++ b/.circleci/ds005_partial_outputs.txt @@ -40,6 +40,7 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.nii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-acompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-MELODIC_mixing.tsv +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-tcompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-L.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-R.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsnative_hemi-L.func.gii diff --git a/.circleci/ds054_outputs.txt b/.circleci/ds054_outputs.txt index f017f5dd7..45518bdcc 100644 --- a/.circleci/ds054_outputs.txt +++ b/.circleci/ds054_outputs.txt @@ -25,6 +25,7 @@ fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-WM_probseg.n fmriprep/sub-100185/func fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-acompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-confounds_regressors.tsv +fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-tcompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz @@ -33,6 +34,7 @@ fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-brain fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-preproc_bold.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-acompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-confounds_regressors.tsv +fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-tcompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz diff --git a/.circleci/ds210_outputs.txt b/.circleci/ds210_outputs.txt index 3d7520c27..ada2c3d59 100644 --- a/.circleci/ds210_outputs.txt +++ b/.circleci/ds210_outputs.txt @@ -25,6 +25,7 @@ fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz fmriprep/sub-02/func fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-acompcor_decomposition.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_regressors.tsv +fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-tcompcor_decomposition.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz From ebfa9f915d0e9a4919f116c109fb64555a1f0741 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 27 Jan 2019 17:57:26 -0800 Subject: [PATCH 09/34] fix figure legends --- fmriprep/viz/config.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fmriprep/viz/config.json b/fmriprep/viz/config.json index 2da387013..949239517 100644 --- a/fmriprep/viz/config.json +++ b/fmriprep/viz/config.json @@ -96,7 +96,7 @@ "name": "epi/rois", "file_pattern": "func/.*_rois", "title": "ROIs in BOLD space", - "description": "Brain mask calculated on the BOLD signal (red contour), along with the masks used for a/tCompCor.
The aCompCor mask (magenta contour) is a conservative CSF and white-matter mask for extracting physiological and movement confounds.
The fCompCor mask (blue contour) contains the top 5% most variable voxels within a heavily-eroded brain-mask." + "description": "Brain mask calculated on the BOLD signal (red contour), along with the masks used for a/tCompCor.
The aCompCor mask (magenta contour) is a conservative CSF and white-matter mask for extracting physiological and movement confounds.
The tCompCor mask (blue contour) contains the top 5% most variable voxels within a heavily-eroded brain-mask." }, { "name": "epi_mean_t1_registration/flirt", @@ -138,13 +138,13 @@ "name": "compcor", "file_pattern": "func/.*compcor", "title": "CompCor", - "description": "The cumulative variance explained by the first k components of the t/aCompCor decomposition, for all values of k. The number of components that must be included in the model in order to explain some fraction of variance in the decomposition mask can be used as a feature selection criterion for confound regression." + "description": "The cumulative variance explained by the first k components of the t/aCompCor decomposition, plotted for all values of k. The number of components that must be included in the model in order to explain some fraction of variance in the decomposition mask can be used as a feature selection criterion for confound regression." }, { "name": "confounds_correlation", "file_pattern": "func/.*confounds_correlation", "title": "Correlations among nuisance regressors", - "description": "Left: Heatmap summarising the correlation structure among confound variables. (Cosine bases and PCA-derived CompCor components are orthogonal.) Right: magnitude of the correlation between each confound time series and the mean global signal. Strong correlations might be indicative of partial volume effects and can inform decisions about feature orthogonalisation prior to confound regression." + "description": "Left: Heatmap summarising the correlation structure among confound variables. (Cosine bases and PCA-derived CompCor components are inherently orthogonal.) Right: magnitude of the correlation between each confound time series and the mean global signal. Strong correlations might be indicative of partial volume effects and can inform decisions about feature orthogonalisation prior to confound regression." } ] }, From 95dcb2ae8ebdab72c79eed3e111bf3444694ae30 Mon Sep 17 00:00:00 2001 From: rciric Date: Wed, 30 Jan 2019 20:35:13 -0800 Subject: [PATCH 10/34] more descriptive citation --- fmriprep/data/boilerplate.bib | 2 +- fmriprep/workflows/bold/confounds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fmriprep/data/boilerplate.bib b/fmriprep/data/boilerplate.bib index 3b69d98c2..239f288c6 100644 --- a/fmriprep/data/boilerplate.bib +++ b/fmriprep/data/boilerplate.bib @@ -220,7 +220,7 @@ @article{power_fd_dvars year = 2014 } -@article{satterthwaite, +@article{confounds_satterthwaite_2012, author = {Satterthwaite, Theodore D. and Elliott, Mark A. and Gerraty, Raphael T. and Ruparel, Kosha and Loughead, James and Calkins, Monica E. and Eickhoff, Simon B. and Hakonarson, Hakon and Gur, Ruben C. and Gur, Raquel E. and Wolf, Daniel H.}, doi = {10.1016/j.neuroimage.2012.08.052}, issn = {10538119}, diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index a0102847c..510ef2055 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -143,7 +143,7 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): placed within the corresponding confounds file. The confound time series derived from head motion estimates and global signals were expanded with the inclusion of temporal derivatives and -quadratic terms for each [@satterthwaite]. +quadratic terms for each [@confounds_satterthwaite_2012]. Frames that exceeded a threshold of 0.2 mm FD or 20 DVARS were classified as motion outliers [following @power_fd_dvars]. """ From 1e50ae333f2739ceb9ae5679e7286ddef74f5a7f Mon Sep 17 00:00:00 2001 From: rciric Date: Wed, 30 Jan 2019 23:08:55 -0800 Subject: [PATCH 11/34] run aCompCor for WM, CSF, and combined masks --- fmriprep/data/boilerplate.bib | 2 +- fmriprep/workflows/bold/confounds.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/fmriprep/data/boilerplate.bib b/fmriprep/data/boilerplate.bib index 239f288c6..14bad8936 100644 --- a/fmriprep/data/boilerplate.bib +++ b/fmriprep/data/boilerplate.bib @@ -220,7 +220,7 @@ @article{power_fd_dvars year = 2014 } -@article{confounds_satterthwaite_2012, +@article{confounds_satterthwaite_2013, author = {Satterthwaite, Theodore D. and Elliott, Mark A. and Gerraty, Raphael T. and Ruparel, Kosha and Loughead, James and Calkins, Monica E. and Eickhoff, Simon B. and Hakonarson, Hakon and Gur, Ruben C. and Gur, Raquel E. and Wolf, Daniel H.}, doi = {10.1016/j.neuroimage.2012.08.052}, issn = {10538119}, diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 510ef2055..463171d2c 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -143,7 +143,7 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): placed within the corresponding confounds file. The confound time series derived from head motion estimates and global signals were expanded with the inclusion of temporal derivatives and -quadratic terms for each [@confounds_satterthwaite_2012]. +quadratic terms for each [@confounds_satterthwaite_2013]. Frames that exceeded a threshold of 0.2 mm FD or 20 DVARS were classified as motion outliers [following @power_fd_dvars]. """ @@ -190,6 +190,8 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): name="fdisp", mem_gb=mem_gb) # a/t-CompCor + mrg_lbl_cc = pe.Node(niu.Merge(3), name='merge_rois_cc', run_without_submitting=True) + tcompcor = pe.Node( TCompCor(components_file='tcompcor.tsv', header_prefix='t_comp_cor_', pre_filter='cosine', save_pre_filter=True, num_components='all', save_metadata=True, @@ -198,7 +200,8 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): acompcor = pe.Node( ACompCor(components_file='acompcor.tsv', header_prefix='a_comp_cor_', pre_filter='cosine', - save_pre_filter=True, num_components='all', save_metadata=True), + save_pre_filter=True, num_components='all', save_metadata=True, + mask_names=['combined', 'CSF', 'WM'], merge_method='none'), name="acompcor", mem_gb=mem_gb) # Set TR if present @@ -325,7 +328,10 @@ def _pick_wm(files): (inputnode, acompcor, [('bold', 'realigned_file')]), (inputnode, acompcor, [('skip_vols', 'ignore_initial_volumes')]), (acc_tfm, acc_msk, [('output_image', 'roi_file')]), - (acc_msk, acompcor, [('out', 'mask_files')]), + (acc_msk, mrg_lbl_cc, [('out', 'in1')]), + (csf_msk, mrg_lbl_cc, [('out', 'in2')]), + (wm_msk, mrg_lbl_cc, [('out', 'in3')]), + (mrg_lbl_cc, acompcor, [('out', 'mask_files')]), # Global signals extraction (constrained by anatomy) (inputnode, signals, [('bold', 'in_file')]), From 22c9e4b065489be11b8dadf028a0efde5b7661e2 Mon Sep 17 00:00:00 2001 From: rciric Date: Thu, 7 Feb 2019 23:26:53 -0800 Subject: [PATCH 12/34] specification of spike thresholds and decomposition output --- fmriprep/workflows/bold/confounds.py | 39 ++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 463171d2c..95fba9ae4 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -41,7 +41,8 @@ DEFAULT_MEMORY_MIN_GB = 0.01 -def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): +def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, + spike_criteria=None, name="bold_confs_wf"): """ This workflow calculates confounds for a BOLD series, and aggregates them into a :abbr:`TSV (tab-separated value)` file, for use as nuisance @@ -87,6 +88,15 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): BIDS metadata for BOLD file name : str Name of workflow (default: ``bold_confs_wf``) + return_all_components: bool + Indicates whether CompCor decompositions should return all + components instead of the minimal number of components necessary + to explain 50 percent of the variance in the decomposition mask. + fd_spike_thr + Criterion for flagging framewise displacement outliers + dv_spike_thr + Criterion for flagging DVARS outliers + **Inputs** @@ -144,9 +154,9 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): The confound time series derived from head motion estimates and global signals were expanded with the inclusion of temporal derivatives and quadratic terms for each [@confounds_satterthwaite_2013]. -Frames that exceeded a threshold of 0.2 mm FD or 20 DVARS were classified -as motion outliers [following @power_fd_dvars]. -""" +Frames that exceeded a threshold of {fd} mm FD or {dv} standardised DVARS +were classified as motion outliers. +""".format(fd=fd_spike_thr, dv=dv_spike_thr) inputnode = pe.Node(niu.IdentityInterface( fields=['bold', 'bold_mask', 'movpar_file', 'skip_vols', 't1_mask', 't1_tpms', 't1_bold_xform']), @@ -194,16 +204,23 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): tcompcor = pe.Node( TCompCor(components_file='tcompcor.tsv', header_prefix='t_comp_cor_', pre_filter='cosine', - save_pre_filter=True, num_components='all', save_metadata=True, - percentile_threshold=.05), + save_pre_filter=True, save_metadata=True, percentile_threshold=.05), name="tcompcor", mem_gb=mem_gb) acompcor = pe.Node( ACompCor(components_file='acompcor.tsv', header_prefix='a_comp_cor_', pre_filter='cosine', - save_pre_filter=True, num_components='all', save_metadata=True, - mask_names=['combined', 'CSF', 'WM'], merge_method='none'), + save_pre_filter=True, save_metadata=True, mask_names=['combined', 'CSF', 'WM'], + merge_method='none'), name="acompcor", mem_gb=mem_gb) + # Set number of components + if return_all_components: + acompcor.inputs.num_components = 'all' + tcompcor.inputs.num_components = 'all' + else: + acompcor.inputs.variance_threshold = 0.5 + tcompcor.inputs.variance_threshold = 0.5 + # Set TR if present if 'RepetitionTime' in metadata: tcompcor.inputs.repetition_time = metadata['RepetitionTime'] @@ -232,7 +249,7 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): additional_metadata={'Method': 'tCompCor'}, enforce_case=True), name='tcc_metadata_fmt') acc_metadata_fmt = pe.Node( - TSV2JSON(index_column='component', drop_columns=['mask'], + TSV2JSON(index_column='component', additional_metadata={'Method': 'aCompCor'}, enforce_case=True), name='acc_metadata_fmt') @@ -244,8 +261,8 @@ def init_bold_confs_wf(mem_gb, metadata, name="bold_confs_wf"): # Add spike regressors spike_regress = pe.Node(SpikeRegressors( criteria={ - 'framewise_displacement': ('>', 0.2), - 'dvars': ('>', 20) + 'framewise_displacement': ('>', fd_spike_thr), + 'std_dvars': ('>', dv_spike_thr) }), name='spike_regressors') From 31347286277e6ae62940d434f46d409b3db81395 Mon Sep 17 00:00:00 2001 From: rciric Date: Thu, 7 Feb 2019 23:27:46 -0800 Subject: [PATCH 13/34] propagate spike and CompCor specs --- fmriprep/workflows/base.py | 24 ++++++++++++++++++++++-- fmriprep/workflows/bold/base.py | 10 ++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 9df863293..74c5bada0 100755 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -39,7 +39,8 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output omp_nthreads, skull_strip_template, skull_strip_fixed_seed, freesurfer, output_spaces, template, medial_surface_nan, cifti_output, hires, use_bbr, bold2t1w_dof, fmap_bspline, fmap_demean, use_syn, force_syn, - use_aroma, ignore_aroma_err, aroma_melodic_dim, template_out_grid): + use_aroma, ignore_aroma_err, aroma_melodic_dim, template_out_grid, + return_all_components, fd_spike_thr, dv_spike_thr): """ This workflow organizes the execution of FMRIPREP, with a sub-workflow for each subject. @@ -167,6 +168,12 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output template_out_grid : str Keyword ('native', '1mm' or '2mm') or path of custom reference image for normalization + return_all_components + Return all CompCor component time series instead of the top fraction + fd_spike_thr + Criterion for flagging framewise displacement outliers + dv_spike_thr + Criterion for flagging DVARS outliers """ fmriprep_wf = Workflow(name='fmriprep_wf') @@ -215,6 +222,9 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output use_aroma=use_aroma, aroma_melodic_dim=aroma_melodic_dim, ignore_aroma_err=ignore_aroma_err, + return_all_components=return_all_components, + fd_spike_thr=fd_spike_thr, + dv_spike_thr=dv_spike_thr, ) single_subject_wf.config['execution']['crashdump_dir'] = ( @@ -237,7 +247,8 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir, freesurfer, output_spaces, template, medial_surface_nan, cifti_output, hires, use_bbr, bold2t1w_dof, fmap_bspline, fmap_demean, use_syn, force_syn, template_out_grid, - use_aroma, aroma_melodic_dim, ignore_aroma_err): + use_aroma, aroma_melodic_dim, ignore_aroma_err, + return_all_components, fd_spike_thr, dv_spike_thr): """ This workflow organizes the preprocessing pipeline for a single subject. It collects and reports information about the subject, and prepares @@ -365,6 +376,12 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir, Perform ICA-AROMA on MNI-resampled functional series ignore_aroma_err : bool Do not fail on ICA-AROMA errors + return_all_components + Return all CompCor component time series instead of the top fraction + fd_spike_thr + Criterion for flagging framewise displacement outliers + dv_spike_thr + Criterion for flagging DVARS outliers Inputs @@ -503,6 +520,9 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir, use_aroma=use_aroma, aroma_melodic_dim=aroma_melodic_dim, ignore_aroma_err=ignore_aroma_err, + return_all_components=return_all_components, + fd_spike_thr=fd_spike_thr, + dv_spike_thr=dv_spike_thr, num_bold=len(subject_data['bold'])) workflow.connect([ diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 4d3515b0e..60379bf39 100755 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -50,6 +50,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, output_spaces, template, output_dir, omp_nthreads, fmap_bspline, fmap_demean, use_syn, force_syn, use_aroma, ignore_aroma_err, aroma_melodic_dim, + return_all_components, fd_spike_thr, dv_spike_thr, medial_surface_nan, cifti_output, debug, low_mem, template_out_grid, layout=None, num_bold=1): @@ -136,6 +137,12 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, Perform ICA-AROMA on MNI-resampled functional series ignore_aroma_err : bool Do not fail on ICA-AROMA errors + return_all_components + Return all CompCor component time series instead of the top fraction + fd_spike_thr + Criterion for flagging framewise displacement outliers + dv_spike_thr + Criterion for flagging DVARS outliers medial_surface_nan : bool Replace medial wall values with NaNs on functional GIFTI files cifti_output : bool @@ -431,6 +438,9 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, bold_confounds_wf = init_bold_confs_wf( mem_gb=mem_gb['largemem'], metadata=metadata, + return_all_components=return_all_components, + fd_spike_thr=fd_spike_thr, + dv_spike_thr=dv_spike_thr, name='bold_confounds_wf') bold_confounds_wf.get_node('inputnode').inputs.t1_transform_flags = [False] From b99afb0e617e9ad3aab93b031f47aef3b2911574 Mon Sep 17 00:00:00 2001 From: rciric Date: Thu, 7 Feb 2019 23:28:17 -0800 Subject: [PATCH 14/34] add CLI options for spikes and CompCor --- fmriprep/cli/run.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fmriprep/cli/run.py b/fmriprep/cli/run.py index 2b0662204..e3de65f4b 100755 --- a/fmriprep/cli/run.py +++ b/fmriprep/cli/run.py @@ -178,6 +178,22 @@ def get_parser(): help='Exact or maximum number of MELODIC components to estimate ' '(positive = exact, negative = maximum)') + # Confounds options + g_confounds = parser.add_argument_group('Specific options for estimating confounds') + g_confounds.add_argument( + '--return-all-components', required=False, action='store_true', default=False, + help='Include all components estimated in CompCor decomposition in the confounds ' + 'file instead of only the components sufficient to explain 50 percent of ' + 'BOLD variance in each CompCor mask') + g.confounds.add_argument( + '--fd-spike-threshold', required=False, action='store', default=0.5, type=float, + help='Threshold for flagging a frame as an outlier on the basis of framewise ' + 'displacement') + g.confounds.add_argument( + '--dvars-spike-threshold', required=False, action='store', default=1.5, type=float, + help='Threshold for flagging a frame as an outlier on the basis of standardised ' + 'DVARS') + # ANTs options g_ants = parser.add_argument_group('Specific options for ANTs registrations') g_ants.add_argument('--skull-strip-template', action='store', default='OASIS', @@ -747,6 +763,9 @@ def build_workflow(opts, retval): use_aroma=opts.use_aroma, aroma_melodic_dim=opts.aroma_melodic_dimensionality, ignore_aroma_err=opts.ignore_aroma_denoising_errors, + return_all_components=opts.return_all_components, + fd_spike_thr=opts.fd_spike_threshold, + dv_spike_thr=opts.dvars_spike_threshold, ) retval['return_code'] = 0 From 56186297327b14435c020dba50c74400545ef925 Mon Sep 17 00:00:00 2001 From: rciric Date: Fri, 8 Feb 2019 02:49:33 -0800 Subject: [PATCH 15/34] [skip ci] expand description, minor fixes --- fmriprep/cli/run.py | 4 ++-- fmriprep/workflows/bold/confounds.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fmriprep/cli/run.py b/fmriprep/cli/run.py index e3de65f4b..86c7ffcbb 100755 --- a/fmriprep/cli/run.py +++ b/fmriprep/cli/run.py @@ -185,11 +185,11 @@ def get_parser(): help='Include all components estimated in CompCor decomposition in the confounds ' 'file instead of only the components sufficient to explain 50 percent of ' 'BOLD variance in each CompCor mask') - g.confounds.add_argument( + g_confounds.add_argument( '--fd-spike-threshold', required=False, action='store', default=0.5, type=float, help='Threshold for flagging a frame as an outlier on the basis of framewise ' 'displacement') - g.confounds.add_argument( + g_confounds.add_argument( '--dvars-spike-threshold', required=False, action='store', default=1.5, type=float, help='Threshold for flagging a frame as an outlier on the basis of standardised ' 'DVARS') diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 95fba9ae4..4980fbd78 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -42,7 +42,7 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, - spike_criteria=None, name="bold_confs_wf"): + fd_spike_thr=0.5, dv_spike_thr=1.5, name="bold_confs_wf"): """ This workflow calculates confounds for a BOLD series, and aggregates them into a :abbr:`TSV (tab-separated value)` file, for use as nuisance @@ -148,7 +148,8 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, For aCompCor, components are calculated within the intersection of the aforementioned mask and the union of CSF and WM masks calculated in T1w space, after their projection to the native space of each -functional run (using the inverse BOLD-to-T1w transformation). +functional run (using the inverse BOLD-to-T1w transformation). Components +are also calculated separately within the WM and CSF masks. The head-motion estimates calculated in the correction step were also placed within the corresponding confounds file. The confound time series derived from head motion estimates and global From 3a0d14990a6904f2f0c4e3ca56741ef68a8f4244 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 17 Feb 2019 01:03:05 -0800 Subject: [PATCH 16/34] [skip ci] conform to updated SpikeRegressors interface --- fmriprep/workflows/bold/confounds.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 4980fbd78..0e9600452 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -261,10 +261,8 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, # Add spike regressors spike_regress = pe.Node(SpikeRegressors( - criteria={ - 'framewise_displacement': ('>', fd_spike_thr), - 'std_dvars': ('>', dv_spike_thr) - }), + fd_thresh=fd_spike_thr, + dvars_thresh=dv_spike_thr), name='spike_regressors') # Generate reportlet (ROIs) From 0b323367b2fa3fce58c857977b760fdf3a5fe073 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 20 Feb 2019 20:00:10 -0800 Subject: [PATCH 17/34] pin adequate versions of nipype and niworkflows --- fmriprep/__about__.py | 4 +++- requirements.txt | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index 04a115881..48a88d7e8 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -87,7 +87,7 @@ 'indexed_gzip>=0.8.8', 'nibabel>=2.2.1', 'nilearn', - 'nipype>=1.1.6', + 'nipype', 'nitime', 'niworkflows>=0.7.2,<0.8.0a0', 'numpy', @@ -104,6 +104,8 @@ LINKS_REQUIRES = [ + 'git+https://github.com/rciric/nipype.git@' + 'a742c9ce7c57ce5547910e0aceacde9b185c48df#egg=nipype', ] TESTS_REQUIRES = [ diff --git a/requirements.txt b/requirements.txt index 7377c4b78..b8c4e9204 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ pybids>=0.7.0,<0.8.0a0 -git+https://github.com/poldracklab/niworkflows.git@b97787ee2f1b93cafb104664b60fa0c4fd81253a#egg=niworkflows-0.7.1 +git+https://github.com/rciric/nipype.git@a742c9ce7c57ce5547910e0aceacde9b185c48df#egg=nipype +niworkflows>=0.7.2,<0.8.0a0 smriprep>=0.0.5,<0.1.0a0 templateflow>=0.0.4 From d9c33e93a5cec76d73a15cc56de2981dc1e45509 Mon Sep 17 00:00:00 2001 From: rciric Date: Fri, 22 Feb 2019 03:37:45 -0800 Subject: [PATCH 18/34] [skip ci] update documentation to reflect new confounds options --- docs/outputs.rst | 2 +- docs/workflows.rst | 11 ++++++++++- fmriprep/workflows/base.py | 8 +++++++- fmriprep/workflows/bold/base.py | 3 +++ fmriprep/workflows/bold/confounds.py | 5 ++++- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/outputs.rst b/docs/outputs.rst index 5dc791c6b..3a02e6347 100644 --- a/docs/outputs.rst +++ b/docs/outputs.rst @@ -173,7 +173,7 @@ motion-correction parameters estimated by fMRIPrep; if present, ``non_steady_state_outlier_XX`` columns indicate non-steady state volumes with a single ``1`` value and ``0`` elsewhere (*i.e.*, there is one ``non_steady_state_outlier_XX`` column per outlier/volume); -six noise components are calculated using :abbr:`CompCor (Component Based Noise Correction)`, +additional noise components are calculated using :abbr:`CompCor (Component Based Noise Correction)`, according to both the anatomical (``a_comp_cor_XX``) and temporal (``t_comp_cor_XX``) variants; and the motion-related components identified by :abbr:`ICA (independent components analysis)`-:abbr:`AROMA (Automatic Removal Of Motion Artifacts)` diff --git a/docs/workflows.rst b/docs/workflows.rst index fe8980052..ae0dd0a57 100644 --- a/docs/workflows.rst +++ b/docs/workflows.rst @@ -52,6 +52,9 @@ is presented below: use_aroma=False, aroma_melodic_dim=-200, ignore_aroma_err=False, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5 ) @@ -274,6 +277,9 @@ BOLD preprocessing use_aroma=False, aroma_melodic_dim=-200, ignore_aroma_err=False, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5 ) Preprocessing of :abbr:`BOLD (blood-oxygen level-dependent)` files is @@ -518,7 +524,10 @@ Confounds estimation name="discover_wf", mem_gb=1, metadata={"RepetitionTime": 2.0, - "SliceTiming": [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]}) + "SliceTiming": [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]}, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5) Given a motion-corrected fMRI, a brain mask, ``mcflirt`` movement parameters and a segmentation, the `discover_wf` sub-workflow calculates potential diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index 74c5bada0..7a26265df 100755 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -87,6 +87,9 @@ def init_fmriprep_wf(subject_list, task_id, echo_idx, run_uuid, work_dir, output use_aroma=False, ignore_aroma_err=False, aroma_melodic_dim=-200, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5, template_out_grid='native') @@ -296,7 +299,10 @@ def init_single_subject_wf(subject_id, task_id, echo_idx, name, reportlets_dir, template_out_grid='native', use_aroma=False, aroma_melodic_dim=-200, - ignore_aroma_err=False) + ignore_aroma_err=False, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5) Parameters diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 60379bf39..de39addc6 100755 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -86,6 +86,9 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, use_aroma=False, ignore_aroma_err=False, aroma_melodic_dim=-200, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5, num_bold=1) **Parameters** diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 0e9600452..f2fe59a2f 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -76,7 +76,10 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, from fmriprep.workflows.bold.confounds import init_bold_confs_wf wf = init_bold_confs_wf( mem_gb=1, - metadata={}) + metadata={}, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5) **Parameters** From ae1d91d01c14df190897d5f92d02e62ab392cbed Mon Sep 17 00:00:00 2001 From: rciric Date: Fri, 22 Feb 2019 03:48:17 -0800 Subject: [PATCH 19/34] [skip ci] update documentation to reflect new confounds options --- docs/workflows.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/workflows.rst b/docs/workflows.rst index ed3364fea..c79540088 100644 --- a/docs/workflows.rst +++ b/docs/workflows.rst @@ -53,14 +53,10 @@ is presented below: template_out_grid='native', use_aroma=False, aroma_melodic_dim=-200, -<<<<<<< HEAD - ignore_aroma_err=False, + err_on_aroma_warn=False, return_all_components=False, fd_spike_thr=0.5, dv_spike_thr=1.5 -======= - err_on_aroma_warn=False, ->>>>>>> 38d0550dcde6d0e212e115b31ea57f7732254406 ) From b0a74903cc2d1a1dce31c53652366a369f65cac7 Mon Sep 17 00:00:00 2001 From: rciric Date: Wed, 27 Mar 2019 10:05:08 -0700 Subject: [PATCH 20/34] use NaN failure mode for empty masks [skip ci] --- fmriprep/workflows/bold/confounds.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 0880415c6..4febd8b4a 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -208,13 +208,14 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, tcompcor = pe.Node( TCompCor(components_file='tcompcor.tsv', header_prefix='t_comp_cor_', pre_filter='cosine', - save_pre_filter=True, save_metadata=True, percentile_threshold=.05), + save_pre_filter=True, save_metadata=True, percentile_threshold=.05, + failure_mode='NaN'), name="tcompcor", mem_gb=mem_gb) acompcor = pe.Node( ACompCor(components_file='acompcor.tsv', header_prefix='a_comp_cor_', pre_filter='cosine', save_pre_filter=True, save_metadata=True, mask_names=['combined', 'CSF', 'WM'], - merge_method='none'), + merge_method='none', failure_mode='NaN'), name="acompcor", mem_gb=mem_gb) # Set number of components From f5b9e35a3e6fc2e074199cea8a299828d72d7cd8 Mon Sep 17 00:00:00 2001 From: rciric Date: Wed, 10 Apr 2019 08:43:40 -0700 Subject: [PATCH 21/34] sketch confounds metadata sink --- fmriprep/workflows/bold/base.py | 27 ++++++--------------------- fmriprep/workflows/bold/confounds.py | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 51b2c8731..6e7f0dede 100755 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -360,7 +360,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, 'bold_mni', 'bold_mni_ref' 'bold_mask_mni', 'bold_aseg_mni', 'bold_aparc_mni', 'bold_cifti', 'cifti_variant', 'cifti_variant_key', 'confounds', 'surfaces', 'aroma_noise_ics', 'melodic_mix', 'nonaggr_denoised_file', - 'tcompcor_metadata', 'acompcor_metadata']), + 'confounds_metadata']), name='outputnode') # BOLD buffer: an identity used as a pointer to either the original BOLD @@ -403,8 +403,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, ('bold_cifti', 'inputnode.bold_cifti'), ('cifti_variant', 'inputnode.cifti_variant'), ('cifti_variant_key', 'inputnode.cifti_variant_key'), - ('tcompcor_metadata', 'inputnode.tcompcor_metadata'), - ('acompcor_metadata', 'inputnode.acompcor_metadata') + ('confounds_metadata', 'inputnode.confounds_metadata'), ]), ]) @@ -595,10 +594,7 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, ('outputnode.confounds_file', 'confounds'), ]), (bold_confounds_wf, outputnode, [ - ('outputnode.acompcor_metadata', 'acompcor_metadata'), - ]), - (bold_confounds_wf, outputnode, [ - ('outputnode.tcompcor_metadata', 'tcompcor_metadata'), + ('outputnode.confounds_metadata', 'confounds_metadata'), ]), # Connect bold_bold_trans_wf (bold_split, bold_bold_trans_wf, [ @@ -885,28 +881,17 @@ def init_func_derivatives_wf(output_dir, output_spaces, template, freesurfer, 'bold_aparc_mni', 'cifti_variant_key', 'confounds', 'surfaces', 'aroma_noise_ics', 'melodic_mix', 'nonaggr_denoised_file', 'bold_cifti', 'cifti_variant', - 'tcompcor_metadata', 'acompcor_metadata']), + 'confounds_metadata']), name='inputnode') ds_confounds = pe.Node(DerivativesDataSink( base_directory=output_dir, desc='confounds', suffix='regressors'), name="ds_confounds", run_without_submitting=True, mem_gb=DEFAULT_MEMORY_MIN_GB) - ds_tcc_metadata = pe.Node(DerivativesDataSink( - base_directory=output_dir, desc='tcompcor', suffix='decomposition'), - name="ds_tcc_metadata", run_without_submitting=True, - mem_gb=DEFAULT_MEMORY_MIN_GB) - ds_acc_metadata = pe.Node(DerivativesDataSink( - base_directory=output_dir, desc='acompcor', suffix='decomposition'), - name="ds_acc_metadata", run_without_submitting=True, - mem_gb=DEFAULT_MEMORY_MIN_GB) workflow.connect([ (inputnode, ds_confounds, [('source_file', 'source_file'), - ('confounds', 'in_file')]), - (inputnode, ds_tcc_metadata, [('source_file', 'source_file'), - ('tcompcor_metadata', 'in_file')]), - (inputnode, ds_acc_metadata, [('source_file', 'source_file'), - ('acompcor_metadata', 'in_file')]), + ('confounds', 'in_file'), + ('confounds_metadata', 'meta_dict')]), ]) # Resample to T1w space diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index 4febd8b4a..0d86dea0d 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -28,7 +28,7 @@ ) from niworkflows.interfaces.segmentation import ICA_AROMARPT from niworkflows.interfaces.utils import ( - TPM2ROI, AddTPMs, AddTSVHeader, TSV2JSON + TPM2ROI, AddTPMs, AddTSVHeader, TSV2JSON, DictMerge ) from ...interfaces import ( @@ -127,6 +127,8 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, rois_report Reportlet visualizing white-matter/CSF mask used for aCompCor, the ROI for tCompCor and the BOLD brain mask. + confounds_metadata + Confounds metadata dictionary. """ workflow = Workflow(name=name) @@ -166,7 +168,7 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, 't1_mask', 't1_tpms', 't1_bold_xform']), name='inputnode') outputnode = pe.Node(niu.IdentityInterface( - fields=['confounds_file', 'tcompcor_metadata', 'acompcor_metadata']), + fields=['confounds_file', 'confounds_metadata']), name='outputnode') # Get masks ready in T1w space @@ -250,13 +252,17 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, # CompCor metadata tcc_metadata_fmt = pe.Node( - TSV2JSON(index_column='component', drop_columns=['mask'], + TSV2JSON(index_column='component', drop_columns=['mask'], output=None, additional_metadata={'Method': 'tCompCor'}, enforce_case=True), name='tcc_metadata_fmt') acc_metadata_fmt = pe.Node( - TSV2JSON(index_column='component', + TSV2JSON(index_column='component', output=None, additional_metadata={'Method': 'aCompCor'}, enforce_case=True), name='acc_metadata_fmt') + mrg_conf_metadata = pe.Node(niu.Merge(2), name='merge_confound_metadata', + run_without_submitting=True) + mrg_conf_metadata2 = pe.Node(DictMerge(), name='merge_confound_metadata2', + run_without_submitting=True) # Expand model to include derivatives and quadratics model_expand = pe.Node(ExpandModel( @@ -378,6 +384,9 @@ def _pick_wm(files): # Confounds metadata (tcompcor, tcc_metadata_fmt, [('metadata_file', 'in_file')]), (acompcor, acc_metadata_fmt, [('metadata_file', 'in_file')]), + (tcc_metadata_fmt, mrg_conf_metadata, [('output', 'in1')]), + (acc_metadata_fmt, mrg_conf_metadata, [('output', 'in2')]), + (mrg_conf_metadata, mrg_conf_metadata2, [('out', 'in_dicts')]), # Expand the model with derivatives, quadratics, and spikes (concat, model_expand, [('confounds_file', 'confounds_file')]), @@ -385,8 +394,7 @@ def _pick_wm(files): # Set outputs (spike_regress, outputnode, [('confounds_file', 'confounds_file')]), - (tcc_metadata_fmt, outputnode, [('out_file', 'tcompcor_metadata')]), - (acc_metadata_fmt, outputnode, [('out_file', 'acompcor_metadata')]), + (mrg_conf_metadata2, outputnode, [('out_dict', 'confounds_metadata')]), (inputnode, rois_plot, [('bold', 'in_file'), ('bold_mask', 'in_mask')]), (tcompcor, mrg_compcor, [('high_variance_masks', 'in1')]), From 04ec5c9fc6cdd713bb959fe003781a1473f3f348 Mon Sep 17 00:00:00 2001 From: rciric Date: Sun, 14 Apr 2019 23:28:17 -0700 Subject: [PATCH 22/34] configure circle wf --- .circleci/ds005_outputs.txt | 6 ++---- .circleci/ds054_outputs.txt | 6 ++---- .circleci/ds210_outputs.txt | 3 +-- fmriprep/__about__.py | 2 ++ requirements.txt | 1 + 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.circleci/ds005_outputs.txt b/.circleci/ds005_outputs.txt index ff6cefa95..2e118a6d5 100644 --- a/.circleci/ds005_outputs.txt +++ b/.circleci/ds005_outputs.txt @@ -43,10 +43,9 @@ fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.dtseries.nii -fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-acompcor_decomposition.json +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_regressors.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-MELODIC_mixing.tsv -fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-tcompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-L.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsaverage5_hemi-R.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-fsnative_hemi-L.func.gii @@ -69,10 +68,9 @@ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_space-T1w_desc-preproc_ fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.nii -fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-acompcor_decomposition.json +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_regressors.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-MELODIC_mixing.tsv -fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-tcompcor_decomposition.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsaverage5_hemi-L.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsaverage5_hemi-R.func.gii fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsnative_hemi-L.func.gii diff --git a/.circleci/ds054_outputs.txt b/.circleci/ds054_outputs.txt index 25f6928fb..17b81eb92 100644 --- a/.circleci/ds054_outputs.txt +++ b/.circleci/ds054_outputs.txt @@ -27,9 +27,8 @@ fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-CSF_probseg. fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz fmriprep/sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz fmriprep/sub-100185/func -fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-acompcor_decomposition.json +fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-confounds_regressors.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-confounds_regressors.tsv -fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_desc-tcompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz @@ -40,9 +39,8 @@ fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-brain fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-brain_mask.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-preproc_bold.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-01_space-T1w_desc-preproc_bold.nii.gz -fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-acompcor_decomposition.json +fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-confounds_regressors.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-confounds_regressors.tsv -fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_desc-tcompcor_decomposition.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_desc-brain_mask.json fmriprep/sub-100185/func/sub-100185_task-machinegame_run-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz diff --git a/.circleci/ds210_outputs.txt b/.circleci/ds210_outputs.txt index 14f98a06b..a6ab90994 100644 --- a/.circleci/ds210_outputs.txt +++ b/.circleci/ds210_outputs.txt @@ -27,9 +27,8 @@ fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz fmriprep/sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz fmriprep/sub-02/func -fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-acompcor_decomposition.json +fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_regressors.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_regressors.tsv -fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_desc-tcompcor_decomposition.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.json fmriprep/sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index afc003c9f..17237e10e 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -106,6 +106,8 @@ LINKS_REQUIRES = [ 'git+https://github.com/poldracklab/smriprep.git@' '423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0', + 'git+https://github.com/rciric/nipype.git@' + '329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype', ] TESTS_REQUIRES = [ diff --git a/requirements.txt b/requirements.txt index f14f4b304..cecd36b62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ niworkflows<0.9.0a0,>=0.8.1 git+https://github.com/poldracklab/smriprep.git@423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0 +git+https://github.com/rciric/nipype.git@329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype templateflow<0.2.0a0,>=0.1.3 From e1fa3e4744b8f9a373f5d3ce95772eae98d402a3 Mon Sep 17 00:00:00 2001 From: rciric Date: Mon, 15 Apr 2019 02:15:57 -0700 Subject: [PATCH 23/34] configure circle wf --- fmriprep/__about__.py | 4 +++- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index 17237e10e..aa3a58093 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -89,7 +89,7 @@ 'nilearn', 'nipype', 'nitime', - 'niworkflows<0.9.0a0,>=0.8.1', + 'niworkflows', 'numpy', 'pandas', 'psutil>=5.4', @@ -108,6 +108,8 @@ '423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0', 'git+https://github.com/rciric/nipype.git@' '329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype', + 'git+https://github.com/rciric/niworkflows.git@' + '3946b126c7466e80c4b0347fe27f38ccc16b688f#egg=niworkflows', ] TESTS_REQUIRES = [ diff --git a/requirements.txt b/requirements.txt index cecd36b62..f9d331355 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -niworkflows<0.9.0a0,>=0.8.1 git+https://github.com/poldracklab/smriprep.git@423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0 git+https://github.com/rciric/nipype.git@329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype +git+https://github.com/rciric/niworkflows.git@3946b126c7466e80c4b0347fe27f38ccc16b688f#egg=niworkflows templateflow<0.2.0a0,>=0.1.3 From 9419f0034d1d90a72c71ecd5f6648022c1f24a79 Mon Sep 17 00:00:00 2001 From: rciric Date: Tue, 16 Apr 2019 20:10:59 -0700 Subject: [PATCH 24/34] update circle hash to latest niworkflows branch --- fmriprep/__about__.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index aa3a58093..38250f937 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -109,7 +109,7 @@ 'git+https://github.com/rciric/nipype.git@' '329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype', 'git+https://github.com/rciric/niworkflows.git@' - '3946b126c7466e80c4b0347fe27f38ccc16b688f#egg=niworkflows', + 'a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows', ] TESTS_REQUIRES = [ diff --git a/requirements.txt b/requirements.txt index f9d331355..a36cb7642 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ git+https://github.com/poldracklab/smriprep.git@423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0 git+https://github.com/rciric/nipype.git@329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype -git+https://github.com/rciric/niworkflows.git@3946b126c7466e80c4b0347fe27f38ccc16b688f#egg=niworkflows +git+https://github.com/rciric/niworkflows.git@a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows templateflow<0.2.0a0,>=0.1.3 From 9f1194a95e732d8af612b46013f197a6d48b2752 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 17 Apr 2019 08:34:36 -0700 Subject: [PATCH 25/34] fix(deps): pin correct nipype commit, fix duplicated niworkflows link --- fmriprep/__about__.py | 8 +++----- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index f76a2e7d9..d94d08e09 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -104,14 +104,12 @@ LINKS_REQUIRES = [ - 'git+https://github.com/poldracklab/niworkflows.git@' - 'b7d111c8fd36a099c74be5e7671677eedb175533#egg=niworkflows', - 'git+https://github.com/poldracklab/smriprep.git@' - '423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0', 'git+https://github.com/rciric/nipype.git@' - '329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype', + '4c1af8aca7191aff7568ef0a8009144839759f5c#egg=nipype', 'git+https://github.com/rciric/niworkflows.git@' 'a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows', + 'git+https://github.com/poldracklab/smriprep.git@' + '423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0', ] TESTS_REQUIRES = [ diff --git a/requirements.txt b/requirements.txt index a36cb7642..c7ff56578 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ git+https://github.com/poldracklab/smriprep.git@423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0 -git+https://github.com/rciric/nipype.git@329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype +git+https://github.com/rciric/nipype.git@4c1af8aca7191aff7568ef0a8009144839759f5c#egg=nipype git+https://github.com/rciric/niworkflows.git@a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows templateflow<0.2.0a0,>=0.1.3 From 1038b21e3017346c3f386ccba9d888d7df09c823 Mon Sep 17 00:00:00 2001 From: oesteban Date: Wed, 17 Apr 2019 11:04:31 -0700 Subject: [PATCH 26/34] fix(autodocs): remove extra parens in ``.. workflow::`` block of ``init_func_preproc_wf``. --- fmriprep/workflows/bold/base.py | 60 +++++++++++++++++---------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index e5ea04822..85ad4ee6a 100755 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -64,35 +64,37 @@ def init_func_preproc_wf(bold_file, ignore, freesurfer, from fmriprep.workflows.bold import init_func_preproc_wf from collections import namedtuple BIDSLayout = namedtuple('BIDSLayout', ['root'], defaults='.') - wf = init_func_preproc_wf('/completely/made/up/path/sub-01_task-nback_bold.nii.gz', - omp_nthreads=1, - ignore=[], - freesurfer=True, - reportlets_dir='.', - output_dir='.', - template='MNI152NLin2009cAsym', - output_spaces=['T1w', 'fsnative', - 'template', 'fsaverage5'], - debug=False, - use_bbr=True, - t2s_coreg=False, - bold2t1w_dof=9, - fmap_bspline=True, - fmap_demean=True, - use_syn=True, - force_syn=True, - low_mem=False, - template_out_grid='native', - medial_surface_nan=False, - cifti_output=False, - use_aroma=False, - err_on_aroma_warn=False, - aroma_melodic_dim=-200, - return_all_components=False, - fd_spike_thr=0.5, - dv_spike_thr=1.5, - num_bold=1, - layout=BIDSLayout())) + wf = init_func_preproc_wf( + '/completely/made/up/path/sub-01_task-nback_bold.nii.gz', + omp_nthreads=1, + ignore=[], + freesurfer=True, + reportlets_dir='.', + output_dir='.', + template='MNI152NLin2009cAsym', + output_spaces=['T1w', 'fsnative', + 'template', 'fsaverage5'], + debug=False, + use_bbr=True, + t2s_coreg=False, + bold2t1w_dof=9, + fmap_bspline=True, + fmap_demean=True, + use_syn=True, + force_syn=True, + low_mem=False, + template_out_grid='native', + medial_surface_nan=False, + cifti_output=False, + use_aroma=False, + err_on_aroma_warn=False, + aroma_melodic_dim=-200, + return_all_components=False, + fd_spike_thr=0.5, + dv_spike_thr=1.5, + num_bold=1, + layout=BIDSLayout(), + ) **Parameters** From 44708bc3d91615eab429ce2d3d5fe69e87197a7b Mon Sep 17 00:00:00 2001 From: oesteban Date: Wed, 17 Apr 2019 15:01:07 -0700 Subject: [PATCH 27/34] fix(tests): add output missing in partial derivatives index [skip docs][skip ds054][skip ds210][skip tests] --- .circleci/ds005_partial_outputs.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/ds005_partial_outputs.txt b/.circleci/ds005_partial_outputs.txt index 9f04d01ac..fbb2a93a1 100644 --- a/.circleci/ds005_partial_outputs.txt +++ b/.circleci/ds005_partial_outputs.txt @@ -43,6 +43,7 @@ fmriprep/sub-01/func fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_AROMAnoiseICs.csv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.dtseries.nii +fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_regressors.json fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_regressors.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-MELODIC_mixing.tsv fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_space-fsaverage5_hemi-L.func.gii From 4a7b5ffeadc81c6ab33adb7e2e5a073df1138e54 Mon Sep 17 00:00:00 2001 From: rciric Date: Fri, 19 Apr 2019 15:32:13 -0700 Subject: [PATCH 28/34] update pin for dependencies --- fmriprep/__about__.py | 4 ++-- requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index 38250f937..4a40f6acc 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -107,9 +107,9 @@ 'git+https://github.com/poldracklab/smriprep.git@' '423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0', 'git+https://github.com/rciric/nipype.git@' - '329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype', + 'b80a3d7f1cde35573a73246271bd0dcf42dc7f4b#egg=nipype', 'git+https://github.com/rciric/niworkflows.git@' - 'a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows', + '4d4ca491ed94d71100ecf610c280aa17e4ceef0c#egg=niworkflows', ] TESTS_REQUIRES = [ diff --git a/requirements.txt b/requirements.txt index a36cb7642..f83e8cb5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ git+https://github.com/poldracklab/smriprep.git@423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0 -git+https://github.com/rciric/nipype.git@329c74d63a1e1fb963d8e01035e36617acfaaec9#egg=nipype -git+https://github.com/rciric/niworkflows.git@a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows +git+https://github.com/rciric/nipype.git@b80a3d7f1cde35573a73246271bd0dcf42dc7f4b#egg=nipype +git+https://github.com/rciric/niworkflows.git@4d4ca491ed94d71100ecf610c280aa17e4ceef0c#egg=niworkflows templateflow<0.2.0a0,>=0.1.3 From 6af536bf6adc5302ce4e184a7ab0ac21c36a7918 Mon Sep 17 00:00:00 2001 From: oesteban Date: Mon, 29 Apr 2019 15:38:54 -0700 Subject: [PATCH 29/34] pin(niworkflows,nipype): update pinnings before merge --- fmriprep/__about__.py | 8 ++++---- requirements.txt | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index b9bcde59e..3bf1cf3a4 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -104,10 +104,10 @@ LINKS_REQUIRES = [ - 'git+https://github.com/rciric/nipype.git@' - '4c1af8aca7191aff7568ef0a8009144839759f5c#egg=nipype', - 'git+https://github.com/rciric/niworkflows.git@' - 'a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows', + 'git+https://github.com/nipy/nipype.git@' + 'd353f0d879826031334b09d33e9443b8c9b3e7fe#egg=nipype', + 'git+https://github.com/poldracklab/niworkflows.git@' + '8ee3168e508f3e21e67c20b5104897869e728bc3#egg=niworkflows', 'git+https://github.com/poldracklab/smriprep.git@' '423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0', ] diff --git a/requirements.txt b/requirements.txt index 20542bce9..366e8a272 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ nilearn!=0.5.0,!=0.5.1 -git+https://github.com/rciric/nipype.git@4c1af8aca7191aff7568ef0a8009144839759f5c#egg=nipype -git+https://github.com/rciric/niworkflows.git@a7d976dddb0d7e266822cecc16c9ee3a2c3ba1cf#egg=niworkflows +git+https://github.com/nipy/nipype.git@d353f0d879826031334b09d33e9443b8c9b3e7fe#egg=nipype +git+https://github.com/poldracklab/niworkflows.git@8ee3168e508f3e21e67c20b5104897869e728bc3#egg=niworkflows git+https://github.com/poldracklab/smriprep.git@423bcc43ab7300177eb3b98da62817b2cad8eb87#egg=smriprep-0.1.0 templateflow<0.2.0a0,>=0.1.3 From 50c8287013269cd639261f9f1c59628673d92b99 Mon Sep 17 00:00:00 2001 From: oesteban Date: Thu, 2 May 2019 13:46:06 -0700 Subject: [PATCH 30/34] fix(workflow): set correct ``desc`` input to ``DerivativesDataSink`` --- fmriprep/workflows/bold/confounds.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index beb61491d..c028d8576 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -293,7 +293,7 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, metadata_sources=['tCompCor', 'aCompCor']), name='compcor_plot') ds_report_compcor = pe.Node( - DerivativesDataSink(suffix='compcor'), + DerivativesDataSink(desc='compcorvar', keep_dtype=True), name='ds_report_compcor', run_without_submitting=True, mem_gb=DEFAULT_MEMORY_MIN_GB) @@ -302,7 +302,7 @@ def init_bold_confs_wf(mem_gb, metadata, return_all_components=False, ConfoundsCorrelationPlot(reference_column='global_signal', max_dim=70), name='conf_corr_plot') ds_report_conf_corr = pe.Node( - DerivativesDataSink(suffix='confounds_correlation'), + DerivativesDataSink(desc='confoundcorr', keep_dtype=True), name='ds_report_conf_corr', run_without_submitting=True, mem_gb=DEFAULT_MEMORY_MIN_GB) From 463e2371c529996f1ec6f5f69f063d6cad549d6b Mon Sep 17 00:00:00 2001 From: oesteban Date: Thu, 2 May 2019 22:52:10 -0700 Subject: [PATCH 31/34] pin(niworkflows): update to latest poldracklab/niworkflows#357 --- fmriprep/__about__.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fmriprep/__about__.py b/fmriprep/__about__.py index 4cbf71f44..eb1bfb0c3 100644 --- a/fmriprep/__about__.py +++ b/fmriprep/__about__.py @@ -107,7 +107,7 @@ 'git+https://github.com/nipy/nipype.git@' 'd353f0d879826031334b09d33e9443b8c9b3e7fe#egg=nipype', 'git+https://github.com/poldracklab/niworkflows.git@' - '076aed98962b10d107c83110c05e42466a89bbc4#egg=niworkflows', + '06e96631282cb858daebe6967e2499d13664153f#egg=niworkflows', 'git+https://github.com/poldracklab/smriprep.git@' 'f1cfc37bcdc346549dbf1d037cdade3a3b32d5de#egg=smriprep-0.1.0', ] diff --git a/requirements.txt b/requirements.txt index 0be5aa5f0..ff9d3dab9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ nilearn!=0.5.0,!=0.5.1 git+https://github.com/nipy/nipype.git@d353f0d879826031334b09d33e9443b8c9b3e7fe#egg=nipype -git+https://github.com/poldracklab/niworkflows.git@076aed98962b10d107c83110c05e42466a89bbc4#egg=niworkflows +git+https://github.com/poldracklab/niworkflows.git@06e96631282cb858daebe6967e2499d13664153f#egg=niworkflows git+https://github.com/poldracklab/smriprep.git@f1cfc37bcdc346549dbf1d037cdade3a3b32d5de#egg=smriprep-0.1.0 templateflow<0.2.0a0,>=0.1.3 From 4c22d7f6ea09ae5e0c86f6526b69bd0cc9d82a0b Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 3 May 2019 17:15:18 -0700 Subject: [PATCH 32/34] fix(workflow): address @effigies' comment --- fmriprep/workflows/bold/confounds.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fmriprep/workflows/bold/confounds.py b/fmriprep/workflows/bold/confounds.py index aa8b7adb2..bfd61da74 100755 --- a/fmriprep/workflows/bold/confounds.py +++ b/fmriprep/workflows/bold/confounds.py @@ -43,10 +43,10 @@ def init_bold_confs_wf( mem_gb, metadata, + regressors_all_comps, + regressors_dvars_th, + regressors_fd_th, name="bold_confs_wf", - regressors_all_comps=False, - regressors_dvars_th=1.5, - regressors_fd_th=0.5, ): """ This workflow calculates confounds for a BOLD series, and aggregates them From 325c6a9c8b83f14f02904f5c920848dd0a170012 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 3 May 2019 17:31:41 -0700 Subject: [PATCH 33/34] fix(workflow): missing connections forgotten when resolving conflicts --- fmriprep/workflows/bold/outputs.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fmriprep/workflows/bold/outputs.py b/fmriprep/workflows/bold/outputs.py index 546587c0a..19b3d3835 100644 --- a/fmriprep/workflows/bold/outputs.py +++ b/fmriprep/workflows/bold/outputs.py @@ -41,15 +41,12 @@ def init_func_derivatives_wf( from smriprep.workflows.outputs import _bids_relative workflow = Workflow(name=name) - inputnode = pe.Node( - niu.IdentityInterface( - fields=['template', 'source_file', - 'bold_t1', 'bold_t1_ref', 'bold_mask_t1', - 'bold_std', 'bold_std_ref', 'bold_mask_std', - 'bold_aseg_t1', 'bold_aparc_t1', 'bold_aseg_std', - 'bold_aparc_std', 'cifti_variant_key', - 'confounds', 'surfaces', 'aroma_noise_ics', 'melodic_mix', - 'nonaggr_denoised_file', 'bold_cifti', 'cifti_variant']), + inputnode = pe.Node(niu.IdentityInterface(fields=[ + 'aroma_noise_ics', 'bold_aparc_std', 'bold_aparc_t1', 'bold_aseg_std', + 'bold_aseg_t1', 'bold_cifti', 'bold_mask_std', 'bold_mask_t1', 'bold_std', + 'bold_std_ref', 'bold_t1', 'bold_t1_ref', 'cifti_variant', 'cifti_variant_key', + 'confounds', 'confounds_metadata', 'melodic_mix', 'nonaggr_denoised_file', + 'source_file', 'surfaces', 'template']), name='inputnode') raw_sources = pe.Node(niu.Function(function=_bids_relative), name='raw_sources') @@ -62,7 +59,8 @@ def init_func_derivatives_wf( workflow.connect([ (inputnode, raw_sources, [('source_file', 'in_files')]), (inputnode, ds_confounds, [('source_file', 'source_file'), - ('confounds', 'in_file')]), + ('confounds', 'in_file'), + ('confounds_metadata', 'meta_dict')]), ]) # Resample to T1w space From 6a62c86cd16d72d69091ca41fb85f5e9365c137f Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 3 May 2019 17:50:12 -0700 Subject: [PATCH 34/34] fix(docs): add missing comma after function argument --- fmriprep/workflows/base.py | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/fmriprep/workflows/base.py b/fmriprep/workflows/base.py index f1639f192..797043673 100755 --- a/fmriprep/workflows/base.py +++ b/fmriprep/workflows/base.py @@ -218,39 +218,39 @@ def init_fmriprep_wf( reportlets_dir = os.path.join(work_dir, 'reportlets') for subject_id in subject_list: single_subject_wf = init_single_subject_wf( - layout=layout, - subject_id=subject_id, - task_id=task_id, - echo_idx=echo_idx, - name="single_subject_" + subject_id + "_wf", - reportlets_dir=reportlets_dir, - output_dir=output_dir, - ignore=ignore, - debug=debug, - low_mem=low_mem, anat_only=anat_only, - longitudinal=longitudinal, - t2s_coreg=t2s_coreg, - omp_nthreads=omp_nthreads, - skull_strip_template=skull_strip_template, - skull_strip_fixed_seed=skull_strip_fixed_seed, - freesurfer=freesurfer, - output_spaces=output_spaces, - medial_surface_nan=medial_surface_nan, - cifti_output=cifti_output, - hires=hires, - use_bbr=use_bbr, + aroma_melodic_dim=aroma_melodic_dim, bold2t1w_dof=bold2t1w_dof, + cifti_output=cifti_output, + debug=debug, + echo_idx=echo_idx, + err_on_aroma_warn=err_on_aroma_warn, fmap_bspline=fmap_bspline, fmap_demean=fmap_demean, - use_syn=use_syn, force_syn=force_syn, - use_aroma=use_aroma, - aroma_melodic_dim=aroma_melodic_dim, - err_on_aroma_warn=err_on_aroma_warn, + freesurfer=freesurfer, + hires=hires, + ignore=ignore, + layout=layout, + longitudinal=longitudinal, + low_mem=low_mem, + medial_surface_nan=medial_surface_nan, + name="single_subject_" + subject_id + "_wf", + omp_nthreads=omp_nthreads, + output_dir=output_dir, + output_spaces=output_spaces, regressors_all_comps=regressors_all_comps, - regressors_fd_th=regressors_fd_th, regressors_dvars_th=regressors_dvars_th, + regressors_fd_th=regressors_fd_th, + reportlets_dir=reportlets_dir, + skull_strip_fixed_seed=skull_strip_fixed_seed, + skull_strip_template=skull_strip_template, + subject_id=subject_id, + t2s_coreg=t2s_coreg, + task_id=task_id, + use_aroma=use_aroma, + use_bbr=use_bbr, + use_syn=use_syn, ) single_subject_wf.config['execution']['crashdump_dir'] = ( @@ -345,7 +345,7 @@ def init_single_subject_wf( ('T1w', {}), ('fsnative', {})]), reportlets_dir='.', regressors_all_comps=False, - regressors_dvars_th=1.5 + regressors_dvars_th=1.5, regressors_fd_th=0.5, skull_strip_fixed_seed=False, skull_strip_template='OASIS30ANTs',