├── .circleci ├── artifact_path ├── config.yml ├── ds005_fasttrack_outputs.txt ├── ds005_outputs.txt ├── ds005_partial_fasttrack_outputs.txt ├── ds005_partial_outputs.txt ├── ds054_fasttrack_outputs.txt ├── ds054_outputs.txt ├── ds210_fasttrack_outputs.txt ├── ds210_outputs.txt └── legacy.yml ├── .codespellrc ├── .dockerignore ├── .git-blame-ignore-revs ├── .git_archival.txt ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── documentation.md │ └── feature_request.yml ├── config.yml ├── dependabot.yml ├── stale.yml └── workflows │ ├── docker.yml │ └── test.yml ├── .gitignore ├── .gitmodules ├── .mailmap ├── .maint ├── CONTRIBUTORS.md ├── FORMER.md ├── MAINTAINERS.md ├── PIs.md ├── developers.json ├── former.json ├── paper_author_list.py ├── requirements.txt ├── update_authors.py ├── update_changes.sh ├── update_ignore_revs.sh └── update_zenodo.py ├── .pre-commit-config.yaml ├── .readthedocs.yml ├── .versions.json ├── .vscode ├── launch.json └── settings.json ├── .zenodo.json ├── CHANGES.rst ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile_devel ├── GOVERNANCE.md ├── LICENSE ├── Makefile ├── NOTICE ├── README.rst ├── REFERENCES.md ├── docker └── files │ └── freesurfer7.3.2-exclude.txt ├── docs ├── .gitignore ├── Makefile ├── _static │ ├── EPIT1Normalization.svg │ ├── OHBM2017-poster.png │ ├── OHBM2017-poster_thumb.png │ ├── OHBM2018-poster.png │ ├── OHBM2018-poster_thumb.png │ ├── SampleReport │ │ ├── figures │ │ │ ├── sub-10_desc-reconall_T1w.svg │ │ │ ├── sub-10_dseg.svg │ │ │ ├── sub-10_space-MNI152NLin2009cAsym_T1w.svg │ │ │ ├── sub-10_task-mixedgamblestask_run-1_desc-bbregister_bold.svg │ │ │ ├── sub-10_task-mixedgamblestask_run-1_desc-carpetplot_bold.svg │ │ │ ├── sub-10_task-mixedgamblestask_run-1_desc-compcorvar_bold.svg │ │ │ ├── sub-10_task-mixedgamblestask_run-1_desc-confoundcorr_bold.svg │ │ │ └── sub-10_task-mixedgamblestask_run-1_desc-rois_bold.svg │ │ └── sample_report.html │ ├── T1MNINormalization.svg │ ├── aroma.svg │ ├── fmriprep-21.0.0.svg │ ├── fmriprep-workflow-all.png │ ├── fmriprep_benchmark.svg │ ├── reconall.svg │ ├── sbatch.slurm │ ├── segmentation.svg │ ├── sub-01_dseg.svg │ ├── sub-01_task-balloonanalogrisktask_run-1_desc-rois_bold.svg │ ├── sub-01_task-mixedgamblestask_run-01_confounds_correlation.svg │ ├── sub-01_task-rest_compcor.svg │ ├── sub-405_ses-01_task-rest_run-01_desc-carpetplot_bold.svg │ ├── theme_overrides.css │ └── unwarping.svg ├── api.rst ├── benchmarks.rst ├── changes.rst ├── conf.py ├── faq.rst ├── index.rst ├── installation.rst ├── license.rst ├── links.rst ├── outputs.rst ├── pull_request_template.md ├── requirements.txt ├── spaces.rst ├── sphinxext │ └── github_link.py ├── usage.rst └── workflows.rst ├── env.yml ├── fmriprep ├── __init__.py ├── __main__.py ├── _warnings.py ├── cli │ ├── __init__.py │ ├── parser.py │ ├── run.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_parser.py │ │ └── test_version.py │ ├── version.py │ └── workflow.py ├── config.py ├── conftest.py ├── data │ ├── NOTICE │ ├── __init__.py │ ├── boilerplate.bib │ ├── flirtsch │ │ └── bbr.sch │ ├── fmap_spec.json │ ├── io_spec.json │ ├── reports-spec-anat.yml │ ├── reports-spec-func.yml │ ├── reports-spec.yml │ └── tests │ │ ├── config.toml │ │ ├── crash_files │ │ └── crash-20170905-182839-root-dvars-b78e9ea8-e295-48a1-af71-2d36afd9cebf.txt │ │ ├── ds000005 │ │ ├── CHANGES │ │ ├── README │ │ ├── dataset_description.json │ │ ├── participants.tsv │ │ ├── sub-01 │ │ │ ├── anat │ │ │ │ ├── sub-01_T1w.nii.gz │ │ │ │ └── sub-01_inplaneT2.nii.gz │ │ │ └── func │ │ │ │ ├── sub-01_task-mixedgamblestask_run-01_bold.nii.gz │ │ │ │ ├── sub-01_task-mixedgamblestask_run-01_events.tsv │ │ │ │ ├── sub-01_task-mixedgamblestask_run-02_bold.nii.gz │ │ │ │ ├── sub-01_task-mixedgamblestask_run-02_events.tsv │ │ │ │ ├── sub-01_task-mixedgamblestask_run-03_bold.nii.gz │ │ │ │ └── sub-01_task-mixedgamblestask_run-03_events.tsv │ │ └── task-mixedgamblestask_bold.json │ │ ├── logs │ │ └── CITATION.html │ │ └── work │ │ └── reportlets │ │ └── fmriprep │ │ ├── sub-001 │ │ └── figures │ │ │ ├── sub-001_acq-undistorted_desc-conform_T1w.html │ │ │ ├── sub-001_acq-undistorted_desc-reconall_T1w.svg │ │ │ ├── sub-001_acq-undistorted_dseg.svg │ │ │ ├── sub-001_acq-undistorted_space-MNI152NLin2009cAsym_T1w.svg │ │ │ ├── sub-001_desc-about_T1w.html │ │ │ ├── sub-001_desc-conform_T1w.html │ │ │ ├── sub-001_desc-preproc_dseg.svg │ │ │ ├── sub-001_desc-reconall_T1w.svg │ │ │ ├── sub-001_desc-summary_T1w.html │ │ │ ├── sub-001_dseg.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-bbregister_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-carpetplot_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-compcorvar_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-confoundcorr_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-rois_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-summary_bold.html │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-t2scomp_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-t2starhist_bold.svg │ │ │ ├── sub-001_ses-001_task-qct_dir-LR_part-mag_desc-validation_bold.html │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-bbregister_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-carpetplot_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-compcorvar_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-confoundcorr_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-rois_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-summary_bold.html │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-t2scomp_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-t2starhist_bold.svg │ │ │ ├── sub-001_ses-003_task-qct_dir-LR_part-mag_desc-validation_bold.html │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-bbregister_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-carpetplot_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-compcorvar_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-confoundcorr_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-rois_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-summary_bold.html │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-t2scomp_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-t2starhist_bold.svg │ │ │ ├── sub-001_ses-004_task-qct_dir-RL_part-mag_desc-validation_bold.html │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-bbregister_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-carpetplot_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-compcorvar_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-confoundcorr_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-rois_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-summary_bold.html │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-t2scomp_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-t2starhist_bold.svg │ │ │ ├── sub-001_ses-005_task-qct_dir-PA_part-mag_desc-validation_bold.html │ │ │ ├── sub-001_space-MNI152NLin2009cAsym_T1w.svg │ │ │ └── sub-001_space-MNI152NLin2009cAsym_desc-preproc_T1w.svg │ │ └── sub-01 │ │ ├── anat │ │ ├── sub-01_T1w_conform.html │ │ ├── sub-01_T1w_reconall.html │ │ ├── sub-01_T1w_summary.html │ │ ├── sub-01_T1w_t1_2_mni.svg │ │ ├── sub-01_T1w_t1_seg.html │ │ └── sub-01_T1w_t1_skull_strip.html │ │ └── func │ │ ├── sub-01_task-mixedgamblestask_run-01_bold_acompcor.html │ │ ├── sub-01_task-mixedgamblestask_run-01_bold_bbr.svg │ │ ├── sub-01_task-mixedgamblestask_run-01_bold_bold_mask.html │ │ ├── sub-01_task-mixedgamblestask_run-01_bold_ica_aroma.svg │ │ ├── sub-01_task-mixedgamblestask_run-01_bold_tcompcor.html │ │ ├── sub-01_task-mixedgamblestask_run-01_bold_validation.html │ │ ├── sub-01_task-mixedgamblestask_run-02_bold_acompcor.html │ │ ├── sub-01_task-mixedgamblestask_run-02_bold_bbr.svg │ │ ├── sub-01_task-mixedgamblestask_run-02_bold_bold_mask.html │ │ ├── sub-01_task-mixedgamblestask_run-02_bold_ica_aroma.svg │ │ ├── sub-01_task-mixedgamblestask_run-02_bold_tcompcor.html │ │ └── sub-01_task-mixedgamblestask_run-02_bold_validation.html ├── interfaces │ ├── __init__.py │ ├── bids.py │ ├── confounds.py │ ├── conftest.py │ ├── gifti.py │ ├── maths.py │ ├── multiecho.py │ ├── nitransforms.py │ ├── patches.py │ ├── reports.py │ ├── resampling.py │ ├── tests │ │ ├── __init__.py │ │ ├── data │ │ │ ├── __init__.py │ │ │ ├── acompcor_renamed.tsv │ │ │ ├── acompcor_truncated.tsv │ │ │ ├── bold.nii.gz │ │ │ ├── component_metadata_filtered.tsv │ │ │ ├── component_metadata_renamed.tsv │ │ │ ├── component_metadata_truncated.tsv │ │ │ ├── lh.bold.func.gii │ │ │ ├── lh.midthickness.surf.gii │ │ │ ├── lh.pial.surf.gii │ │ │ ├── lh.roi.shape.gii │ │ │ ├── lh.white.surf.gii │ │ │ ├── mri_coreg-c3d-invert.txt │ │ │ ├── mri_coreg-c3d.txt │ │ │ ├── mri_coreg-lta_convert-invert.txt │ │ │ ├── mri_coreg-lta_convert.mat │ │ │ ├── mri_coreg-lta_convert.txt │ │ │ ├── mri_coreg.lta │ │ │ ├── sub-01_run-01_echo-1_bold.nii.gz │ │ │ ├── sub-01_run-01_echo-2_bold.nii.gz │ │ │ ├── sub-01_run-01_echo-3_bold.nii.gz │ │ │ ├── sub-01_task-mixedgamblestask_run-01_desc-hmc_boldref.nii.gz │ │ │ ├── sub-01_task-mixedgamblestask_run-01_desc-motion_timeseries.tsv │ │ │ ├── sub-01_task-mixedgamblestask_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt │ │ │ ├── sub-pixar008_desc-preproc_T1w.nii.gz │ │ │ └── sub-pixar008_task-pixar_desc-coreg_boldref.nii.gz │ │ ├── test_bids.py │ │ ├── test_confounds.py │ │ ├── test_maths.py │ │ ├── test_nitransforms.py │ │ └── test_reports.py │ └── workbench.py ├── reports │ ├── __init__.py │ ├── core.py │ └── tests │ │ ├── __init__.py │ │ └── test_reports.py ├── tests │ ├── __init__.py │ ├── test_config.py │ └── test_fsl6.py ├── utils │ ├── __init__.py │ ├── asynctools.py │ ├── bids.py │ ├── confounds.py │ ├── debug.py │ ├── meepi.py │ ├── misc.py │ ├── telemetry.py │ ├── tests │ │ └── test_derivative_cache.py │ └── transforms.py └── workflows │ ├── __init__.py │ ├── base.py │ ├── bold │ ├── __init__.py │ ├── apply.py │ ├── base.py │ ├── confounds.py │ ├── fit.py │ ├── hmc.py │ ├── outputs.py │ ├── reference.py │ ├── registration.py │ ├── resampling.py │ ├── stc.py │ ├── t2s.py │ └── tests │ │ ├── __init__.py │ │ ├── test_base.py │ │ └── test_fit.py │ └── tests │ ├── __init__.py │ └── test_base.py ├── long_description.rst ├── pyproject.toml ├── requirements.txt ├── scripts ├── fetch_templates.py └── generate_reference_mask.py ├── tox.ini └── wrapper ├── LICENSE ├── README.rst ├── pyproject.toml └── src └── fmriprep_docker ├── __init__.py └── __main__.py /.circleci/artifact_path: -------------------------------------------------------------------------------- 1 | /0/tmp/src/fmriprep/docs/_build/html/index.html 2 | -------------------------------------------------------------------------------- /.circleci/ds210_fasttrack_outputs.txt: -------------------------------------------------------------------------------- 1 | 2 | .bidsignore 3 | dataset_description.json 4 | logs 5 | logs/CITATION.bib 6 | logs/CITATION.html 7 | logs/CITATION.md 8 | logs/CITATION.tex 9 | sub-02 10 | sub-02/anat 11 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.json 12 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz 13 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_dseg.nii.gz 14 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.json 15 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz 16 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_desc-preproc_probseg.nii.gz 17 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_desc-preproc_probseg.nii.gz 18 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_desc-preproc_probseg.nii.gz 19 | sub-02/fmap 20 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff_fieldmap.nii.gz 21 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz 22 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-preproc_fieldmap.json 23 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz 24 | sub-02/func 25 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-brain_mask.json 26 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-brain_mask.nii.gz 27 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_timeseries.json 28 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_timeseries.tsv 29 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-coreg_boldref.json 30 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-coreg_boldref.nii.gz 31 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-hmc_boldref.json 32 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-hmc_boldref.nii.gz 33 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-1_desc-preproc_bold.json 34 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-1_desc-preproc_bold.nii.gz 35 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.json 36 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.nii.gz 37 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.json 38 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.nii.gz 39 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.json 40 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.txt 41 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json 42 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt 43 | sub-02/func/sub-02_task-cuedSGT_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json 44 | sub-02/func/sub-02_task-cuedSGT_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt 45 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.json 46 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz 47 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.json 48 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz 49 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.json 50 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz 51 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_T2starmap.json 52 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_T2starmap.nii.gz 53 | sub-02.html 54 | -------------------------------------------------------------------------------- /.circleci/ds210_outputs.txt: -------------------------------------------------------------------------------- 1 | 2 | .bidsignore 3 | dataset_description.json 4 | logs 5 | logs/CITATION.bib 6 | logs/CITATION.html 7 | logs/CITATION.md 8 | logs/CITATION.tex 9 | sub-02 10 | sub-02/anat 11 | sub-02/anat/sub-02_desc-brain_mask.json 12 | sub-02/anat/sub-02_desc-brain_mask.nii.gz 13 | sub-02/anat/sub-02_desc-preproc_T1w.json 14 | sub-02/anat/sub-02_desc-preproc_T1w.nii.gz 15 | sub-02/anat/sub-02_dseg.nii.gz 16 | sub-02/anat/sub-02_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5 17 | sub-02/anat/sub-02_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 18 | sub-02/anat/sub-02_label-CSF_probseg.nii.gz 19 | sub-02/anat/sub-02_label-GM_probseg.nii.gz 20 | sub-02/anat/sub-02_label-WM_probseg.nii.gz 21 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.json 22 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz 23 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.json 24 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz 25 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_dseg.nii.gz 26 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz 27 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz 28 | sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz 29 | sub-02/fmap 30 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff_fieldmap.nii.gz 31 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz 32 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-preproc_fieldmap.json 33 | sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-preproc_fieldmap.nii.gz 34 | sub-02/func 35 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-brain_mask.json 36 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-brain_mask.nii.gz 37 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_timeseries.json 38 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-confounds_timeseries.tsv 39 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-coreg_boldref.json 40 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-coreg_boldref.nii.gz 41 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-hmc_boldref.json 42 | sub-02/func/sub-02_task-cuedSGT_run-01_desc-hmc_boldref.nii.gz 43 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-1_desc-preproc_bold.json 44 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-1_desc-preproc_bold.nii.gz 45 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.json 46 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.nii.gz 47 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.json 48 | sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.nii.gz 49 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.json 50 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.txt 51 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json 52 | sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt 53 | sub-02/func/sub-02_task-cuedSGT_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json 54 | sub-02/func/sub-02_task-cuedSGT_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt 55 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.json 56 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_boldref.nii.gz 57 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.json 58 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz 59 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.json 60 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz 61 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_T2starmap.json 62 | sub-02/func/sub-02_task-cuedSGT_run-01_space-MNI152NLin2009cAsym_T2starmap.nii.gz 63 | sub-02.html 64 | -------------------------------------------------------------------------------- /.circleci/legacy.yml: -------------------------------------------------------------------------------- 1 | plugin: LegacyMultiProc 2 | plugin_args: 3 | maxtasksperchild: 1 4 | raise_insufficient: false 5 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | skip = .git,*.pdf,*.svg,*.html,dataset_description.json,*.bib 3 | # te - TE 4 | # Weill - name 5 | # reson - Reson. abbreviation in citation 6 | ignore-words-list = te,weill,reson 7 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # python cache 2 | __pycache__/**/* 3 | __pycache__ 4 | *.pyc 5 | 6 | # python distribution 7 | build/**/* 8 | build 9 | dist/**/* 10 | dist 11 | fmriprep.egg-info/**/* 12 | fmriprep.egg-info 13 | .eggs/**/* 14 | .eggs 15 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # 2024-02-05 - effigies@gmail.com - STY: ruff --fix + 1 ignore [git-blame-ignore-rev] 2 | e7dc59fbc7df88dfabbff154f4cc3d24721b6b4f 3 | # 2024-01-16 - effigies@gmail.com - STY: ruff --fix --unsafe-fixes (with cleanup) [git-blame-ignore-rev] 4 | 66734bd0164d1dae3cf299fa9d9d682c22eeda66 5 | # 2024-01-16 - effigies@gmail.com - STY: ruff format and ruff --fix [git-blame-ignore-rev] 6 | 311686eb329d3594732429f7c3d50d212b8dc519 7 | # 2023-02-02 - effigies@gmail.com - STY: black [git-blame-ignore-rev] 8 | d3f380701b3953087475a18cf23c0fb388f7aed6 9 | # 2022-09-22 - mathiasg@stanford.edu - STY: black/isort the docker wrapper 10 | 9976458388f369cba4b7d81359acc40b52f6621c 11 | # 2022-09-22 - mathiasg@stanford.edu - STY: Apply black/isort to codebase 12 | 7eedab8b29497cee1d8dd540c2266e740f484a86 13 | # 2021-11-05 - markiewicz@stanford.edu - STY: Update black config 14 | d2ad20301306f283d504ec7b5a1bd73ce58c2b11 15 | # 2021-09-22 - code@oscaresteban.es - sty: run black 16 | 9e30c22ce8feecbe223fac074a9eefe60ce67785 17 | # 2021-09-22 - code@oscaresteban.es - STY: Run black on workflows.bold.base to clarify diff in #2547 18 | a5ce14b0f77782f939f35175a25e195305550da3 19 | # 2020-08-18 - markiewicz@stanford.edu - STY: black 20 | 4c2e1024fbeabd5bc2029c5740f6354e54584740 21 | # 2020-05-08 - code@oscaresteban.es - sty: run ``black`` on ``fmriprep.cli`` module 22 | 7a25b642efeb5fe61f83aabf5469169c1d75770c 23 | # 2017-10-26 - code@oscaresteban.es - [skip ci] STY: minor changes 24 | 1a2f9819001509f1eb59e5a56772aa2d5899aba4 25 | -------------------------------------------------------------------------------- /.git_archival.txt: -------------------------------------------------------------------------------- 1 | node: dfd7d296f115468491b1fab1dba5e5553e7c2d67 2 | node-date: 2025-05-21T15:23:56-04:00 3 | describe-name: 25.1.0-1-gdfd7d296f 4 | ref-names: HEAD -> master 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | .git_archival.txt export-subst 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a report of a problem you encountered. 3 | labels: ["bug"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | # Thanks for taking the time to fill out this bug report! 9 | ### The following information will help us in getting your issue resolved. 10 | - type: textarea 11 | id: what-happened 12 | attributes: 13 | label: What happened? 14 | description: A short description of what went wrong. 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: command 19 | attributes: 20 | label: What command did you use? 21 | description: | 22 | If you're using `fmriprep-docker`, please include the `RUNNING: ...` line that is printed first. 23 | This helps us replicate the problem. This will be automatically formatted into code, so no need for backticks. 24 | render: shell 25 | validations: 26 | required: true 27 | - type: input 28 | id: version 29 | attributes: 30 | label: What version of fMRIPrep are you running? 31 | validations: 32 | required: true 33 | - type: dropdown 34 | id: environment 35 | attributes: 36 | label: How are you running fMRIPrep? 37 | options: 38 | - Docker 39 | - Singularity 40 | - Local installation ("bare-metal") 41 | - Other 42 | validations: 43 | required: true 44 | - type: dropdown 45 | id: bids-valid 46 | attributes: 47 | label: Is your data BIDS valid? 48 | description: | 49 | The BIDS validator can be found at: https://bids-standard.github.io/bids-validator/ 50 | Errors should not be present, but warnings are acceptable. 51 | options: 52 | - "Yes" 53 | - "No" 54 | validations: 55 | required: true 56 | - type: dropdown 57 | id: reuse 58 | attributes: 59 | label: Are you reusing any previously computed results? 60 | description: | 61 | You can select multiple options. 62 | We recommend using a fresh working directory when upgrading to a new fMRIPrep minor series. 63 | multiple: true 64 | options: 65 | - FreeSurfer 66 | - Anatomical derivatives 67 | - Work directory 68 | - "No" 69 | validations: 70 | required: true 71 | - type: textarea 72 | id: logs 73 | attributes: 74 | label: Please copy and paste any relevant log output. 75 | description: | 76 | Can you find some traces of the error reported in the visual report (at the bottom) or in *crashfiles*? 77 | This will be automatically formatted into code, so no need for backticks. 78 | render: shell 79 | - type: textarea 80 | id: addinfo 81 | attributes: 82 | label: Additional information / screenshots 83 | description: | 84 | If you would like to include any further information, such as any visual reports, please include them below. 85 | Alternatively, you can privately share with us at . 86 | Reports do not contain data usable with personal identification or other research purposes. 87 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Questions 4 | url: https://neurostars.org/tag/fmriprep 5 | about: For general questions, please search Neurostars for existing posts before starting a new one. 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation improvement 3 | about: Is the documentation of something missing, unclear, or lacking? This is the place. 4 | title: '' 5 | labels: 'documentation' 6 | assignees: '' 7 | 8 | --- 9 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Suggest an idea for a new feature or a change to an existing one. 3 | labels: ["enhancement"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | ## Thank you for your suggestion! 9 | 10 | We welcome any ideas about how to make *fMRIPrep* better for the community. 11 | Please keep in mind that features may not get implemented immediately. 12 | - type: textarea 13 | id: summary 14 | attributes: 15 | label: What would you like to see added in fMRIPrep? 16 | description: | 17 | What are you trying to achieve with fMRIPrep? 18 | Is this a more convenient way to do something that is already possible, or is a workaround currently unfeasible? 19 | Does this feature adhere to the [NiPreps driving principles](https://www.nipreps.org/community/CONTRIBUTING/#driving-principles)? 20 | validations: 21 | required: true 22 | - type: dropdown 23 | id: interest 24 | attributes: 25 | label: Do you have any interest in helping implement the feature? 26 | description: | 27 | We appreciate any help you can offer! 28 | For information on how to contribute, please refer to our [contributing guidelines](https://www.nipreps.org/community/CONTRIBUTING/). 29 | options: 30 | - "Yes" 31 | - Yes, but I would need guidance 32 | - "No" 33 | validations: 34 | required: true 35 | - type: textarea 36 | id: addinfo 37 | attributes: 38 | label: Additional information / screenshots 39 | description: Add any additional information or context about the feature request here. 40 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | # Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome 2 | 3 | # Comment to be posted to on PRs from first time contributors in your repository 4 | newPRWelcomeComment: > 5 | Thanks for opening this pull request! 6 | It looks like this is your first time contributing to *fMRIPrep*. :smile: 7 | 8 | We invite you to list yourself as an *fMRIPrep* contributor. 9 | To learn more about what that entails and how we credit our contributors, 10 | please check out the 11 | [contributing guidelines](https://github.com/nipreps/fmriprep/blob/master/CONTRIBUTING.md#recognizing-contributions). 12 | If your name is not already on the list, please insert it, in alphabetical order, into the 13 | [``CONTRIBUTORS.md`` file](https://github.com/nipreps/fmriprep/blob/master/.maint/CONTRIBUTORS.md). 14 | 15 | Of course, if you want to opt-out this time there is no 16 | problem at all with adding your name later. 17 | You will be always welcome to add it in the future whenever 18 | you feel it should be listed. 19 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | 3 | version: 2 4 | updates: 5 | 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | # Check for updates to GitHub Actions every week 10 | interval: "weekly" 11 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 900 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 200 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | - feature 10 | - help wanted 11 | - low priority 12 | # Label to use when marking an issue as stale 13 | staleLabel: stale 14 | # Comment to post when marking an issue as stale. Set to `false` to disable 15 | markComment: > 16 | This issue has been automatically marked as stale because it has not had 17 | recent activity. It will be closed if no further activity occurs. Thank you 18 | for your contributions. 19 | # Comment to post when closing a stale issue. Set to `false` to disable 20 | closeComment: false 21 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker build 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [ "master", "main", "maint/*", "gha-docker-build" ] 7 | tags: "*" 8 | pull_request: 9 | branches: [ "master", "main", "maint/*" ] 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | env: 16 | REGISTRY: ghcr.io 17 | IMAGE_NAME: ${{ github.repository }} 18 | FORCE_COLOR: true 19 | 20 | jobs: 21 | build-container: 22 | runs-on: ubuntu-latest 23 | permissions: 24 | contents: read 25 | packages: write 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v4 29 | with: 30 | fetch-depth: 200 31 | fetch-tags: true 32 | 33 | - name: Setup Docker buildx 34 | uses: docker/setup-buildx-action@v3 35 | 36 | - name: Log into registry ${{ env.REGISTRY }} 37 | if: github.event_name != 'pull_request' 38 | uses: docker/login-action@v3 39 | with: 40 | registry: ${{ env.REGISTRY }} 41 | username: ${{ github.actor }} 42 | password: ${{ secrets.GITHUB_TOKEN }} 43 | 44 | - name: Extract Docker metadata 45 | id: meta 46 | uses: docker/metadata-action@v5 47 | with: 48 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 49 | 50 | - name: Build and push Docker image 51 | uses: docker/build-push-action@v6 52 | with: 53 | context: . 54 | push: ${{ github.event_name != 'pull_request' }} 55 | tags: ${{ steps.meta.outputs.tags }} 56 | labels: ${{ steps.meta.outputs.labels }} 57 | platforms: linux/amd64 58 | cache-from: | 59 | type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:master 60 | type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TARGET_BRANCH }} 61 | type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags[0] }} 62 | cache-to: type=inline 63 | env: 64 | TARGET_BRANCH: ${{ github.base_ref || github.ref_name }} 65 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Stable tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - maint/* 8 | - next 9 | pull_request: 10 | branches: 11 | - master 12 | - maint/* 13 | - next 14 | 15 | defaults: 16 | run: 17 | shell: bash 18 | 19 | # Force tox and pytest to use color 20 | env: 21 | FORCE_COLOR: true 22 | 23 | concurrency: 24 | group: ${{ github.workflow }}-${{ github.ref }} 25 | cancel-in-progress: true 26 | 27 | permissions: 28 | contents: read 29 | 30 | jobs: 31 | test: 32 | # Check each OS, all supported Python, minimum versions and latest releases 33 | runs-on: ${{ matrix.os }} 34 | strategy: 35 | matrix: 36 | os: ['ubuntu-latest'] 37 | python-version: ['3.10', '3.11', '3.12', '3.13'] 38 | dependencies: ['latest', 'pre'] 39 | include: 40 | - os: ubuntu-latest 41 | python-version: '3.10' 42 | dependencies: 'min' 43 | 44 | env: 45 | DEPENDS: ${{ matrix.dependencies }} 46 | 47 | steps: 48 | - uses: actions/checkout@v4 49 | with: 50 | submodules: recursive 51 | fetch-depth: 0 52 | - uses: actions/cache@v4 53 | with: 54 | path: ~/.cache/templateflow 55 | key: templateflow-v1 56 | - name: Install dependencies 57 | run: | 58 | sudo apt update 59 | sudo apt install -y --no-install-recommends graphviz 60 | - name: Install the latest version of uv 61 | uses: astral-sh/setup-uv@v6 62 | - name: Set up Python ${{ matrix.python-version }} 63 | uses: actions/setup-python@v5 64 | with: 65 | python-version: ${{ matrix.python-version }} 66 | - name: Display Python version 67 | run: python -c "import sys; print(sys.version)" 68 | - name: Install tox 69 | run: | 70 | uv tool install --with=tox-uv --with=tox-gh-actions tox 71 | - name: Show tox config 72 | run: tox c 73 | - name: Run tox 74 | run: tox -v --exit-and-dump-after 1200 75 | - uses: codecov/codecov-action@v5 76 | with: 77 | token: ${{ secrets.CODECOV_TOKEN }} 78 | if: ${{ always() }} 79 | 80 | checks: 81 | runs-on: "ubuntu-latest" 82 | continue-on-error: true 83 | strategy: 84 | matrix: 85 | check: ["style", "spellcheck"] 86 | 87 | steps: 88 | - uses: actions/checkout@v4 89 | with: 90 | persist-credentials: false 91 | - name: Install the latest version of uv 92 | uses: astral-sh/setup-uv@v6 93 | - name: Install tox 94 | run: uv tool install tox --with=tox-uv 95 | - name: Show tox config 96 | run: tox c -e ${{ matrix.check }} 97 | - name: Run check 98 | run: tox -e ${{ matrix.check }} 99 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | .pytest_cache/ 6 | 7 | # C extensions 8 | *.so 9 | *.c 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | # build/ # commented due to some strangeness with Docker/circle setup 15 | develop-eggs/ 16 | dist/ 17 | build/lib* 18 | build/temp* 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | pip-wheel-metadata/ 31 | 32 | # PyInstaller 33 | # Usually these files are written by a python script from a template 34 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 35 | *.manifest 36 | *.spec 37 | 38 | # Installer logs 39 | pip-log.txt 40 | pip-delete-this-directory.txt 41 | 42 | # Unit test / coverage reports 43 | htmlcov/ 44 | .tox/ 45 | .coverage 46 | .coverage.* 47 | .cache 48 | nosetests.xml 49 | coverage.xml 50 | *,cover 51 | .hypothesis/ 52 | 53 | # Translations 54 | *.mo 55 | *.pot 56 | 57 | # Django stuff: 58 | *.log 59 | 60 | # Sphinx documentation 61 | docs/_build/ 62 | build/ 63 | 64 | # PyBuilder 65 | target/ 66 | 67 | #Ipython Notebook 68 | .ipynb_checkpoints 69 | 70 | # pycharm project settings 71 | .idea 72 | 73 | # Spyder project settings 74 | .spyderproject 75 | .spyproject 76 | 77 | auth/ 78 | secrets.py 79 | local_settings.py 80 | 81 | *.swp 82 | 83 | _version.py 84 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "notebooks"] 2 | path = notebooks 3 | url = https://github.com/nipreps/fmriprep-notebooks.git 4 | -------------------------------------------------------------------------------- /.maint/FORMER.md: -------------------------------------------------------------------------------- 1 | # FORMER MEMBERS 2 | 3 | This document lists former contributors or maintainers who want to disengage from the Project, and seek to be dismissed in communications or future papers. 4 | By adding your name to this list you are giving up on all your responsibilities to the project. 5 | Should you desire to be considered back as a contributor or maintainer, please remove your name from this list and proceed as prescribed in the governance documents. 6 | 7 | | **Lastname** | **Name** | **Handle** | 8 | | --- | --- | --- | 9 | | Berleant | Shoshana | @shoshber | 10 | -------------------------------------------------------------------------------- /.maint/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Maintainers 2 | 3 | This document lists the Maintainers of the project. 4 | Maintainers may be added once approved by the existing maintainers as described in the `../GOVERNANCE.md` document. 5 | By adding your name to this list you are agreeing to abide by the governance documents and to abide by all of the Organization's polices, including the code of conduct, trademark policy, and antitrust policy. 6 | If you are participating because of your affiliation with another organization (designated below), you represent that you have the authority to bind that organization to these policies. 7 | 8 | 9 | 10 | | **Lastname** | **Name** | **Handle** | **ORCID** | **Affiliation** | **Role** | 11 | | --- | --- | --- | --- | --- | --- | 12 | | Markiewicz | Christopher J. | @effigies | 0000-0002-6533-164X | Department of Psychology, Stanford University, CA, USA | | 13 | | Goncalves | Mathias | @mgxd | 0000-0002-7252-7771 | Department of Psychology, Stanford University, CA, USA | | 14 | | Esteban | Oscar | @oesteban | 0000-0001-8435-6191 | Lausanne University Hospital and University of Lausanne, Lausanne, Switzerland | | 15 | | Pinsard | Basile | @bpinsard | 0000-0002-4391-3075 | Université de Montréal, Montreal, QC, CA | 20.2.x LTS maintainer | 16 | -------------------------------------------------------------------------------- /.maint/PIs.md: -------------------------------------------------------------------------------- 1 | # PRINCIPAL INVESTIGATORS 2 | 3 | This documents the key personnel who oversees the development of the Project and secures funding. 4 | The names in this file are designated by the Organization's TSC at the time of accepting the Project under the Organization. 5 | Changes to this file must be approved by the TSC. 6 | When a PI ceases serving as such, by default, their name will be placed in the `CONTRIBUTORS.md` file should it not be there already. 7 | 8 | By having your name in this list you are agreeing to abide by the governance documents and to abide by all of the Organization's polices, including the code of conduct, trademark policy, and antitrust policy. 9 | If you are participating because of your affiliation with another organization (designated below), you represent that you have the authority to bind that organization to these policies. 10 | 11 | | **Lastname** | **Name** | **Handle** | **ORCID** | **Affiliation** | **Position** | 12 | | --- | --- | --- | --- | --- | --- | 13 | | Esteban | Oscar | @oesteban | 0000-0001-8435-6191 | Department of Radiology, Lausanne University Hospital and University of Lausanne | | 14 | | Milham | Michael P. | | 0000-0003-3532-1210 | Child Mind Institute | | 15 | | Poldrack | Russell A. | @poldrack | 0000-0001-6755-0259 | Department of Psychology, Stanford University, CA, USA | -1 | 16 | | Rokem | Ariel | @arokem | 0000-0003-0679-1985 | The University of Washington eScience Institute, WA, USA | | 17 | | Satterthwaite | Theodore D. | | 0000-0001-7072-9399 | Perelman School of Medicine, University of Pennsylvania, PA, USA | | 18 | -------------------------------------------------------------------------------- /.maint/developers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "affiliation": "Department of Psychology, Stanford University", 4 | "name": "Blair, Ross W.", 5 | "orcid": "0000-0003-3007-1056" 6 | }, 7 | { 8 | "affiliation": "Department of Psychology, Stanford University", 9 | "name": "Ciric, Rastko", 10 | "orcid": "0000-0001-6347-7939" 11 | }, 12 | { 13 | "affiliation": "Montreal Neurological Institute, McGill University", 14 | "name": "DuPre, Elizabeth", 15 | "orcid": "0000-0003-1358-196X" 16 | }, 17 | { 18 | "affiliation": "Lausanne University Hospital and University of Lausanne, Lausanne, Switzerland", 19 | "name": "Esteban, Oscar", 20 | "orcid": "0000-0001-8435-6191" 21 | }, 22 | { 23 | "affiliation": "Department of Psychology, Stanford University", 24 | "name": "Goncalves, Mathias", 25 | "orcid": "0000-0002-7252-7771" 26 | }, 27 | { 28 | "affiliation": "Department of Psychology, Stanford University", 29 | "name": "Gorgolewski, Krzysztof J.", 30 | "orcid": "0000-0003-3321-7583" 31 | }, 32 | { 33 | "affiliation": "Neuroscience Program, University of Iowa", 34 | "name": "Kent, James D.", 35 | "orcid": "0000-0002-4892-2659" 36 | }, 37 | { 38 | "affiliation": "Department of Psychology, Stanford University", 39 | "name": "Markiewicz, Christopher J.", 40 | "orcid": "0000-0002-6533-164X" 41 | }, 42 | { 43 | "affiliation": "SIMEXP Lab, CRIUGM, University of Montréal, Montréal, Canada", 44 | "name": "Pinsard, Basile", 45 | "orcid": "0000-0002-4391-3075" 46 | }, 47 | { 48 | "affiliation": "Department of Psychology, Stanford University", 49 | "name": "Poldrack, Russell A.", 50 | "orcid": "0000-0001-6755-0259" 51 | }, 52 | { 53 | "affiliation": "Lausanne University Hospital and University of Lausanne, Lausanne, Switzerland", 54 | "name": "Provins, Céline", 55 | "orcid": "0000-0002-1668-9629" 56 | }, 57 | { 58 | "affiliation": "Department of Psychology, Florida International University", 59 | "name": "Salo, Taylor", 60 | "orcid": "0000-0001-9813-3167" 61 | } 62 | ] 63 | -------------------------------------------------------------------------------- /.maint/former.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Berleant, Shoshana" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /.maint/paper_author_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """Generate an author list for a new paper or abstract.""" 3 | 4 | import json 5 | import sys 6 | from pathlib import Path 7 | 8 | from update_zenodo import get_git_lines, sort_contributors 9 | 10 | # These authors should go last 11 | AUTHORS_LAST = ['Gorgolewski, Krzysztof J.', 'Poldrack, Russell A.', 'Esteban, Oscar'] 12 | 13 | 14 | def _aslist(inlist): 15 | if not isinstance(inlist, list): 16 | return [inlist] 17 | return inlist 18 | 19 | 20 | if __name__ == '__main__': 21 | devs = json.loads(Path('.maint/developers.json').read_text()) 22 | contribs = json.loads(Path('.maint/contributors.json').read_text()) 23 | 24 | author_matches, unmatched = sort_contributors( 25 | devs + contribs, 26 | get_git_lines(), 27 | exclude=json.loads(Path('.maint/former.json').read_text()), 28 | last=AUTHORS_LAST, 29 | ) 30 | # Remove position 31 | affiliations = [] 32 | for item in author_matches: 33 | del item['position'] 34 | for a in _aslist(item.get('affiliation', 'Unaffiliated')): 35 | if a not in affiliations: 36 | affiliations.append(a) 37 | 38 | aff_indexes = [ 39 | ', '.join( 40 | [ 41 | str(affiliations.index(a) + 1) 42 | for a in _aslist(author.get('affiliation', 'Unaffiliated')) 43 | ] 44 | ) 45 | for author in author_matches 46 | ] 47 | 48 | print( 49 | 'Some people made commits, but are missing in .maint/ files: {}.'.format( 50 | ', '.join(unmatched) 51 | ), 52 | file=sys.stderr, 53 | ) 54 | 55 | print(f'Authors ({len(author_matches)}):') 56 | print( 57 | '{}.'.format( 58 | '; '.join( 59 | [ 60 | rf'{i["name"]} \ :sup:`{idx}`\ ' 61 | for i, idx in zip(author_matches, aff_indexes, strict=False) 62 | ] 63 | ) 64 | ) 65 | ) 66 | 67 | print( 68 | '\n\nAffiliations:\n{}'.format( 69 | '\n'.join([f'{i + 1: >2}. {a}' for i, a in enumerate(affiliations)]) 70 | ) 71 | ) 72 | -------------------------------------------------------------------------------- /.maint/requirements.txt: -------------------------------------------------------------------------------- 1 | click 2 | fuzzywuzzy[speedup] 3 | -------------------------------------------------------------------------------- /.maint/update_changes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Collects the pull-requests since the latest release and 4 | # aranges them in the CHANGES.rst.txt file. 5 | # 6 | # This is a script to be run before releasing a new version. 7 | # 8 | # Usage /bin/bash update_changes.sh 1.0.1 9 | # 10 | 11 | # Setting # $ help set 12 | set -u # Treat unset variables as an error when substituting. 13 | set -x # Print command traces before executing command. 14 | 15 | # Check whether the Upcoming release header is present 16 | head -1 CHANGES.rst | grep -q Upcoming 17 | UPCOMING=$? 18 | if [[ "$UPCOMING" == "0" ]]; then 19 | head -n3 CHANGES.rst >> newchanges 20 | fi 21 | 22 | # Elaborate today's release header 23 | HEADER="$1 ($(date '+%B %d, %Y'))" 24 | echo $HEADER >> newchanges 25 | echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges 26 | echo "" >> newchanges 27 | 28 | # Search for PRs since previous release 29 | MERGE_COMMITS=$( git log --grep="Merge pull request\|(#.*)$" `git describe --tags --abbrev=0`..HEAD --pretty='format:%h' ) 30 | for COMMIT in ${MERGE_COMMITS//\n}; do 31 | SUB=$( git log -n 1 --pretty="format:%s" $COMMIT ) 32 | if ( echo $SUB | grep "^Merge pull request" ); then 33 | # Merge commit 34 | PR=$( echo $SUB | sed -e "s/Merge pull request \#\([0-9]*\).*/\1/" ) 35 | TITLE=$( git log -n 1 --pretty="format:%b" $COMMIT ) 36 | else 37 | # Squashed merge 38 | PR=$( echo $SUB | sed -e "s/.*(\#\([0-9]*\))$/\1/" ) 39 | TITLE=$( echo $SUB | sed -e "s/\(.*\) (\#[0-9]*)$/\1/" ) 40 | fi 41 | echo " * $TITLE (#$PR)" >> newchanges 42 | done 43 | echo >> newchanges 44 | echo >> newchanges 45 | 46 | # Add back the Upcoming header if it was present 47 | if [[ "$UPCOMING" == "0" ]]; then 48 | tail -n+4 CHANGES.rst >> newchanges 49 | else 50 | cat CHANGES.rst >> newchanges 51 | fi 52 | 53 | # Replace old CHANGES.rst with new file 54 | mv newchanges CHANGES.rst 55 | -------------------------------------------------------------------------------- /.maint/update_ignore_revs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Tag each rev with a simple log entry 4 | for SHA in $( grep -v "^#" .git-blame-ignore-revs ); do 5 | git log --pretty=format:"# %ad - %ae - %s%n$SHA%n" -n 1 --date short $SHA 6 | done > git-blame-ignore-revs 7 | 8 | # Two-step to avoid the original getting truncated before it's read 9 | mv git-blame-ignore-revs .git-blame-ignore-revs 10 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | exclude: ".*/data/.*" 2 | repos: 3 | - repo: https://github.com/pre-commit/pre-commit-hooks 4 | rev: v4.4.0 5 | hooks: 6 | - id: trailing-whitespace 7 | exclude: '.*\.svg' 8 | - id: end-of-file-fixer 9 | exclude: '.*\.svg' 10 | - id: check-yaml 11 | - id: check-json 12 | - id: check-toml 13 | - id: check-added-large-files 14 | - repo: https://github.com/astral-sh/ruff-pre-commit 15 | rev: v0.9.1 16 | hooks: 17 | - id: ruff 18 | args: [ --fix ] 19 | - id: ruff-format 20 | - id: ruff 21 | args: [ --select, ISC001, --fix ] 22 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-22.04 5 | tools: 6 | python: "3.11" 7 | apt_packages: 8 | - graphviz 9 | jobs: 10 | post_checkout: 11 | - git fetch --unshallow 12 | 13 | python: 14 | install: 15 | - requirements: docs/requirements.txt 16 | - path: . 17 | extra_requirements: 18 | - doc 19 | - path: wrapper/ 20 | 21 | sphinx: 22 | configuration: docs/conf.py 23 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "name": "ds005-anat", 10 | "type": "python", 11 | "request": "launch", 12 | "program": "/usr/local/miniconda/bin/fmriprep", 13 | "args": [ 14 | "-w", "/tmp/ds005/work", 15 | "/tmp/data/ds005", 16 | "/tmp/ds005/derivatives", 17 | "participant", 18 | "--skull-strip-template", "OASIS30ANTs:res-1", 19 | "--output-spaces", "MNI152NLin2009cAsym", "MNI152NLin6Asym", 20 | "--sloppy", "--write-graph", 21 | "--anat-only", "-vv", "--notrack" 22 | ], 23 | "console": "integratedTerminal", 24 | "justMyCode": false 25 | }, 26 | { 27 | "name": "ds005-full", 28 | "type": "python", 29 | "request": "launch", 30 | "program": "/usr/local/miniconda/bin/fmriprep", 31 | "args": [ 32 | "-w", "/tmp/ds005/work", 33 | "/tmp/data/ds005", 34 | "/tmp/ds005/derivatives", 35 | "participant", 36 | "--sloppy", "--write-graph", 37 | "--skull-strip-template", "OASIS30ANTs:res-1", 38 | "--output-space", "T1w", "template", "fsaverage5", "fsnative", 39 | "--template-resampling-grid", "native", 40 | "--use-plugin", "/src/fmriprep/.circleci/legacy.yml", 41 | "--cifti-output", "-vv", "--notrack" 42 | ], 43 | "console": "integratedTerminal", 44 | "justMyCode": false 45 | }, 46 | { 47 | "name": "ds054", 48 | "type": "python", 49 | "request": "launch", 50 | "program": "/usr/local/miniconda/bin/fmriprep", 51 | "args": [ 52 | "-w", "/tmp/ds054/work", 53 | "/tmp/data/ds054", 54 | "/tmp/ds054/derivatives", 55 | "participant", 56 | "--fs-no-reconall", "--sloppy", 57 | "--output-spaces", "MNI152NLin2009cAsym:res-2", "anat", "func", 58 | "-vv", 59 | "--notrack" 60 | ], 61 | "console": "integratedTerminal", 62 | "justMyCode": false 63 | }, 64 | { 65 | "name": "ds210-anat", 66 | "type": "python", 67 | "request": "launch", 68 | "program": "/usr/local/miniconda/bin/fmriprep", 69 | "args": [ 70 | "-w", "/tmp/ds210/work", 71 | "/tmp/data/ds210", 72 | "/tmp/ds210/derivatives", 73 | "participant", 74 | "--fs-no-reconall", "--sloppy", "--write-graph", 75 | "--anat-only", "-vv", "--notrack" 76 | ], 77 | "console": "integratedTerminal", 78 | "justMyCode": false 79 | }, 80 | { 81 | "name": "ds210-full", 82 | "type": "python", 83 | "request": "launch", 84 | "program": "/usr/local/miniconda/bin/fmriprep", 85 | "args": [ 86 | "-w", "/tmp/ds210/work", 87 | "/tmp/data/ds210", 88 | "/tmp/ds210/derivatives", 89 | "participant", 90 | "--t2s-coreg", "--use-syn-sdc", 91 | "--template-resampling-grid", "native", 92 | "--dummy-scans", "1", 93 | "--fs-no-reconall", "--sloppy", "--write-graph", 94 | "--anat-only", "-vv", "--notrack" 95 | ], 96 | "console": "integratedTerminal", 97 | "justMyCode": false 98 | } 99 | ] 100 | } 101 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "/usr/local/miniconda/bin/python", 3 | "restructuredtext.confPath": "${workspaceFolder}/docs", 4 | "python.testing.pytestEnabled": true, 5 | "python.testing.unittestEnabled": false, 6 | "python.testing.nosetestsEnabled": false, 7 | "python.testing.pytestArgs": [], 8 | "editor.defaultFormatter": "charliermarsh.ruff", 9 | } 10 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # fMRIPrep Code of Conduct 2 | 3 | *fMRIPrep* is a project of the [*NiPreps* Community, and is under its code of conduct](https://www.nipreps.org/community/CODE_OF_CONDUCT/). 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to *fMRIPrep* 2 | 3 | *fMRIPrep* is a project of the [*NiPreps* Community, which specifies the contributing guidelines](https://www.nipreps.org/community/). 4 | -------------------------------------------------------------------------------- /Dockerfile_devel: -------------------------------------------------------------------------------- 1 | FROM nipreps/fmriprep:unstable 2 | 3 | # net-tools needed for code-server 4 | # wget necessary for data downloads 5 | RUN apt-get update &&\ 6 | apt-get install -y \ 7 | net-tools \ 8 | wget 9 | 10 | # necessary to find fmriprep in /src/fmriprep 11 | ENV PYTHONNOUSERSITE=0 12 | 13 | RUN cd /src/fmriprep &&\ 14 | pip install --no-use-pep517 -e .[all] &&\ 15 | cp -R /src/fmriprep/fmriprep.egg-info /src/ 16 | 17 | # create freesurfer license 18 | RUN cd /tmp &&\ 19 | echo 'cHJpbnRmICJrcnp5c3p0b2YuZ29yZ29sZXdza2lAZ21haWwuY29tXG41MTcyXG4gKkN2dW12RVYzelRmZ1xuRlM1Si8yYzFhZ2c0RVxuIiA+IGxpY2Vuc2UudHh0Cg==' | base64 -d | sh 20 | 21 | ENV FS_LICENSE=/tmp/license.txt 22 | 23 | # set the fmriprep development variables 24 | ENV FMRIPREP_REGRESSION_SOURCE=/tmp/data/fmriprep_bold_truncated \ 25 | FMRIPREP_REGRESSION_TARGETS=/tmp/data/fmriprep_bold_mask \ 26 | FMRIPREP_REGRESSION_REPORTS=/tmp/data/reports \ 27 | FMRIPREP_DEV=1 28 | 29 | # use ruff as linter 30 | RUN conda install -y ruff 31 | 32 | RUN mkdir -p /tmp/data 33 | 34 | # Download ds005 35 | RUN wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \ 36 | -O ds005_downsampled.tar.gz "https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/57f32a429ad5a101f977eb75" &&\ 37 | tar xvzf ds005_downsampled.tar.gz -C /tmp/data/ &&\ 38 | rm ds005_downsampled.tar.gz 39 | 40 | # Download ds210 41 | RUN wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \ 42 | -O ds210_downsampled.tar.gz "https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5ae9e37b9a64d7000ce66c21" &&\ 43 | tar xvzf ds210_downsampled.tar.gz -C /tmp/data &&\ 44 | rm ds210_downsampled.tar.gz 45 | 46 | # Download ds054 47 | RUN wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \ 48 | -O ds054_downsampled.tar.gz "https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/57f32c22594d9001ef91bf9e" &&\ 49 | tar xvzf ds054_downsampled.tar.gz -C /tmp/data &&\ 50 | rm ds054_downsampled.tar.gz 51 | 52 | # Download freesurfer results for ds005 53 | RUN mkdir -p /tmp/ds005/derivatives &&\ 54 | wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \ 55 | -O ds005_derivatives_freesurfer.tar.gz "https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/58fe59eb594d900250960180" &&\ 56 | tar xvzf ds005_derivatives_freesurfer.tar.gz -C /tmp/ds005/derivatives &&\ 57 | rm ds005_derivatives_freesurfer.tar.gz 58 | 59 | # Download truncated bold images 60 | RUN wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \ 61 | -O fmriprep_bold_truncated.tar.gz "https://osf.io/286yr/download" &&\ 62 | tar xvzf fmriprep_bold_truncated.tar.gz -C /tmp/data &&\ 63 | rm fmriprep_bold_truncated.tar.gz 64 | 65 | # Download precomputed masks 66 | RUN wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \ 67 | -O fmriprep_bold_mask.tar.gz "https://osf.io/s4f7b/download" &&\ 68 | tar xvzf fmriprep_bold_mask.tar.gz -C /tmp/data &&\ 69 | rm fmriprep_bold_mask.tar.gz 70 | 71 | # set up code-server (need net-tools for initialization) - V2.1665-vsc1.39.2 72 | RUN curl -o /tmp/code-server.tar.gz -SL https://github.com/cdr/code-server/releases/download/2.1665-vsc1.39.2/code-server2.1665-vsc1.39.2-linux-x86_64.tar.gz 73 | 74 | RUN mkdir /src/codeserver &&\ 75 | tar -xvf /tmp/code-server.tar.gz -C /src/codeserver --strip-components=1 76 | 77 | RUN /src/codeserver/code-server --install-extension eamodio.gitlens &&\ 78 | /src/codeserver/code-server --install-extension ms-python.python 79 | 80 | 81 | ENTRYPOINT ["/src/codeserver/code-server", "--auth", "none", "/src/fmriprep"] 82 | 83 | # usage example (assuming in local fmriprep directory): 84 | # 85 | # docker run -it \ 86 | # -p 127.0.0.1:8445:8080 \ 87 | # -v ${PWD}:/src/fmriprep \ 88 | # fmriprep_devel:latest 89 | # 90 | # then type 127.0.0.1:8445 in your browser address bar 91 | -------------------------------------------------------------------------------- /GOVERNANCE.md: -------------------------------------------------------------------------------- 1 | # Governance 2 | 3 | This Project belongs to the *NiPreps* Community, and its governance model abides by the [`PROJECT-CHARTER.md`](https://github.com/nipreps/GOVERNANCE/blob/main/org-docs/PROJECT-CHARTER.md) document. 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: help docker-build 2 | .DEFAULT: help 3 | 4 | tag="fmriprep" 5 | 6 | help: 7 | @echo "Premade recipes" 8 | @echo 9 | @echo "make docker-build [tag=TAG]" 10 | @echo "\tBuilds a docker image from source. Defaults to 'fmriprep' tag." 11 | 12 | 13 | docker-build: 14 | docker build --rm -t $(tag) \ 15 | --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ 16 | --build-arg VCS_REF=`git rev-parse --short HEAD` \ 17 | --build-arg VERSION=`hatch version` . 18 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | fmriprep/data/NOTICE -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | *.png 2 | *.dot 3 | etc/ 4 | args.txt 5 | -------------------------------------------------------------------------------- /docs/_static/OHBM2017-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/docs/_static/OHBM2017-poster.png -------------------------------------------------------------------------------- /docs/_static/OHBM2017-poster_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/docs/_static/OHBM2017-poster_thumb.png -------------------------------------------------------------------------------- /docs/_static/OHBM2018-poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/docs/_static/OHBM2018-poster.png -------------------------------------------------------------------------------- /docs/_static/OHBM2018-poster_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/docs/_static/OHBM2018-poster_thumb.png -------------------------------------------------------------------------------- /docs/_static/fmriprep-workflow-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/docs/_static/fmriprep-workflow-all.png -------------------------------------------------------------------------------- /docs/_static/sbatch.slurm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #SBATCH -J fmriprep 4 | #SBATCH --time=48:00:00 5 | #SBATCH -n 1 6 | #SBATCH --cpus-per-task=16 7 | #SBATCH --mem-per-cpu=4G 8 | #SBATCH -p normal,mygroup # Queue names you can submit to 9 | # Outputs ---------------------------------- 10 | #SBATCH -o log/%x-%A-%a.out 11 | #SBATCH -e log/%x-%A-%a.err 12 | #SBATCH --mail-user=%u@domain.tld 13 | #SBATCH --mail-type=ALL 14 | # ------------------------------------------ 15 | 16 | BIDS_DIR="$STUDY/data" 17 | DERIVS_DIR="derivatives/fmriprep-1.5.0" 18 | LOCAL_FREESURFER_DIR="$STUDY/data/derivatives/freesurfer-6.0.1" 19 | 20 | # Prepare some writeable bind-mount points. 21 | TEMPLATEFLOW_HOST_HOME=$HOME/.cache/templateflow 22 | FMRIPREP_HOST_CACHE=$HOME/.cache/fmriprep 23 | mkdir -p ${TEMPLATEFLOW_HOST_HOME} 24 | mkdir -p ${FMRIPREP_HOST_CACHE} 25 | 26 | # Prepare derivatives folder 27 | mkdir -p ${BIDS_DIR}/${DERIVS_DIR} 28 | 29 | # Make sure FS_LICENSE is defined in the container. 30 | export SINGULARITYENV_FS_LICENSE=$HOME/.freesurfer.txt 31 | 32 | # Designate a templateflow bind-mount point 33 | export SINGULARITYENV_TEMPLATEFLOW_HOME="/templateflow" 34 | SINGULARITY_CMD="singularity run --cleanenv -B $BIDS_DIR:/data -B ${TEMPLATEFLOW_HOST_HOME}:${SINGULARITYENV_TEMPLATEFLOW_HOME} -B $L_SCRATCH:/work -B ${LOCAL_FREESURFER_DIR}:/fsdir $STUDY/images/nipreps_fmriprep_1.5.0.simg" 35 | 36 | # Parse the participants.tsv file and extract one subject ID from the line corresponding to this SLURM task. 37 | subject=$( sed -n -E "$((${SLURM_ARRAY_TASK_ID} + 1))s/sub-(\S*)\>.*/\1/gp" ${BIDS_DIR}/participants.tsv ) 38 | 39 | # Remove IsRunning files from FreeSurfer 40 | find ${LOCAL_FREESURFER_DIR}/sub-$subject/ -name "*IsRunning*" -type f -delete 41 | 42 | # Compose the command line 43 | cmd="${SINGULARITY_CMD} /data /data/${DERIVS_DIR} participant --participant-label $subject -w /work/ -vv --omp-nthreads 8 --nthreads 12 --mem_mb 30000 --output-spaces MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5 --fs-subjects-dir /fsdir" 44 | 45 | # Setup done, run the command 46 | echo Running task ${SLURM_ARRAY_TASK_ID} 47 | echo Commandline: $cmd 48 | eval $cmd 49 | exitcode=$? 50 | 51 | # Output results to a table 52 | echo "sub-$subject ${SLURM_ARRAY_TASK_ID} $exitcode" \ 53 | >> ${SLURM_JOB_NAME}.${SLURM_ARRAY_JOB_ID}.tsv 54 | echo Finished tasks ${SLURM_ARRAY_TASK_ID} with exit code $exitcode 55 | exit $exitcode 56 | -------------------------------------------------------------------------------- /docs/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | /* override table width restrictions */ 2 | @media screen and (min-width: 767px) { 3 | 4 | .wy-table-responsive table td { 5 | /* !important prevents the common CSS stylesheets from overriding 6 | this as on RTD they are loaded after this stylesheet */ 7 | white-space: normal !important; 8 | } 9 | 10 | .wy-table-responsive { 11 | overflow: visible !important; 12 | } 13 | } 14 | 15 | 16 | /* Fix parameter type style */ 17 | .function .classifier { 18 | margin: 0 0 0 5px; 19 | padding: 3px; 20 | background: rgba(0, 0, 0, .1); 21 | } 22 | -------------------------------------------------------------------------------- /docs/api.rst: -------------------------------------------------------------------------------- 1 | .. include:: links.rst 2 | 3 | ================ 4 | Developers - API 5 | ================ 6 | The *NiPreps* community and contributing guidelines 7 | --------------------------------------------------- 8 | *fMRIPrep* is a *NiPreps* application, and abides by the 9 | `NiPreps Community guidelines `__. 10 | Please, make sure you have read and understood all the documentation 11 | provided in the `NiPreps portal `__ before 12 | you get started. 13 | 14 | Setting up your development environment 15 | --------------------------------------- 16 | We believe that *fMRIPrep* must be free to use, inspect, and critique. 17 | Correspondingly, you should be free to modify our software to improve it 18 | or adapt it to new use cases and we especially welcome contributions to 19 | improve it or its documentation. 20 | 21 | We actively direct efforts into making the scrutiny and improvement processes 22 | as easy as possible. 23 | As part of such efforts, we maintain some 24 | `tips and guidelines for developers `__ 25 | to help minimize your burden if you want to modify the software. 26 | 27 | Internal configuration system 28 | ----------------------------- 29 | 30 | .. automodule:: fmriprep.config 31 | :members: from_dict, load, get, dumps, to_filename, init_spaces 32 | 33 | Workflows 34 | --------- 35 | 36 | .. automodule:: fmriprep.workflows.base 37 | .. automodule:: fmriprep.workflows.bold 38 | .. automodule:: fmriprep.workflows.bold.fit 39 | -------------------------------------------------------------------------------- /docs/changes.rst: -------------------------------------------------------------------------------- 1 | .. include:: links.rst 2 | 3 | ---------- 4 | What's new 5 | ---------- 6 | 7 | .. include:: ../CHANGES.rst 8 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. fmriprep documentation master file, created by 2 | sphinx-quickstart on Mon May 9 09:04:25 2016. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | .. include:: links.rst 7 | .. include:: ../README.rst 8 | 9 | Contents 10 | -------- 11 | 12 | .. toctree:: 13 | :maxdepth: 3 14 | 15 | installation 16 | usage 17 | workflows 18 | outputs 19 | benchmarks 20 | spaces 21 | faq 22 | api 23 | changes 24 | -------------------------------------------------------------------------------- /docs/license.rst: -------------------------------------------------------------------------------- 1 | About the *NiPreps* framework licensing 2 | --------------------------------------- 3 | Please check https://www.nipreps.org/community/licensing/ for detailed 4 | information on the criteria we use to license *fMRIPrep* and other 5 | projects of the framework. 6 | 7 | License information 8 | ------------------- 9 | Copyright (c) 2023, the *NiPreps* Developers. 10 | 11 | As of the 21.0.x pre-release and release series, *fMRIPrep* is 12 | licensed under the Apache License, Version 2.0 (the "License"); 13 | you may not use this file except in compliance with the License. 14 | You may obtain a copy of the License at 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | 23 | Copyright (c) 2015-2023, the *fMRIPrep* developers and the CRN. 24 | All rights reserved. 25 | 26 | *fMRIPrep* 20.2 series and earlier are 27 | licensed under the BSD 3-clause license. 28 | You may obtain a copy of the License at 29 | https://opensource.org/licenses/BSD-3-Clause 30 | 31 | All trademarks referenced herein are property of their respective holders. 32 | 33 | The ``fmriprep-wrapper`` for Docker 34 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | Copyright (c) 2020-2023, the *NiPreps* Developers. 36 | Copyright (c) 2015-2020, the *fMRIPrep* developers and the CRN. 37 | All rights reserved. 38 | 39 | *fMRIPrep-wrapper* is 40 | licensed under the BSD 3-clause license. 41 | You may obtain a copy of the License at 42 | https://opensource.org/licenses/BSD-3-Clause 43 | 44 | All trademarks referenced herein are property of their respective holders. 45 | -------------------------------------------------------------------------------- /docs/links.rst: -------------------------------------------------------------------------------- 1 | .. _Nipype: https://nipype.readthedocs.io/en/latest/ 2 | .. _BIDS: https://bids.neuroimaging.io/ 3 | .. _`BIDS Derivatives`: https://bids-specification.readthedocs.io/en/stable/05-derivatives/01-introduction.html 4 | .. _`BEP 011`: https://bids-specification.readthedocs.io/en/bep011/05-derivatives/04-structural-derivatives.html 5 | .. _`BEP 012`: https://bids-specification.readthedocs.io/en/bep012/05-derivatives/05-functional-derivatives.html 6 | .. _Installation: installation.html 7 | .. _workflows: workflows.html 8 | .. _FSL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/ 9 | .. _ANTs: https://stnava.github.io/ANTs/ 10 | .. _FreeSurfer: https://surfer.nmr.mgh.harvard.edu/ 11 | .. _`submillimeter reconstruction`: https://surfer.nmr.mgh.harvard.edu/fswiki/SubmillimeterRecon 12 | .. _`mri_robust_template`: https://surfer.nmr.mgh.harvard.edu/fswiki/mri_robust_template 13 | .. _AFNI: https://afni.nimh.nih.gov/ 14 | .. _GIFTI: https://www.nitrc.org/projects/gifti/ 15 | .. _`Connectome Workbench`: https://www.humanconnectome.org/software/connectome-workbench.html 16 | .. _`HCP Pipelines`: https://humanconnectome.org/software/hcp-mr-pipelines/ 17 | .. _`Docker wrapper`: https://pypi.python.org/pypi/fmriprep-docker 18 | .. _`Docker Engine`: https://www.docker.com/products/container-runtime 19 | .. _`Docker installation`: https://docs.docker.com/install/ 20 | .. _`Docker Hub`: https://hub.docker.com/r/nipreps/fmriprep/tags 21 | .. _Singularity: https://github.com/singularityware/singularity 22 | .. _SPM: https://www.fil.ion.ucl.ac.uk/spm/software/spm12/ 23 | .. _TACC: https://www.tacc.utexas.edu/ 24 | .. _tedana: https://github.com/me-ica/tedana 25 | .. _`T2* workflow`: https://tedana.readthedocs.io/en/latest/generated/tedana.workflows.t2smap_workflow.html#tedana.workflows.t2smap_workflow # noqa 26 | .. _`citation boilerplate`: https://www.nipreps.org/intro/transparency/#citation-boilerplates 27 | -------------------------------------------------------------------------------- /docs/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | ## Changes proposed in this pull request 8 | 9 | 17 | 18 | 19 | ## Documentation that should be reviewed 20 | 23 | 24 | 25 | 26 | 50 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/docs/requirements.txt -------------------------------------------------------------------------------- /docs/sphinxext/github_link.py: -------------------------------------------------------------------------------- 1 | """ 2 | This vendored script comes from scikit-learn: 3 | https://github.com/scikit-learn/scikit-learn/blob/master/doc/sphinxext/github_link.py 4 | """ 5 | 6 | import inspect 7 | import os 8 | import subprocess 9 | import sys 10 | from functools import partial 11 | from operator import attrgetter 12 | 13 | REVISION_CMD = 'git rev-parse --short HEAD' 14 | 15 | 16 | def _get_git_revision(): 17 | try: 18 | revision = subprocess.check_output(REVISION_CMD.split()).strip() 19 | except (subprocess.CalledProcessError, OSError): 20 | print('Failed to execute git to get revision') 21 | return None 22 | return revision.decode('utf-8') 23 | 24 | 25 | def _linkcode_resolve(domain, info, package, url_fmt, revision): 26 | """Determine a link to online source for a class/method/function 27 | 28 | This is called by sphinx.ext.linkcode 29 | 30 | An example with a long-untouched module that everyone has 31 | >>> _linkcode_resolve('py', {'module': 'tty', 32 | ... 'fullname': 'setraw'}, 33 | ... package='tty', 34 | ... url_fmt='http://hg.python.org/cpython/file/' 35 | ... '{revision}/Lib/{package}/{path}#L{lineno}', 36 | ... revision='xxxx') 37 | 'http://hg.python.org/cpython/file/xxxx/Lib/tty/tty.py#L18' 38 | """ 39 | 40 | if revision is None: 41 | return 42 | if domain not in ('py', 'pyx'): 43 | return 44 | if not info.get('module') or not info.get('fullname'): 45 | return 46 | 47 | class_name = info['fullname'].split('.')[0] 48 | module = __import__(info['module'], fromlist=[class_name]) 49 | obj = attrgetter(info['fullname'])(module) 50 | 51 | # Unwrap the object to get the correct source 52 | # file in case that is wrapped by a decorator 53 | obj = inspect.unwrap(obj) 54 | 55 | try: 56 | fn = inspect.getsourcefile(obj) 57 | except Exception: 58 | fn = None 59 | if not fn: 60 | try: 61 | fn = inspect.getsourcefile(sys.modules[obj.__module__]) 62 | except Exception: 63 | fn = None 64 | if not fn: 65 | return 66 | 67 | fn = os.path.relpath(fn, start=os.path.dirname(__import__(package).__file__)) 68 | try: 69 | lineno = inspect.getsourcelines(obj)[1] 70 | except Exception: 71 | lineno = '' 72 | return url_fmt.format(revision=revision, package=package, path=fn, lineno=lineno) 73 | 74 | 75 | def make_linkcode_resolve(package, url_fmt): 76 | """Returns a linkcode_resolve function for the given URL format 77 | 78 | revision is a git commit reference (hash or name) 79 | 80 | package is the name of the root module of the package 81 | 82 | url_fmt is along the lines of ('https://github.com/USER/PROJECT/' 83 | 'blob/{revision}/{package}/' 84 | '{path}#L{lineno}') 85 | """ 86 | revision = _get_git_revision() 87 | return partial(_linkcode_resolve, revision=revision, package=package, url_fmt=url_fmt) 88 | -------------------------------------------------------------------------------- /env.yml: -------------------------------------------------------------------------------- 1 | name: fmriprep 2 | channels: 3 | - https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/ 4 | - conda-forge 5 | # Update this ~yearly; last updated Mar 2025 6 | dependencies: 7 | - python=3.12 8 | # Needed for svgo and bids-validator; consider moving to deno 9 | - nodejs=20 10 | # Intel Math Kernel Library for numpy 11 | - mkl=2024.2.2 12 | - mkl-service=2.4.2 13 | # git-annex for templateflow users with DataLad superdatasets 14 | - git-annex=*=alldep* 15 | # Base scientific python stack; required by FSL, so pinned here 16 | - numpy=2.2 17 | - scipy=1.15 18 | - matplotlib=3.10 19 | - pandas=2.2 20 | - h5py=3.13 21 | # Dependencies compiled against numpy, best to stick with conda 22 | - nitime=0.11 23 | - scikit-image=0.25 24 | - scikit-learn=1.6 25 | # Utilities 26 | - graphviz=12.2 27 | - pandoc=3.7 28 | # Workflow dependencies: ANTs 29 | - ants=2.6 30 | # Workflow dependencies: Connectome Workbench 31 | - connectome-workbench-cli=2.0 32 | # Workflow dependencies: FSL (versions pinned in 6.0.7.17.20250415.fe1c582e) 33 | - fsl-bet2=2111.8 34 | - fsl-flirt=2111.4 35 | - fsl-fast4=2111.3 36 | - fsl-fugue=2201.5 37 | - fsl-mcflirt=2111.0 38 | - fsl-miscmaths=2412.4 39 | - fsl-topup=2203.5 40 | - pip 41 | - pip: 42 | - -r requirements.txt 43 | variables: 44 | FSLOUTPUTTYPE: NIFTI_GZ 45 | -------------------------------------------------------------------------------- /fmriprep/__init__.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Top-module metadata.""" 24 | 25 | try: 26 | from ._version import __version__ 27 | except ImportError: 28 | __version__ = '0+unknown' 29 | -------------------------------------------------------------------------------- /fmriprep/__main__.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | from .cli.run import main 24 | 25 | if __name__ == '__main__': 26 | import sys 27 | 28 | from . import __name__ as module 29 | 30 | # `python -m ` typically displays the command as __main__.py 31 | if '__main__.py' in sys.argv[0]: 32 | sys.argv[0] = f'{sys.executable} -m {module}' 33 | main() 34 | -------------------------------------------------------------------------------- /fmriprep/_warnings.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Manipulate Python warnings.""" 24 | 25 | import logging 26 | import warnings 27 | 28 | _wlog = logging.getLogger('py.warnings') 29 | _wlog.addHandler(logging.NullHandler()) 30 | 31 | 32 | def _warn(message, category=None, stacklevel=1, source=None): 33 | """Redefine the warning function.""" 34 | if category is not None: 35 | category = type(category).__name__ 36 | category = category.replace('type', 'WARNING') 37 | 38 | logging.getLogger('py.warnings').warning(f'{category or "WARNING"}: {message}') 39 | 40 | 41 | def _showwarning(message, category, filename, lineno, file=None, line=None): 42 | _warn(message, category=category) 43 | 44 | 45 | warnings.warn = _warn 46 | warnings.showwarning = _showwarning 47 | -------------------------------------------------------------------------------- /fmriprep/cli/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/cli/__init__.py -------------------------------------------------------------------------------- /fmriprep/cli/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/cli/tests/__init__.py -------------------------------------------------------------------------------- /fmriprep/cli/version.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Version CLI helpers.""" 24 | 25 | from contextlib import suppress 26 | from datetime import datetime, timezone 27 | from pathlib import Path 28 | 29 | import requests 30 | 31 | from .. import __version__ 32 | 33 | RELEASE_EXPIRY_DAYS = 14 34 | DATE_FMT = '%Y%m%d' 35 | 36 | 37 | def check_latest(): 38 | """Determine whether this is the latest version.""" 39 | from packaging.version import InvalidVersion, Version 40 | 41 | latest = None 42 | date = None 43 | outdated = None 44 | now = datetime.now(tz=timezone.utc) 45 | cachefile = Path.home() / '.cache' / 'fmriprep' / 'latest' 46 | try: 47 | cachefile.parent.mkdir(parents=True, exist_ok=True) 48 | except OSError: 49 | cachefile = None 50 | 51 | if cachefile and cachefile.exists(): 52 | try: 53 | latest, date = cachefile.read_text().split('|') 54 | except Exception: # noqa: S110, BLE001 55 | pass 56 | else: 57 | try: 58 | latest = Version(latest) 59 | date = datetime.strptime(date, DATE_FMT).astimezone(timezone.utc) 60 | except (InvalidVersion, ValueError): 61 | latest = None 62 | else: 63 | if abs((now - date).days) > RELEASE_EXPIRY_DAYS: 64 | outdated = True 65 | 66 | if latest is None or outdated is True: 67 | response = None 68 | with suppress(Exception): 69 | response = requests.get(url='https://pypi.org/pypi/fmriprep/json', timeout=1.0) 70 | 71 | if response and response.status_code == 200: 72 | versions = [Version(rel) for rel in response.json()['releases'].keys()] 73 | versions = [rel for rel in versions if not rel.is_prerelease] 74 | if versions: 75 | latest = sorted(versions)[-1] 76 | else: 77 | latest = None 78 | 79 | if cachefile is not None and latest is not None: 80 | with suppress(OSError): 81 | cachefile.write_text(f'{latest}|{now.strftime(DATE_FMT)}') 82 | 83 | return latest 84 | 85 | 86 | def is_flagged(): 87 | """Check whether current version is flagged.""" 88 | # https://raw.githubusercontent.com/nipreps/fmriprep/master/.versions.json 89 | flagged = () 90 | response = None 91 | with suppress(Exception): 92 | response = requests.get( 93 | url="""\ 94 | https://raw.githubusercontent.com/nipreps/fmriprep/master/.versions.json""", 95 | timeout=1.0, 96 | ) 97 | 98 | if response and response.status_code == 200: 99 | flagged = response.json().get('flagged', {}) or {} 100 | 101 | if __version__ in flagged: 102 | return True, flagged[__version__] 103 | 104 | return False, None 105 | -------------------------------------------------------------------------------- /fmriprep/conftest.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from pathlib import Path 4 | from shutil import copytree 5 | 6 | import nibabel as nb 7 | import numpy as np 8 | import pytest 9 | 10 | try: 11 | from importlib.resources import files as ir_files 12 | except ImportError: # PY<3.9 13 | from importlib_resources import files as ir_files 14 | 15 | os.environ['NO_ET'] = '1' 16 | 17 | 18 | def copytree_or_skip(source, target): 19 | data_dir = ir_files('fmriprep') / source 20 | if not data_dir.exists(): 21 | pytest.skip(f'Cannot chdir into {data_dir!r}. Probably in a zipped distribution.') 22 | 23 | try: 24 | copytree(data_dir, target / data_dir.name) 25 | except Exception: # noqa: BLE001 26 | pytest.skip(f'Cannot copy {data_dir!r} into {target / data_dir.name}. Probably in a zip.') 27 | 28 | 29 | @pytest.fixture(scope='session', autouse=True) 30 | def _legacy_printoptions(): 31 | np.set_printoptions(legacy='1.21') 32 | 33 | 34 | @pytest.fixture(autouse=True) 35 | def _populate_namespace(doctest_namespace, tmp_path): 36 | doctest_namespace['copytree_or_skip'] = copytree_or_skip 37 | doctest_namespace['testdir'] = tmp_path 38 | 39 | 40 | @pytest.fixture 41 | def minimal_bids(tmp_path): 42 | bids = tmp_path / 'bids' 43 | bids.mkdir() 44 | Path.write_text( 45 | bids / 'dataset_description.json', json.dumps({'Name': 'Test DS', 'BIDSVersion': '1.8.0'}) 46 | ) 47 | T1w = bids / 'sub-01' / 'anat' / 'sub-01_T1w.nii.gz' 48 | T1w.parent.mkdir(parents=True) 49 | nb.Nifti1Image(np.zeros((5, 5, 5)), np.eye(4)).to_filename(T1w) 50 | return bids 51 | -------------------------------------------------------------------------------- /fmriprep/data/NOTICE: -------------------------------------------------------------------------------- 1 | fMRIPrep 2 | Copyright The NiPreps Developers. 3 | 4 | This product includes software developed by 5 | the NiPreps Community (https://nipreps.org/). 6 | 7 | Portions of this software were developed at the Department of 8 | Psychology at Stanford University, Stanford, CA, US. 9 | 10 | This software is also distributed as a Docker container image. 11 | The bootstrapping file for the image ("Dockerfile") is licensed 12 | under the MIT License. 13 | 14 | This software may be distributed through an add-on package called 15 | "Docker Wrapper" that is under the BSD 3-clause License. 16 | -------------------------------------------------------------------------------- /fmriprep/data/__init__.py: -------------------------------------------------------------------------------- 1 | """fMRIPrep data files 2 | 3 | .. autofunction:: load 4 | 5 | .. automethod:: load.readable 6 | 7 | .. automethod:: load.as_path 8 | 9 | .. automethod:: load.cached 10 | """ 11 | 12 | from acres import Loader 13 | 14 | load = Loader(__package__) 15 | -------------------------------------------------------------------------------- /fmriprep/data/flirtsch/bbr.sch: -------------------------------------------------------------------------------- 1 | # 1mm scale 2 | setscale 1 force 3 | setoption costfunction bbr 4 | setoption optimisationtype brent 5 | setoption tolerance 0.0005 0.0005 0.0005 0.02 0.02 0.02 0.002 0.002 0.002 0.001 0.001 0.001 6 | #setoption tolerance 0.005 0.005 0.005 0.2 0.2 0.2 0.02 0.02 0.02 0.01 0.01 0.01 7 | setoption boundguess 1 8 | setoption bbrstep 200 9 | clear UA 10 | clear UU 11 | clear UV 12 | clear U 13 | setrowqsform UU 14 | setrow UU 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 15 | measurecost 6 UU:1-2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8 16 | gridmeasurecost 6 UU:1-2 -0.07 0.07 0.07 -0.07 0.07 0.07 -0.07 0.07 0.07 -4.0 4.0 4.0 -4.0 4.0 4.0 -4.0 4.0 4.0 0.0 0.0 0.0 abs 8 17 | sort U 18 | copy U UA 19 | clear U 20 | optimise 6 UA:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8 21 | setoption optimisationtype powell 22 | optimise 6 U:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8 23 | setoption optimisationtype brent 24 | optimise 6 U:2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 4 25 | sort U 26 | setoption tolerance 0.0002 0.0002 0.0002 0.02 0.02 0.02 0.002 0.002 0.002 0.001 0.001 0.001 27 | setoption bbrstep 2 28 | clear UU 29 | copy U UU 30 | clear U 31 | gridmeasurecost 6 UU:1 -0.0017 0.0017 0.0017 -0.0017 0.0017 0.0017 -0.0017 0.0017 0.0017 -0.1 0.1 0.1 -0.1 0.1 0.1 -0.1 0.1 0.1 0.0 0.0 0.0 abs 8 32 | sort U 33 | clear UB 34 | copy U UB 35 | clear U 36 | setoption optimisationtype brent 37 | optimise 6 UB:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8 38 | setoption optimisationtype powell 39 | optimise 12 U:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8 40 | setoption optimisationtype brent 41 | optimise 12 U:2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 4 42 | sort U 43 | print U:1 44 | 45 | -------------------------------------------------------------------------------- /fmriprep/data/fmap_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "queries": { 3 | "fieldmaps": { 4 | "fieldmap": { 5 | "datatype": "fmap", 6 | "desc": "preproc", 7 | "suffix": "fieldmap", 8 | "extension": [ 9 | ".nii.gz", 10 | ".nii" 11 | ] 12 | }, 13 | "coeffs": { 14 | "datatype": "fmap", 15 | "desc": ["coeff", "coeff0", "coeff1"], 16 | "suffix": "fieldmap", 17 | "extension": [ 18 | ".nii.gz", 19 | ".nii" 20 | ] 21 | }, 22 | "magnitude": { 23 | "datatype": "fmap", 24 | "desc": "magnitude", 25 | "suffix": "fieldmap", 26 | "extension": [ 27 | ".nii.gz", 28 | ".nii" 29 | ] 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /fmriprep/data/io_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "queries": { 3 | "baseline": { 4 | "hmc": { 5 | "datatype": "func", 6 | "space": null, 7 | "desc": "hmc", 8 | "suffix": "boldref", 9 | "extension": [ 10 | ".nii.gz", 11 | ".nii" 12 | ] 13 | }, 14 | "coreg": { 15 | "datatype": "func", 16 | "space": null, 17 | "desc": "coreg", 18 | "suffix": "boldref", 19 | "extension": [ 20 | ".nii.gz", 21 | ".nii" 22 | ] 23 | } 24 | }, 25 | "transforms": { 26 | "hmc": { 27 | "datatype": "func", 28 | "from": "orig", 29 | "to": "boldref", 30 | "mode": "image", 31 | "suffix": "xfm", 32 | "extension": ".txt" 33 | }, 34 | "boldref2anat": { 35 | "datatype": "func", 36 | "from": "boldref", 37 | "to": ["anat", "T1w", "T2w"], 38 | "mode": "image", 39 | "suffix": "xfm", 40 | "extension": ".txt" 41 | }, 42 | "boldref2fmap": { 43 | "datatype": "func", 44 | "from": "boldref", 45 | "mode": "image", 46 | "suffix": "xfm", 47 | "extension": ".txt" 48 | } 49 | } 50 | }, 51 | "patterns": [ 52 | "sub-{subject}[/ses-{session}]/{datatype|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_res-{res}][_label-{label}][_echo-{echo}][_space-{space}][_desc-{desc}]_{suffix}.{extension|nii.gz}", 53 | "sub-{subject}[/ses-{session}]/{datatype|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_from-{from}_to-{to}_mode-{mode|image}_{suffix|xfm}.{extension}", 54 | "sub-{subject}[/ses-{session}]/{datatype|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_part-{part}][_desc-{desc}]_{suffix}.{extension}", 55 | "sub-{subject}[/ses-{session}]/{datatype|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_space-{space}][_res-{res}][_den-{den}][_hemi-{hemi}[_label-{label}][_desc-{desc}]_{suffix<|boldref|dseg|mask>}.{extension}" 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /fmriprep/data/reports-spec-anat.yml: -------------------------------------------------------------------------------- 1 | package: fmriprep 2 | title: Anatomical report for participant '{subject}' - fMRIPrep 3 | sections: 4 | - name: Summary 5 | reportlets: 6 | - bids: {datatype: figures, desc: summary, suffix: T1w} 7 | - name: Anatomical 8 | reportlets: 9 | - bids: 10 | datatype: figures 11 | desc: conform 12 | extension: [.html] 13 | suffix: T1w 14 | - bids: {datatype: figures, suffix: dseg} 15 | caption: This panel shows the final, preprocessed T1-weighted image, 16 | with contours delineating the detected brain mask and brain tissue segmentations. 17 | subtitle: Brain mask and brain tissue segmentation of the T1w 18 | - bids: {datatype: figures, space: .*, suffix: T1w, regex_search: True} 19 | caption: Spatial normalization of the T1w image to the {space} template. 20 | description: Results of nonlinear alignment of the T1w reference one or more template 21 | space(s). Hover on the panels with the mouse pointer to transition between both 22 | spaces. 23 | static: false 24 | subtitle: Spatial normalization of the anatomical T1w reference 25 | - bids: {datatype: figures, desc: reconall, suffix: T1w} 26 | caption: Surfaces (white and pial) reconstructed with FreeSurfer (recon-all) 27 | overlaid on the participant's T1w template. 28 | subtitle: Surface reconstruction 29 | - name: About 30 | reportlets: 31 | - bids: {datatype: figures, desc: about, suffix: T1w} 32 | - custom: boilerplate 33 | path: '{out_dir}/logs' 34 | bibfile: ['fmriprep', 'data/boilerplate.bib'] 35 | caption: | 36 |

We kindly ask to report results preprocessed with this tool using the following boilerplate.

37 | 44 | title: Methods 45 | - custom: errors 46 | path: '{out_dir}/sub-{subject}/log/{run_uuid}' 47 | captions: NiReports may have recorded failure conditions. 48 | title: Errors 49 | -------------------------------------------------------------------------------- /fmriprep/data/tests/config.toml: -------------------------------------------------------------------------------- 1 | [environment] 2 | cpu_count = 8 3 | exec_env = "posix" 4 | free_mem = 2.2 5 | overcommit_policy = "heuristic" 6 | overcommit_limit = "50%" 7 | nipype_version = "1.5.0" 8 | templateflow_version = "0.4.2" 9 | version = "20.0.1" 10 | 11 | [execution] 12 | bids_dir = "ds000005/" 13 | bids_description_hash = "5d42e27751bbc884eca87cb4e62b9a0cca0cd86f8e578747fe89b77e6c5b21e5" 14 | boilerplate_only = false 15 | fs_license_file = "/opt/freesurfer/license.txt" 16 | fs_subjects_dir = "/opt/freesurfer/subjects" 17 | log_dir = "/home/oesteban/tmp/fmriprep-ds005/out/fmriprep/logs" 18 | log_level = 40 19 | low_mem = false 20 | md_only_boilerplate = false 21 | notrack = true 22 | output_dir = "/tmp" 23 | output_spaces = "MNI152NLin2009cAsym:res-2 MNI152NLin2009cAsym:res-native fsaverage:den-10k fsaverage:den-30k" 24 | reports_only = false 25 | run_uuid = "20200306-105302_d365772b-fd60-4741-a722-372c2f558b50" 26 | participant_label = [ "01",] 27 | templateflow_home = "~/.cache/templateflow" 28 | work_dir = "work/" 29 | write_graph = false 30 | 31 | [workflow] 32 | anat_only = false 33 | aroma_err_on_warn = false 34 | aroma_melodic_dim = -200 35 | bold2anat_dof = 6 36 | fmap_bspline = false 37 | force = [] 38 | force_syn = false 39 | hires = true 40 | ignore = [] 41 | longitudinal = false 42 | medial_surface_nan = false 43 | project_goodvoxels = false 44 | regressors_all_comps = false 45 | regressors_dvars_th = 1.5 46 | regressors_fd_th = 0.5 47 | run_reconall = true 48 | skull_strip_fixed_seed = false 49 | skull_strip_template = "OASIS30ANTs" 50 | t2s_coreg = false 51 | use_aroma = false 52 | 53 | [nipype] 54 | crashfile_format = "txt" 55 | get_linked_libs = false 56 | memory_gb = 32 57 | nprocs = 8 58 | omp_nthreads = 8 59 | plugin = "MultiProc" 60 | resource_monitor = false 61 | stop_on_first_crash = false 62 | 63 | [nipype.plugin_args] 64 | maxtasksperchild = 1 65 | raise_insufficient = false 66 | 67 | [execution.bids_filters.t1w] 68 | reconstruction = "" 69 | 70 | [execution.bids_filters.t2w] 71 | reconstruction = "" 72 | -------------------------------------------------------------------------------- /fmriprep/data/tests/crash_files/crash-20170905-182839-root-dvars-b78e9ea8-e295-48a1-af71-2d36afd9cebf.txt: -------------------------------------------------------------------------------- 1 | Node: fmriprep_wf.single_subject_100185_wf.func_preproc_task_machinegame_run_01_wf.bold_confounds_wf.dvars 2 | Working directory: /scratch/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_01_wf/bold_confounds_wf/dvars 3 | 4 | Node inputs: 5 | 6 | figdpi = 100 7 | figformat = png 8 | figsize = (11.7, 2.3) 9 | ignore_exception = False 10 | in_file = /scratch/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_01_wf/bold_reg_wf/merge/vol0000_trans_merged.nii.gz 11 | in_mask = /scratch/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_01_wf/bold_reg_wf/mask_t1w_tfm/ref_image_corrected_brain_mask_maths_trans.nii.gz 12 | intensity_normalization = 1000.0 13 | remove_zerovariance = True 14 | save_all = True 15 | save_nstd = False 16 | save_plot = False 17 | save_std = True 18 | save_vxstd = False 19 | series_tr = 20 | 21 | Traceback (most recent call last): 22 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/multiproc.py", line 52, in run_node 23 | result['result'] = node.run(updatehash=updatehash) 24 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 372, in run 25 | self._run_interface() 26 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 482, in _run_interface 27 | self._result = self._run_command(execute) 28 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 613, in _run_command 29 | result = self._interface.run() 30 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1083, in run 31 | runtime = self._run_wrapper(runtime) 32 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1031, in _run_wrapper 33 | runtime = self._run_interface(runtime) 34 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/algorithms/confounds.py", line 143, in _run_interface 35 | intensity_normalization=self.inputs.intensity_normalization) 36 | File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/algorithms/confounds.py", line 786, in compute_dvars 37 | 1)[:, 0] 38 | File "/usr/local/miniconda/lib/python3.6/site-packages/numpy/lib/shape_base.py", line 91, in apply_along_axis 39 | res = func1d(arr[tuple(i.tolist())], *args, **kwargs) 40 | IndexError: index 0 is out of bounds for axis 0 with size 0 41 | Interface ComputeDVARS failed to run. 42 | -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/CHANGES: -------------------------------------------------------------------------------- 1 | 2.0.1 2016-10-21 2 | 3 | - Added authors to dataset_discription.json 4 | 5 | 1.0.1 2016-02-18 6 | 7 | - Update orientation information in nifti header for improved left-right determination 8 | 9 | 10 | 1.0.0 2011-10-06 11 | 12 | - initial release 13 | -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/README: -------------------------------------------------------------------------------- 1 | This dataset was obtained from the OpenfMRI project (https://www.openfmri.org). 2 | Accession #: ds005 3 | Description: Mixed-gambles task 4 | 5 | Please cite the following references if you use these data: 6 | 7 | Tom, S.M., Fox, C.R., Trepel, C., Poldrack, R.A. (2007). The neural basis of loss aversion in decision-making under risk. Science, 315(5811):515-8 8 | 9 | 10 | Release history: 11 | 10/06/2011: initial release 12 | 3/21/2013: Updated release with QA information 13 | 2/18/2016: Update orientation information in nifti header for improved left-right determination 14 | 15 | This dataset is made available under the Public Domain Dedication and License 16 | v1.0, whose full text can be found at 17 | https://opendatacommons.org/licenses/pddl/1-0/. 18 | We hope that all users will follow the ODC Attribution/Share-Alike 19 | Community Norms (https://opendatacommons.org/norms/odc-by-sa/); 20 | in particular, while not legally required, we hope that all users 21 | of the data will acknowledge the OpenfMRI project and NSF Grant 22 | OCI-1131441 (R. Poldrack, PI) in any publications. 23 | -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/dataset_description.json: -------------------------------------------------------------------------------- 1 | { 2 | "BIDSVersion": "1.0.0rc4", 3 | "License": "This dataset is made available under the Public Domain Dedication and License \nv1.0, whose full text can be found at \nhttps://opendatacommons.org/licenses/pddl/1-0/. \nWe hope that all users will follow the ODC Attribution/Share-Alike \nCommunity Norms (https://opendatacommons.org/norms/odc-by-sa/); \nin particular, while not legally required, we hope that all users \nof the data will acknowledge the OpenfMRI project and NSF Grant \nOCI-1131441 (R. Poldrack, PI) in any publications.", 4 | "Name": "Mixed-gambles task", 5 | "Authors": ["Tom, S.M.", "Fox, C.R.", "Trepel, C.", "Poldrack, R.A."], 6 | "ReferencesAndLinks": "Tom, S.M., Fox, C.R., Trepel, C., Poldrack, R.A. (2007). The neural basis of loss aversion in decision-making under risk. Science, 315(5811):515-8" 7 | } 8 | -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/participants.tsv: -------------------------------------------------------------------------------- 1 | participant_id sex age 2 | sub-01 M 28 3 | sub-02 F 21 4 | sub-03 F 27 5 | sub-04 M 25 6 | sub-05 F 20 7 | sub-06 M 20 8 | sub-07 F 24 9 | sub-08 M 25 10 | sub-09 F 19 11 | sub-10 M 20 12 | sub-11 M 20 13 | sub-12 M 21 14 | sub-13 F 22 15 | sub-14 F 19 16 | sub-15 F 20 17 | sub-16 M 22 18 | -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/anat/sub-01_T1w.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/anat/sub-01_T1w.nii.gz -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/anat/sub-01_inplaneT2.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/anat/sub-01_inplaneT2.nii.gz -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-01_events.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-01_events.tsv -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-02_events.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-02_events.tsv -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-03_bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-03_bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-03_events.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/ds000005/sub-01/func/sub-01_task-mixedgamblestask_run-03_events.tsv -------------------------------------------------------------------------------- /fmriprep/data/tests/ds000005/task-mixedgamblestask_bold.json: -------------------------------------------------------------------------------- 1 | { 2 | "RepetitionTime": 2.0, 3 | "TaskName": "mixed-gambles task" 4 | } -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_acq-undistorted_desc-conform_T1w.html: -------------------------------------------------------------------------------- 1 |

Anatomical Conformation

2 |
    3 |
  • Input T1w images: 35
  • 4 |
  • Output orientation: RAS
  • 5 |
  • Output dimensions: 252x288x208
  • 6 |
  • Output voxel size: 0.8mm x 0.8mm x 0.8mm
  • 7 |
  • Discarded images: 0
  • 8 | 9 |
10 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_acq-undistorted_desc-reconall_T1w.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_acq-undistorted_dseg.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_acq-undistorted_space-MNI152NLin2009cAsym_T1w.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_desc-about_T1w.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • fMRIPrep version: 23.1.4
  • 3 |
  • fMRIPrep command: /opt/conda/envs/fmriprep/bin/fmriprep /data /out participant -w /work --bids-filter-file /filter_file_ses-044.json --skip_bids_validation --fs-subjects-dir /out/sourcedata/freesurfer --anat-derivatives /out --nprocs 4 --mem 55G --omp-nthreads 2 -vv
  • 4 |
  • Date preprocessed: 2023-11-25 13:40:50 -0800
  • 5 |
6 | 7 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_desc-conform_T1w.html: -------------------------------------------------------------------------------- 1 |

A previously computed T1w template was provided.

2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_desc-preproc_dseg.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_desc-reconall_T1w.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_desc-summary_T1w.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • Subject ID: 001
  • 3 |
  • Structural images: 1 T1-weighted
  • 4 |
  • Functional series: 4
  • 5 |
      6 |
    • Task: qct (4 runs)
    • 7 |
    8 |
  • Standard output spaces: MNI152NLin2009cAsym
  • 9 |
  • Non-standard output spaces:
  • 10 |
  • FreeSurfer reconstruction: Pre-existing directory
  • 11 |
12 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_dseg.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-bbregister_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-carpetplot_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-compcorvar_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-confoundcorr_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-rois_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-summary_bold.html: -------------------------------------------------------------------------------- 1 |
2 | Summary 3 |
    4 |
  • Original orientation: LAS
  • 5 |
  • Repetition time (TR): 1.6s
  • 6 |
  • Phase-encoding (PE) direction: Left-Right
  • 7 |
  • Multi-echo EPI sequence: 4 echoes.
  • 8 |
  • Slice timing correction: Applied
  • 9 |
  • Susceptibility distortion correction: None
  • 10 |
  • Registration: FreeSurfer bbregister (boundary-based registration, BBR) - 6 dof
  • 11 |
  • Non-steady-state volumes: 1
  • 12 |
13 |
14 |
15 | Confounds collected
16 |

global_signal, global_signal_derivative1, global_signal_derivative1_power2, global_signal_power2, csf, csf_derivative1, csf_power2, csf_derivative1_power2, white_matter, white_matter_derivative1, white_matter_derivative1_power2, white_matter_power2, csf_wm, tcompcor, std_dvars, dvars, framewise_displacement, rmsd, t_comp_cor_00, t_comp_cor_01, t_comp_cor_02, t_comp_cor_03, t_comp_cor_04, c_comp_cor_00, c_comp_cor_01, c_comp_cor_02, c_comp_cor_03, c_comp_cor_04, c_comp_cor_05, c_comp_cor_06, c_comp_cor_07, c_comp_cor_08, c_comp_cor_09, c_comp_cor_10, c_comp_cor_11, c_comp_cor_12, c_comp_cor_13, c_comp_cor_14, c_comp_cor_15, c_comp_cor_16, c_comp_cor_17, c_comp_cor_18, c_comp_cor_19, c_comp_cor_20, c_comp_cor_21, c_comp_cor_22, w_comp_cor_00, w_comp_cor_01, w_comp_cor_02, w_comp_cor_03, w_comp_cor_04, w_comp_cor_05, w_comp_cor_06, w_comp_cor_07, w_comp_cor_08, w_comp_cor_09, w_comp_cor_10, w_comp_cor_11, w_comp_cor_12, w_comp_cor_13, w_comp_cor_14, w_comp_cor_15, w_comp_cor_16, w_comp_cor_17, w_comp_cor_18, w_comp_cor_19, w_comp_cor_20, w_comp_cor_21, w_comp_cor_22, w_comp_cor_23, w_comp_cor_24, w_comp_cor_25, w_comp_cor_26, w_comp_cor_27, w_comp_cor_28, w_comp_cor_29, w_comp_cor_30, w_comp_cor_31, w_comp_cor_32, w_comp_cor_33, w_comp_cor_34, w_comp_cor_35, w_comp_cor_36, w_comp_cor_37, w_comp_cor_38, w_comp_cor_39, w_comp_cor_40, w_comp_cor_41, a_comp_cor_00, a_comp_cor_01, a_comp_cor_02, a_comp_cor_03, a_comp_cor_04, a_comp_cor_05, a_comp_cor_06, a_comp_cor_07, a_comp_cor_08, a_comp_cor_09, a_comp_cor_10, a_comp_cor_11, a_comp_cor_12, a_comp_cor_13, a_comp_cor_14, a_comp_cor_15, a_comp_cor_16, a_comp_cor_17, a_comp_cor_18, a_comp_cor_19, a_comp_cor_20, a_comp_cor_21, a_comp_cor_22, a_comp_cor_23, a_comp_cor_24, a_comp_cor_25, a_comp_cor_26, a_comp_cor_27, a_comp_cor_28, a_comp_cor_29, a_comp_cor_30, a_comp_cor_31, a_comp_cor_32, a_comp_cor_33, a_comp_cor_34, a_comp_cor_35, a_comp_cor_36, a_comp_cor_37, a_comp_cor_38, a_comp_cor_39, a_comp_cor_40, a_comp_cor_41, edge_comp_00, edge_comp_01, edge_comp_02, edge_comp_03, edge_comp_04, edge_comp_05, edge_comp_06, edge_comp_07, edge_comp_08, edge_comp_09, edge_comp_10, edge_comp_11, edge_comp_12, edge_comp_13, edge_comp_14, edge_comp_15, edge_comp_16, edge_comp_17, edge_comp_18, edge_comp_19, edge_comp_20, edge_comp_21, edge_comp_22, edge_comp_23, cosine00, non_steady_state_outlier00, trans_x, trans_x_derivative1, trans_x_power2, trans_x_derivative1_power2, trans_y, trans_y_derivative1, trans_y_power2, trans_y_derivative1_power2, trans_z, trans_z_derivative1, trans_z_power2, trans_z_derivative1_power2, rot_x, rot_x_derivative1, rot_x_power2, rot_x_derivative1_power2, rot_y, rot_y_derivative1, rot_y_derivative1_power2, rot_y_power2, rot_z, rot_z_derivative1, rot_z_power2, rot_z_derivative1_power2.

17 |
18 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-t2scomp_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-t2starhist_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-validation_bold.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-001_task-qct_dir-LR_part-mag_desc-validation_bold.html -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-bbregister_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-carpetplot_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-compcorvar_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-confoundcorr_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-rois_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-summary_bold.html: -------------------------------------------------------------------------------- 1 |
2 | Summary 3 |
    4 |
  • Original orientation: LAS
  • 5 |
  • Repetition time (TR): 1.6s
  • 6 |
  • Phase-encoding (PE) direction: Left-Right
  • 7 |
  • Multi-echo EPI sequence: 4 echoes.
  • 8 |
  • Slice timing correction: Applied
  • 9 |
  • Susceptibility distortion correction: None
  • 10 |
  • Registration: FreeSurfer bbregister (boundary-based registration, BBR) - 6 dof
  • 11 |
  • Non-steady-state volumes: 1
  • 12 |
13 |
14 |
15 | Confounds collected
16 |

global_signal, global_signal_derivative1, global_signal_power2, global_signal_derivative1_power2, csf, csf_derivative1, csf_power2, csf_derivative1_power2, white_matter, white_matter_derivative1, white_matter_power2, white_matter_derivative1_power2, csf_wm, tcompcor, std_dvars, dvars, framewise_displacement, rmsd, t_comp_cor_00, t_comp_cor_01, t_comp_cor_02, t_comp_cor_03, t_comp_cor_04, c_comp_cor_00, c_comp_cor_01, c_comp_cor_02, c_comp_cor_03, c_comp_cor_04, c_comp_cor_05, c_comp_cor_06, c_comp_cor_07, c_comp_cor_08, c_comp_cor_09, c_comp_cor_10, c_comp_cor_11, c_comp_cor_12, c_comp_cor_13, c_comp_cor_14, c_comp_cor_15, c_comp_cor_16, c_comp_cor_17, c_comp_cor_18, c_comp_cor_19, c_comp_cor_20, c_comp_cor_21, c_comp_cor_22, c_comp_cor_23, c_comp_cor_24, w_comp_cor_00, w_comp_cor_01, w_comp_cor_02, w_comp_cor_03, w_comp_cor_04, w_comp_cor_05, w_comp_cor_06, w_comp_cor_07, w_comp_cor_08, w_comp_cor_09, w_comp_cor_10, w_comp_cor_11, w_comp_cor_12, w_comp_cor_13, w_comp_cor_14, w_comp_cor_15, w_comp_cor_16, w_comp_cor_17, w_comp_cor_18, w_comp_cor_19, w_comp_cor_20, w_comp_cor_21, w_comp_cor_22, w_comp_cor_23, w_comp_cor_24, w_comp_cor_25, w_comp_cor_26, w_comp_cor_27, w_comp_cor_28, w_comp_cor_29, w_comp_cor_30, w_comp_cor_31, w_comp_cor_32, w_comp_cor_33, w_comp_cor_34, w_comp_cor_35, w_comp_cor_36, w_comp_cor_37, w_comp_cor_38, w_comp_cor_39, w_comp_cor_40, w_comp_cor_41, w_comp_cor_42, a_comp_cor_00, a_comp_cor_01, a_comp_cor_02, a_comp_cor_03, a_comp_cor_04, a_comp_cor_05, a_comp_cor_06, a_comp_cor_07, a_comp_cor_08, a_comp_cor_09, a_comp_cor_10, a_comp_cor_11, a_comp_cor_12, a_comp_cor_13, a_comp_cor_14, a_comp_cor_15, a_comp_cor_16, a_comp_cor_17, a_comp_cor_18, a_comp_cor_19, a_comp_cor_20, a_comp_cor_21, a_comp_cor_22, a_comp_cor_23, a_comp_cor_24, a_comp_cor_25, a_comp_cor_26, a_comp_cor_27, a_comp_cor_28, a_comp_cor_29, a_comp_cor_30, a_comp_cor_31, a_comp_cor_32, a_comp_cor_33, a_comp_cor_34, a_comp_cor_35, a_comp_cor_36, a_comp_cor_37, a_comp_cor_38, a_comp_cor_39, a_comp_cor_40, a_comp_cor_41, edge_comp_00, edge_comp_01, edge_comp_02, edge_comp_03, edge_comp_04, edge_comp_05, edge_comp_06, edge_comp_07, edge_comp_08, edge_comp_09, edge_comp_10, edge_comp_11, edge_comp_12, edge_comp_13, edge_comp_14, edge_comp_15, edge_comp_16, edge_comp_17, edge_comp_18, edge_comp_19, edge_comp_20, edge_comp_21, edge_comp_22, edge_comp_23, cosine00, non_steady_state_outlier00, trans_x, trans_x_derivative1, trans_x_derivative1_power2, trans_x_power2, trans_y, trans_y_derivative1, trans_y_power2, trans_y_derivative1_power2, trans_z, trans_z_derivative1, trans_z_power2, trans_z_derivative1_power2, rot_x, rot_x_derivative1, rot_x_derivative1_power2, rot_x_power2, rot_y, rot_y_derivative1, rot_y_power2, rot_y_derivative1_power2, rot_z, rot_z_derivative1, rot_z_power2, rot_z_derivative1_power2.

17 |
18 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-t2scomp_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-t2starhist_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-validation_bold.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-003_task-qct_dir-LR_part-mag_desc-validation_bold.html -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-bbregister_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-carpetplot_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-compcorvar_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-confoundcorr_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-rois_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-summary_bold.html: -------------------------------------------------------------------------------- 1 |
2 | Summary 3 |
    4 |
  • Original orientation: LAS
  • 5 |
  • Repetition time (TR): 1.6s
  • 6 |
  • Phase-encoding (PE) direction: Right-Left
  • 7 |
  • Multi-echo EPI sequence: 4 echoes.
  • 8 |
  • Slice timing correction: Applied
  • 9 |
  • Susceptibility distortion correction: None
  • 10 |
  • Registration: FreeSurfer bbregister (boundary-based registration, BBR) - 6 dof
  • 11 |
  • Non-steady-state volumes: 1
  • 12 |
13 |
14 |
15 | Confounds collected
16 |

global_signal, global_signal_derivative1, global_signal_derivative1_power2, global_signal_power2, csf, csf_derivative1, csf_power2, csf_derivative1_power2, white_matter, white_matter_derivative1, white_matter_derivative1_power2, white_matter_power2, csf_wm, tcompcor, std_dvars, dvars, framewise_displacement, rmsd, t_comp_cor_00, t_comp_cor_01, c_comp_cor_00, c_comp_cor_01, c_comp_cor_02, c_comp_cor_03, c_comp_cor_04, c_comp_cor_05, c_comp_cor_06, c_comp_cor_07, c_comp_cor_08, c_comp_cor_09, c_comp_cor_10, c_comp_cor_11, c_comp_cor_12, w_comp_cor_00, w_comp_cor_01, w_comp_cor_02, w_comp_cor_03, w_comp_cor_04, w_comp_cor_05, w_comp_cor_06, w_comp_cor_07, w_comp_cor_08, w_comp_cor_09, w_comp_cor_10, w_comp_cor_11, w_comp_cor_12, w_comp_cor_13, w_comp_cor_14, w_comp_cor_15, w_comp_cor_16, w_comp_cor_17, w_comp_cor_18, w_comp_cor_19, w_comp_cor_20, w_comp_cor_21, w_comp_cor_22, w_comp_cor_23, w_comp_cor_24, w_comp_cor_25, w_comp_cor_26, w_comp_cor_27, w_comp_cor_28, w_comp_cor_29, w_comp_cor_30, w_comp_cor_31, w_comp_cor_32, w_comp_cor_33, w_comp_cor_34, w_comp_cor_35, w_comp_cor_36, a_comp_cor_00, a_comp_cor_01, a_comp_cor_02, a_comp_cor_03, a_comp_cor_04, a_comp_cor_05, a_comp_cor_06, a_comp_cor_07, a_comp_cor_08, a_comp_cor_09, a_comp_cor_10, a_comp_cor_11, a_comp_cor_12, a_comp_cor_13, a_comp_cor_14, a_comp_cor_15, a_comp_cor_16, a_comp_cor_17, a_comp_cor_18, a_comp_cor_19, a_comp_cor_20, a_comp_cor_21, a_comp_cor_22, a_comp_cor_23, a_comp_cor_24, a_comp_cor_25, a_comp_cor_26, a_comp_cor_27, a_comp_cor_28, a_comp_cor_29, a_comp_cor_30, a_comp_cor_31, a_comp_cor_32, a_comp_cor_33, a_comp_cor_34, a_comp_cor_35, edge_comp_00, edge_comp_01, edge_comp_02, edge_comp_03, edge_comp_04, edge_comp_05, edge_comp_06, edge_comp_07, edge_comp_08, edge_comp_09, edge_comp_10, edge_comp_11, edge_comp_12, edge_comp_13, edge_comp_14, edge_comp_15, edge_comp_16, edge_comp_17, edge_comp_18, edge_comp_19, edge_comp_20, edge_comp_21, edge_comp_22, edge_comp_23, cosine00, non_steady_state_outlier00, trans_x, trans_x_derivative1, trans_x_derivative1_power2, trans_x_power2, trans_y, trans_y_derivative1, trans_y_derivative1_power2, trans_y_power2, trans_z, trans_z_derivative1, trans_z_power2, trans_z_derivative1_power2, rot_x, rot_x_derivative1, rot_x_derivative1_power2, rot_x_power2, rot_y, rot_y_derivative1, rot_y_power2, rot_y_derivative1_power2, rot_z, rot_z_derivative1, rot_z_power2, rot_z_derivative1_power2, motion_outlier00, motion_outlier01, motion_outlier02, motion_outlier03, motion_outlier04, motion_outlier05, motion_outlier06, motion_outlier07, motion_outlier08, motion_outlier09.

17 |
18 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-t2scomp_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-t2starhist_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-validation_bold.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-004_task-qct_dir-RL_part-mag_desc-validation_bold.html -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-bbregister_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-carpetplot_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-compcorvar_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-confoundcorr_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-rois_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-summary_bold.html: -------------------------------------------------------------------------------- 1 |
2 | Summary 3 |
    4 |
  • Original orientation: LAS
  • 5 |
  • Repetition time (TR): 1.6s
  • 6 |
  • Phase-encoding (PE) direction: Posterior-Anterior
  • 7 |
  • Multi-echo EPI sequence: 4 echoes.
  • 8 |
  • Slice timing correction: Applied
  • 9 |
  • Susceptibility distortion correction: None
  • 10 |
  • Registration: FreeSurfer bbregister (boundary-based registration, BBR) - 6 dof
  • 11 |
  • Non-steady-state volumes: 1
  • 12 |
13 |
14 |
15 | Confounds collected
16 |

global_signal, global_signal_derivative1, global_signal_power2, global_signal_derivative1_power2, csf, csf_derivative1, csf_power2, csf_derivative1_power2, white_matter, white_matter_derivative1, white_matter_power2, white_matter_derivative1_power2, csf_wm, tcompcor, std_dvars, dvars, framewise_displacement, rmsd, t_comp_cor_00, t_comp_cor_01, t_comp_cor_02, t_comp_cor_03, c_comp_cor_00, c_comp_cor_01, c_comp_cor_02, c_comp_cor_03, c_comp_cor_04, c_comp_cor_05, c_comp_cor_06, c_comp_cor_07, c_comp_cor_08, c_comp_cor_09, c_comp_cor_10, c_comp_cor_11, c_comp_cor_12, c_comp_cor_13, c_comp_cor_14, c_comp_cor_15, c_comp_cor_16, c_comp_cor_17, c_comp_cor_18, w_comp_cor_00, w_comp_cor_01, w_comp_cor_02, w_comp_cor_03, w_comp_cor_04, w_comp_cor_05, w_comp_cor_06, w_comp_cor_07, w_comp_cor_08, w_comp_cor_09, w_comp_cor_10, w_comp_cor_11, w_comp_cor_12, w_comp_cor_13, w_comp_cor_14, w_comp_cor_15, w_comp_cor_16, w_comp_cor_17, w_comp_cor_18, w_comp_cor_19, w_comp_cor_20, w_comp_cor_21, w_comp_cor_22, w_comp_cor_23, w_comp_cor_24, w_comp_cor_25, w_comp_cor_26, w_comp_cor_27, w_comp_cor_28, w_comp_cor_29, w_comp_cor_30, w_comp_cor_31, w_comp_cor_32, w_comp_cor_33, w_comp_cor_34, w_comp_cor_35, w_comp_cor_36, w_comp_cor_37, w_comp_cor_38, w_comp_cor_39, w_comp_cor_40, w_comp_cor_41, a_comp_cor_00, a_comp_cor_01, a_comp_cor_02, a_comp_cor_03, a_comp_cor_04, a_comp_cor_05, a_comp_cor_06, a_comp_cor_07, a_comp_cor_08, a_comp_cor_09, a_comp_cor_10, a_comp_cor_11, a_comp_cor_12, a_comp_cor_13, a_comp_cor_14, a_comp_cor_15, a_comp_cor_16, a_comp_cor_17, a_comp_cor_18, a_comp_cor_19, a_comp_cor_20, a_comp_cor_21, a_comp_cor_22, a_comp_cor_23, a_comp_cor_24, a_comp_cor_25, a_comp_cor_26, a_comp_cor_27, a_comp_cor_28, a_comp_cor_29, a_comp_cor_30, a_comp_cor_31, a_comp_cor_32, a_comp_cor_33, a_comp_cor_34, a_comp_cor_35, a_comp_cor_36, a_comp_cor_37, a_comp_cor_38, a_comp_cor_39, a_comp_cor_40, edge_comp_00, edge_comp_01, edge_comp_02, edge_comp_03, edge_comp_04, edge_comp_05, edge_comp_06, edge_comp_07, edge_comp_08, edge_comp_09, edge_comp_10, edge_comp_11, edge_comp_12, edge_comp_13, edge_comp_14, edge_comp_15, edge_comp_16, edge_comp_17, edge_comp_18, edge_comp_19, edge_comp_20, edge_comp_21, edge_comp_22, edge_comp_23, cosine00, non_steady_state_outlier00, trans_x, trans_x_derivative1, trans_x_derivative1_power2, trans_x_power2, trans_y, trans_y_derivative1, trans_y_derivative1_power2, trans_y_power2, trans_z, trans_z_derivative1, trans_z_power2, trans_z_derivative1_power2, rot_x, rot_x_derivative1, rot_x_power2, rot_x_derivative1_power2, rot_y, rot_y_derivative1, rot_y_power2, rot_y_derivative1_power2, rot_z, rot_z_derivative1, rot_z_derivative1_power2, rot_z_power2.

17 |
18 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-t2scomp_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-t2starhist_bold.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-validation_bold.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_ses-005_task-qct_dir-PA_part-mag_desc-validation_bold.html -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_space-MNI152NLin2009cAsym_T1w.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-001/figures/sub-001_space-MNI152NLin2009cAsym_desc-preproc_T1w.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-01/anat/sub-01_T1w_conform.html: -------------------------------------------------------------------------------- 1 |

Anatomical Conformation

2 |
    3 |
  • Input T1w images: 1
  • 4 |
  • Output orientation: RAS
  • 5 |
  • Output dimensions: 40x64x64
  • 6 |
  • Output voxel size: 4mm x 4mm x 4mm
  • 7 |
  • Discarded images: 0
  • 8 | 9 |
10 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-01/anat/sub-01_T1w_summary.html: -------------------------------------------------------------------------------- 1 |

Summary

2 |
    3 |
  • Structural images: 1
  • 4 |
  • FreeSurfer reconstruction: Pre-existing directory
  • 5 |
  • Output spaces: MNI152NLin2009cAsym, fsaverage5
  • 6 |
7 | -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold_validation.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/work/reportlets/fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-01_bold_validation.html -------------------------------------------------------------------------------- /fmriprep/data/tests/work/reportlets/fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold_validation.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/data/tests/work/reportlets/fmriprep/sub-01/func/sub-01_task-mixedgamblestask_run-02_bold_validation.html -------------------------------------------------------------------------------- /fmriprep/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | from niworkflows.interfaces.bids import DerivativesDataSink as _DDSink 4 | 5 | 6 | class DerivativesDataSink(_DDSink): 7 | out_path_base = '' 8 | 9 | 10 | __all__ = ('DerivativesDataSink',) 11 | -------------------------------------------------------------------------------- /fmriprep/interfaces/bids.py: -------------------------------------------------------------------------------- 1 | """BIDS-related interfaces.""" 2 | 3 | from pathlib import Path 4 | 5 | from bids.utils import listify 6 | from nipype.interfaces.base import ( 7 | DynamicTraitedSpec, 8 | SimpleInterface, 9 | TraitedSpec, 10 | isdefined, 11 | traits, 12 | ) 13 | from nipype.interfaces.io import add_traits 14 | from nipype.interfaces.utility.base import _ravel 15 | 16 | from ..utils.bids import _find_nearest_path 17 | 18 | 19 | class _BIDSURIInputSpec(DynamicTraitedSpec): 20 | dataset_links = traits.Dict(mandatory=True, desc='Dataset links') 21 | out_dir = traits.Str(mandatory=True, desc='Output directory') 22 | 23 | 24 | class _BIDSURIOutputSpec(TraitedSpec): 25 | out = traits.List( 26 | traits.Str, 27 | desc='BIDS URI(s) for file', 28 | ) 29 | 30 | 31 | class BIDSURI(SimpleInterface): 32 | """Convert input filenames to BIDS URIs, based on links in the dataset. 33 | 34 | This interface can combine multiple lists of inputs. 35 | """ 36 | 37 | input_spec = _BIDSURIInputSpec 38 | output_spec = _BIDSURIOutputSpec 39 | 40 | def __init__(self, numinputs=0, **inputs): 41 | super().__init__(**inputs) 42 | self._numinputs = numinputs 43 | if numinputs >= 1: 44 | input_names = [f'in{i + 1}' for i in range(numinputs)] 45 | else: 46 | input_names = [] 47 | add_traits(self.inputs, input_names) 48 | 49 | def _run_interface(self, runtime): 50 | inputs = [getattr(self.inputs, f'in{i + 1}') for i in range(self._numinputs)] 51 | in_files = listify(inputs) 52 | in_files = _ravel(in_files) 53 | # Remove undefined inputs 54 | in_files = [f for f in in_files if isdefined(f)] 55 | # Convert the dataset links to BIDS URI prefixes 56 | updated_keys = {f'bids:{k}:': Path(v) for k, v in self.inputs.dataset_links.items()} 57 | updated_keys['bids::'] = Path(self.inputs.out_dir) 58 | # Convert the paths to BIDS URIs 59 | out = [_find_nearest_path(updated_keys, f) for f in in_files] 60 | self._results['out'] = out 61 | 62 | return runtime 63 | -------------------------------------------------------------------------------- /fmriprep/interfaces/conftest.py: -------------------------------------------------------------------------------- 1 | from shutil import copytree 2 | 3 | import pytest 4 | 5 | from .tests.data import load 6 | 7 | try: 8 | from contextlib import chdir as _chdir 9 | except ImportError: # PY310 10 | import os 11 | from contextlib import contextmanager 12 | 13 | @contextmanager # type: ignore 14 | def _chdir(path): 15 | cwd = os.getcwd() 16 | os.chdir(path) 17 | try: 18 | yield 19 | finally: 20 | os.chdir(cwd) 21 | 22 | 23 | @pytest.fixture 24 | def data_dir(): 25 | with load.as_path() as data_dir: 26 | yield data_dir 27 | 28 | 29 | @pytest.fixture(autouse=True) 30 | def _docdir(request, tmp_path): 31 | # Trigger ONLY for the doctests. 32 | doctest_plugin = request.config.pluginmanager.getplugin('doctest') 33 | if isinstance(request.node, doctest_plugin.DoctestItem): 34 | with load.as_path() as data_dir: 35 | copytree(data_dir, tmp_path, dirs_exist_ok=True) 36 | 37 | # Chdir only for the duration of the test. 38 | with _chdir(tmp_path): 39 | yield 40 | 41 | else: 42 | # For normal tests, we have to yield, since this is a yield-fixture. 43 | yield 44 | -------------------------------------------------------------------------------- /fmriprep/interfaces/gifti.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | """Interfaces for manipulating GIFTI files.""" 4 | 5 | import os 6 | 7 | import nibabel as nb 8 | import numpy as np 9 | from nipype.interfaces.base import File, SimpleInterface, TraitedSpec, isdefined, traits 10 | 11 | 12 | class CreateROIInputSpec(TraitedSpec): 13 | subject_id = traits.Str(desc='subject ID') 14 | hemisphere = traits.Enum( 15 | 'L', 16 | 'R', 17 | mandatory=True, 18 | desc='hemisphere', 19 | ) 20 | thickness_file = File(exists=True, mandatory=True, desc='input GIFTI file') 21 | 22 | 23 | class CreateROIOutputSpec(TraitedSpec): 24 | roi_file = File(desc='output GIFTI file') 25 | 26 | 27 | class CreateROI(SimpleInterface): 28 | """Prepare GIFTI thickness file for use as a cortical ROI""" 29 | 30 | input_spec = CreateROIInputSpec 31 | output_spec = CreateROIOutputSpec 32 | 33 | def _run_interface(self, runtime): 34 | subject, hemi = self.inputs.subject_id, self.inputs.hemisphere 35 | if not isdefined(subject): 36 | subject = 'sub-XYZ' 37 | img = nb.GiftiImage.from_filename(self.inputs.thickness_file) 38 | # wb_command -set-structure 39 | img.meta['AnatomicalStructurePrimary'] = {'L': 'CortexLeft', 'R': 'CortexRight'}[hemi] 40 | darray = img.darrays[0] 41 | # wb_command -set-map-names 42 | meta = darray.meta 43 | meta['Name'] = f'{subject}_{hemi}_ROI' 44 | # wb_command -metric-palette calls have no effect on ROI files 45 | 46 | # Compiling an odd sequence of math operations that works out to: 47 | # wb_command -metric-math "abs(var * -1) > 0" 48 | roi = np.abs(darray.data) > 0 49 | 50 | # Divergence: Set datatype to uint8, since the values are boolean 51 | # wb_command sets datatype to float32 52 | darray = nb.gifti.GiftiDataArray( 53 | roi, 54 | intent=darray.intent, 55 | datatype='uint8', 56 | encoding=darray.encoding, 57 | endian=darray.endian, 58 | coordsys=darray.coordsys, 59 | ordering=darray.ind_ord, 60 | meta=meta, 61 | ) 62 | 63 | img.darrays[0] = darray 64 | 65 | out_filename = os.path.join(runtime.cwd, f'{subject}.{hemi}.roi.native.shape.gii') 66 | img.to_filename(out_filename) 67 | self._results['roi_file'] = out_filename 68 | return runtime 69 | -------------------------------------------------------------------------------- /fmriprep/interfaces/maths.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import numpy as np 4 | from nipype.interfaces.base import File, SimpleInterface, TraitedSpec, traits 5 | from nipype.utils.filemanip import fname_presuffix 6 | 7 | 8 | class ClipInputSpec(TraitedSpec): 9 | in_file = File(exists=True, mandatory=True, desc='Input imaging file') 10 | out_file = File(desc='Output file name') 11 | minimum = traits.Float( 12 | -np.inf, usedefault=True, desc='Values under minimum are set to minimum' 13 | ) 14 | maximum = traits.Float(np.inf, usedefault=True, desc='Values over maximum are set to maximum') 15 | 16 | 17 | class ClipOutputSpec(TraitedSpec): 18 | out_file = File(desc='Output file name') 19 | 20 | 21 | class Clip(SimpleInterface): 22 | """Simple clipping interface that clips values to specified minimum/maximum 23 | 24 | If no values are outside the bounds, nothing is done and the in_file is passed 25 | as the out_file without copying. 26 | """ 27 | 28 | input_spec = ClipInputSpec 29 | output_spec = ClipOutputSpec 30 | 31 | def _run_interface(self, runtime): 32 | import nibabel as nb 33 | 34 | img = nb.load(self.inputs.in_file) 35 | data = img.get_fdata() 36 | 37 | out_file = self.inputs.out_file 38 | if out_file: 39 | out_file = os.path.join(runtime.cwd, out_file) 40 | 41 | if np.any((data < self.inputs.minimum) | (data > self.inputs.maximum)): 42 | if not out_file: 43 | out_file = fname_presuffix( 44 | self.inputs.in_file, suffix='_clipped', newpath=runtime.cwd 45 | ) 46 | np.clip(data, self.inputs.minimum, self.inputs.maximum, out=data) 47 | img.__class__(data, img.affine, img.header).to_filename(out_file) 48 | elif not out_file: 49 | out_file = self.inputs.in_file 50 | 51 | self._results['out_file'] = out_file 52 | return runtime 53 | 54 | 55 | class Label2MaskInputSpec(TraitedSpec): 56 | in_file = File(exists=True, mandatory=True, desc='Input label file') 57 | label_val = traits.Int(mandatory=True, dec='Label value to create mask from') 58 | 59 | 60 | class Label2MaskOutputSpec(TraitedSpec): 61 | out_file = File(desc='Output file name') 62 | 63 | 64 | class Label2Mask(SimpleInterface): 65 | """Create mask file for a label from a multi-label segmentation""" 66 | 67 | input_spec = Label2MaskInputSpec 68 | output_spec = Label2MaskOutputSpec 69 | 70 | def _run_interface(self, runtime): 71 | import nibabel as nb 72 | 73 | img = nb.load(self.inputs.in_file) 74 | 75 | mask = np.uint16(img.dataobj) == self.inputs.label_val 76 | out_img = img.__class__(mask, img.affine, img.header) 77 | out_img.set_data_dtype(np.uint8) 78 | 79 | out_file = fname_presuffix(self.inputs.in_file, suffix='_mask', newpath=runtime.cwd) 80 | 81 | out_img.to_filename(out_file) 82 | 83 | self._results['out_file'] = out_file 84 | return runtime 85 | -------------------------------------------------------------------------------- /fmriprep/interfaces/multiecho.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """ 24 | Multi-echo EPI 25 | ~~~~~~~~~~~~~~ 26 | 27 | For using multi-echo EPI data. 28 | 29 | """ 30 | 31 | import os 32 | 33 | from nipype import logging 34 | from nipype.interfaces.base import ( 35 | CommandLine, 36 | CommandLineInputSpec, 37 | File, 38 | TraitedSpec, 39 | traits, 40 | ) 41 | 42 | LOGGER = logging.getLogger('nipype.interface') 43 | 44 | 45 | class T2SMapInputSpec(CommandLineInputSpec): 46 | in_files = traits.List( 47 | File(exists=True), 48 | argstr='-d %s', 49 | position=1, 50 | mandatory=True, 51 | minlen=3, 52 | desc='multi-echo BOLD EPIs', 53 | ) 54 | echo_times = traits.List( 55 | traits.Float, argstr='-e %s', position=2, mandatory=True, minlen=3, desc='echo times' 56 | ) 57 | mask_file = File(argstr='--mask %s', position=3, desc='mask file', exists=True) 58 | fittype = traits.Enum( 59 | 'curvefit', 60 | 'loglin', 61 | argstr='--fittype %s', 62 | position=4, 63 | usedefault=True, 64 | desc=( 65 | 'Desired fitting method: ' 66 | '"loglin" means that a linear model is fit to the log of the data. ' 67 | '"curvefit" means that a more computationally demanding ' 68 | 'monoexponential model is fit to the raw data.' 69 | ), 70 | ) 71 | 72 | 73 | class T2SMapOutputSpec(TraitedSpec): 74 | t2star_map = File(exists=True, desc='limited T2* map') 75 | s0_map = File(exists=True, desc='limited S0 map') 76 | optimal_comb = File(exists=True, desc='optimally combined ME-EPI time series') 77 | 78 | 79 | class T2SMap(CommandLine): 80 | """ 81 | Runs the tedana T2* workflow to generate an adaptive T2* map and create 82 | an optimally combined ME-EPI time series. 83 | 84 | Example 85 | ======= 86 | 87 | >>> from fmriprep.interfaces import multiecho 88 | >>> t2smap = multiecho.T2SMap() 89 | >>> t2smap.inputs.in_files = ['sub-01_run-01_echo-1_bold.nii.gz', 90 | ... 'sub-01_run-01_echo-2_bold.nii.gz', 91 | ... 'sub-01_run-01_echo-3_bold.nii.gz'] 92 | >>> t2smap.inputs.echo_times = [0.013, 0.027, 0.043] 93 | >>> t2smap.cmdline # doctest: +ELLIPSIS 94 | 't2smap -d sub-01_run-01_echo-1_bold.nii.gz sub-01_run-01_echo-2_bold.nii.gz \ 95 | sub-01_run-01_echo-3_bold.nii.gz -e 13.0 27.0 43.0 --fittype curvefit' 96 | 97 | """ 98 | 99 | _cmd = 't2smap' 100 | input_spec = T2SMapInputSpec 101 | output_spec = T2SMapOutputSpec 102 | 103 | def _format_arg(self, name, trait_spec, value): 104 | if name == 'echo_times': 105 | value = [te * 1000 for te in value] 106 | return super()._format_arg(name, trait_spec, value) 107 | 108 | def _list_outputs(self): 109 | outputs = self._outputs().get() 110 | out_dir = os.getcwd() 111 | outputs['t2star_map'] = os.path.join(out_dir, 'T2starmap.nii.gz') 112 | outputs['s0_map'] = os.path.join(out_dir, 'S0map.nii.gz') 113 | outputs['optimal_comb'] = os.path.join(out_dir, 'desc-optcom_bold.nii.gz') 114 | return outputs 115 | -------------------------------------------------------------------------------- /fmriprep/interfaces/nitransforms.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright 2025 The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Wrappers of NiTransforms.""" 24 | 25 | from pathlib import Path 26 | 27 | from nipype.interfaces.base import ( 28 | BaseInterfaceInputSpec, 29 | File, 30 | SimpleInterface, 31 | TraitedSpec, 32 | traits, 33 | ) 34 | from nipype.utils.filemanip import fname_presuffix 35 | 36 | 37 | class _ConvertAffineInputSpec(BaseInterfaceInputSpec): 38 | in_xfm = File(exists=True, desc='input transform piles') 39 | inverse = traits.Bool(False, usedefault=True, desc='generate inverse') 40 | in_fmt = traits.Enum('auto', 'itk', 'fs', 'fsl', usedefault=True, desc='input format') 41 | out_fmt = traits.Enum('itk', 'fs', 'fsl', usedefault=True, desc='output format') 42 | reference = File(exists=True, desc='reference file') 43 | moving = File(exists=True, desc='moving file') 44 | 45 | 46 | class _ConvertAffineOutputSpec(TraitedSpec): 47 | out_xfm = File(exists=True, desc='output, combined transform') 48 | out_inv = File(desc='output, combined transform') 49 | 50 | 51 | class ConvertAffine(SimpleInterface): 52 | """Write a single, flattened transform file.""" 53 | 54 | input_spec = _ConvertAffineInputSpec 55 | output_spec = _ConvertAffineOutputSpec 56 | 57 | def _run_interface(self, runtime): 58 | from nitransforms.linear import load as load_affine 59 | 60 | ext = { 61 | 'fs': 'lta', 62 | 'itk': 'txt', 63 | 'fsl': 'mat', 64 | }[self.inputs.out_fmt] 65 | 66 | in_fmt = self.inputs.in_fmt 67 | if in_fmt == 'auto': 68 | in_fmt = { 69 | '.lta': 'fs', 70 | '.mat': 'fsl', 71 | '.txt': 'itk', 72 | }[Path(self.inputs.in_xfm).suffix] 73 | 74 | reference = self.inputs.reference or None 75 | moving = self.inputs.moving or None 76 | affine = load_affine(self.inputs.in_xfm, fmt=in_fmt, reference=reference, moving=moving) 77 | 78 | out_file = fname_presuffix( 79 | self.inputs.in_xfm, 80 | suffix=f'_fwd.{ext}', 81 | newpath=runtime.cwd, 82 | use_ext=False, 83 | ) 84 | self._results['out_xfm'] = out_file 85 | affine.to_filename(out_file, moving=moving, fmt=self.inputs.out_fmt) 86 | 87 | if self.inputs.inverse: 88 | inv_affine = ~affine 89 | if moving is not None: 90 | inv_affine.reference = moving 91 | 92 | out_inv = fname_presuffix( 93 | self.inputs.in_xfm, 94 | suffix=f'_inv.{ext}', 95 | newpath=runtime.cwd, 96 | use_ext=False, 97 | ) 98 | self._results['out_inv'] = out_inv 99 | inv_affine.to_filename(out_inv, moving=reference, fmt=self.inputs.out_fmt) 100 | 101 | return runtime 102 | -------------------------------------------------------------------------------- /fmriprep/interfaces/patches.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """ 24 | Temporary patches 25 | ----------------- 26 | 27 | """ 28 | 29 | from random import randint 30 | from time import sleep 31 | 32 | import nipype.interfaces.freesurfer as fs 33 | import nipype.interfaces.io as nio 34 | from nipype.algorithms import confounds as nac 35 | from nipype.interfaces.base import File, traits 36 | from numpy.linalg.linalg import LinAlgError 37 | 38 | 39 | class RobustACompCor(nac.ACompCor): 40 | """ 41 | Runs aCompCor several times if it suddenly fails with 42 | https://github.com/nipreps/fmriprep/issues/776 43 | 44 | """ 45 | 46 | def _run_interface(self, runtime): 47 | failures = 0 48 | while True: 49 | try: 50 | runtime = super()._run_interface(runtime) 51 | break 52 | except LinAlgError: 53 | failures += 1 54 | if failures > 10: 55 | raise 56 | start = (failures - 1) * 10 57 | sleep(randint(start + 4, start + 10)) 58 | 59 | return runtime 60 | 61 | 62 | class RobustTCompCor(nac.TCompCor): 63 | """ 64 | Runs tCompCor several times if it suddenly fails with 65 | https://github.com/nipreps/fmriprep/issues/940 66 | 67 | """ 68 | 69 | def _run_interface(self, runtime): 70 | failures = 0 71 | while True: 72 | try: 73 | runtime = super()._run_interface(runtime) 74 | break 75 | except LinAlgError: 76 | failures += 1 77 | if failures > 10: 78 | raise 79 | start = (failures - 1) * 10 80 | sleep(randint(start + 4, start + 10)) 81 | 82 | return runtime 83 | 84 | 85 | class _MRICoregInputSpec(fs.registration.MRICoregInputSpec): 86 | reference_file = File( 87 | argstr='--ref %s', 88 | desc='reference (target) file', 89 | copyfile=False, 90 | ) 91 | subject_id = traits.Str( 92 | argstr='--s %s', 93 | position=1, 94 | requires=['subjects_dir'], 95 | desc='freesurfer subject ID (implies ``reference_mask == ' 96 | 'aparc+aseg.mgz`` unless otherwise specified)', 97 | ) 98 | 99 | 100 | class MRICoreg(fs.MRICoreg): 101 | """ 102 | Patched that allows setting both a reference file and the subjects dir. 103 | """ 104 | 105 | input_spec = _MRICoregInputSpec 106 | 107 | 108 | class _FSSourceOutputSpec(nio.FSSourceOutputSpec): 109 | T2 = File(desc='Intensity normalized whole-head volume', loc='mri') 110 | 111 | 112 | class FreeSurferSource(nio.FreeSurferSource): 113 | """ 114 | Patch to allow grabbing the T2 volume, if available 115 | """ 116 | 117 | output_spec = _FSSourceOutputSpec 118 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/__init__.py -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/__init__.py: -------------------------------------------------------------------------------- 1 | from acres import Loader 2 | 3 | load = Loader(__spec__.name) 4 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/component_metadata_filtered.tsv: -------------------------------------------------------------------------------- 1 | component mask singular_value variance_explained cumulative_variance_explained retained 2 | a_comp_cor_00 CSF 303.3879065215 0.0822378515 0.0822378515 True 3 | a_comp_cor_01 CSF 265.3127089823 0.0628914102 0.1451292617 True 4 | a_comp_cor_02 CSF 246.9403411402 0.0544827867 0.1996120484 True 5 | a_comp_cor_03 CSF 230.7904478523 0.0475894718 0.2472015202 True 6 | a_comp_cor_04 CSF 204.1002458456 0.0372187926 0.2844203128 True 7 | a_comp_cor_05 CSF 191.4965421158 0.0327640136 0.3171843264 True 8 | a_comp_cor_06 CSF 164.3946836008 0.0241463095 0.3413306359 True 9 | a_comp_cor_07 CSF 163.0617292465 0.023756328 0.3650869639 True 10 | a_comp_cor_08 CSF 155.6055929068 0.0216334423 0.3867204062 True 11 | a_comp_cor_09 CSF 142.6779990644 0.0181881801 0.4049085863 True 12 | a_comp_cor_10 CSF 132.7833535167 0.0157529716 0.4206615579 True 13 | a_comp_cor_11 CSF 125.5448815801 0.0140822888 0.4347438468 True 14 | a_comp_cor_12 CSF 114.4560888929 0.0117045044 0.4464483511 True 15 | a_comp_cor_13 CSF 109.7800169819 0.0107676719 0.457216023 True 16 | a_comp_cor_14 CSF 98.9016427614 0.0087394124 0.4659554354 True 17 | a_comp_cor_15 CSF 95.592760075 0.0081644179 0.4741198534 True 18 | a_comp_cor_16 CSF 93.2993710837 0.0077773682 0.4818972215 True 19 | a_comp_cor_17 CSF 89.7572859278 0.0071980465 0.489095268 True 20 | a_comp_cor_18 CSF 85.4637024159 0.0065258732 0.4956211413 True 21 | a_comp_cor_19 CSF 83.3739078155 0.0062106283 0.5018317696 True 22 | a_comp_cor_20 WM 195.3633011611 0.0249509989 0.0249509989 True 23 | a_comp_cor_21 WM 152.0507341632 0.0151139858 0.0400649847 True 24 | a_comp_cor_22 WM 143.1829225994 0.0134024567 0.0534674414 True 25 | a_comp_cor_23 WM 119.7135045391 0.0093688925 0.0628363339 True 26 | a_comp_cor_24 WM 110.7818275484 0.0080230411 0.070859375 True 27 | a_comp_cor_25 WM 100.5105167828 0.0066042724 0.0774636474 True 28 | a_comp_cor_26 WM 94.344414343 0.0058188124 0.0832824598 True 29 | a_comp_cor_27 WM 92.150833289 0.0055513742 0.0888338339 True 30 | a_comp_cor_28 WM 90.5254087866 0.0053572629 0.0941910968 True 31 | a_comp_cor_29 WM 88.523526571 0.0051229413 0.0993140381 True 32 | a_comp_cor_30 WM 86.0931701872 0.0048455086 0.1041595467 True 33 | a_comp_cor_31 WM 84.7990437222 0.004700931 0.1088604777 True 34 | a_comp_cor_32 WM 83.3114198348 0.0045374415 0.1133979192 True 35 | a_comp_cor_33 WM 81.0694160734 0.0042965123 0.1176944314 True 36 | a_comp_cor_34 WM 80.4668446429 0.0042328795 0.121927311 True 37 | a_comp_cor_35 WM 79.4022991891 0.0041216217 0.1260489326 True 38 | a_comp_cor_36 WM 78.1613446177 0.0039937972 0.1300427299 True 39 | a_comp_cor_37 WM 77.3254517928 0.003908831 0.1339515609 True 40 | a_comp_cor_38 WM 77.0534117377 0.003881376 0.1378329369 True 41 | a_comp_cor_39 WM 76.2953999669 0.0038053856 0.1416383225 True 42 | a_comp_cor_169 combined 198.9777037853 0.0252962205 0.0252962205 True 43 | a_comp_cor_170 combined 154.343866075 0.0152203822 0.0405166027 True 44 | a_comp_cor_171 combined 144.8823205662 0.0134115075 0.0539281102 True 45 | a_comp_cor_172 combined 120.8445698188 0.0093304178 0.063258528 True 46 | a_comp_cor_173 combined 112.8109339075 0.0081310981 0.071389626 True 47 | a_comp_cor_174 combined 103.1053103638 0.0067921752 0.0781818012 True 48 | a_comp_cor_175 combined 101.536218232 0.0065870169 0.0847688181 True 49 | a_comp_cor_176 combined 94.2588177592 0.0056766326 0.0904454507 True 50 | a_comp_cor_177 combined 92.4469798367 0.0054604982 0.0959059488 True 51 | a_comp_cor_178 combined 91.5242270524 0.005352035 0.1012579839 True 52 | a_comp_cor_179 combined 89.1481999125 0.0050777576 0.1063357415 True 53 | a_comp_cor_180 combined 86.0081616799 0.0047263528 0.1110620943 True 54 | a_comp_cor_181 combined 84.3147231404 0.0045420681 0.1156041625 True 55 | a_comp_cor_182 combined 83.821614868 0.0044890956 0.1200932581 True 56 | a_comp_cor_183 combined 81.5457945837 0.0042486401 0.1243418982 True 57 | a_comp_cor_184 combined 80.7942317719 0.0041706863 0.1285125845 True 58 | a_comp_cor_185 combined 78.7768936096 0.0039650121 0.1324775965 True 59 | a_comp_cor_186 combined 77.8233137548 0.0038696015 0.1363471981 True 60 | a_comp_cor_187 combined 77.7936337977 0.0038666506 0.1402138486 True 61 | a_comp_cor_188 combined 77.0694477923 0.0037949958 0.1440088445 True 62 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/lh.bold.func.gii: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/lh.bold.func.gii -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/lh.midthickness.surf.gii: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/lh.midthickness.surf.gii -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/lh.pial.surf.gii: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/lh.pial.surf.gii -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/lh.roi.shape.gii: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/lh.roi.shape.gii -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/lh.white.surf.gii: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/lh.white.surf.gii -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/mri_coreg-c3d-invert.txt: -------------------------------------------------------------------------------- 1 | #Insight Transform File V1.0 2 | #Transform 0 3 | Transform: MatrixOffsetTransformBase_double_3_3 4 | Parameters: 0.9999895968880486 -0.004093655352697662 -0.0020605942003409524 0.004033765542180662 0.9995917628463604 -0.028289559719570527 0.0021755887788865217 0.028280980403387748 0.9995979209696005 -0.31051619074750103 -0.7081012785638218 0.4403933958178312 5 | FixedParameters: 0 0 0 6 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/mri_coreg-c3d.txt: -------------------------------------------------------------------------------- 1 | #Insight Transform File V1.0 2 | #Transform 0 3 | Transform: MatrixOffsetTransformBase_double_3_3 4 | Parameters: 0.9999893987506181 0.0040337317156719996 0.0021755595966243754 -0.00409368802815685 0.999591499554368 0.02828093916460761 -0.0020606207364131553 -0.028289577997839488 0.9995973713325053 0.3124110873946151 0.6940861236277449 -0.4608878232636471 5 | FixedParameters: 0 0 0 6 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/mri_coreg-lta_convert-invert.txt: -------------------------------------------------------------------------------- 1 | #Insight Transform File V1.0 2 | #Transform 0 3 | Transform: AffineTransform_double_3_3 4 | Parameters: 0.99998968839645386 -0.0040936507284641266 -0.0020606310572475195 0.0040338016115128994 0.99959170818328857 -0.028289616107940674 0.0021755544003099203 0.028280943632125854 0.99959772825241089 -0.31053543090820312 -0.70811450481414795 0.440399169921875 5 | FixedParameters: 0 0 0 6 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/mri_coreg-lta_convert.mat: -------------------------------------------------------------------------------- 1 | 0.99994755 0.00549713 -0.00865372 -5.78189802 2 | -0.00323471 0.97014636 0.24249923 -15.33529091 3 | 0.00972842 -0.24245842 0.97011328 103.01686096 4 | 0.00000000 0.00000000 0.00000000 1.00000000 5 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/mri_coreg-lta_convert.txt: -------------------------------------------------------------------------------- 1 | #Insight Transform File V1.0 2 | #Transform 0 3 | Transform: AffineTransform_double_3_3 4 | Parameters: 0.99998933076858521 0.0040337261743843555 0.002175597008317709 -0.0040937233716249466 0.99959152936935425 0.028281001374125481 -0.0020605858881026506 -0.028289547190070152 0.99959754943847656 0.31243029236793518 0.69409912824630737 -0.46089404821395874 5 | FixedParameters: 0 0 0 6 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/mri_coreg.lta: -------------------------------------------------------------------------------- 1 | # transform file /scratch/fmriprep_25_0_wf/sub_pixar008_wf/bold_task_pixar_wf/bold_fit_wf/bold_reg_wf/fsl_bbr_wf/mri_coreg/registration.lta 2 | # created by UNKNOWN on Tue May 6 19:47:02 2025 3 | 4 | type = 0 # LINEAR_VOX_TO_VOX 5 | nxforms = 1 6 | mean = 0.0000 0.0000 0.0000 7 | sigma = 10000.0000 8 | 1 4 4 9 | -2.999843597412109e+00 -1.649146154522896e-02 2.855729311704636e-02 1.807819366455078e+02 10 | -9.704081341624260e-03 2.910438776016235e+00 8.002470731735229e-01 -1.533527374267578e+01 11 | 2.918521128594875e-02 -7.273750305175781e-01 3.201372861862183e+00 1.030168457031250e+02 12 | -0.000000000000000e+00 -0.000000000000000e+00 -0.000000000000000e+00 1.000000000000000e+00 13 | src volume info 14 | valid = 1 # volume info valid 15 | filename = /scratch/fmriprep_25_0_wf/sub_pixar008_wf/bold_task_pixar_wf/bold_fit_wf/bold_reg_wf/fsl_bbr_wf/mri_coreg/sub-pixar008_task-pixar_desc-coreg_boldref.nii.gz 16 | volume = 64 64 32 17 | voxelsize = 3.000000000000000e+00 3.000000000000000e+00 3.299998998641968e+00 18 | xras = -9.774558544158936e-01 -1.631658673286438e-01 -1.340035498142242e-01 19 | yras = -1.963588446378708e-01 9.357714056968689e-01 2.928739190101624e-01 20 | zras = -7.760965824127197e-02 -3.125841021537781e-01 9.467142820358276e-01 21 | cras = -3.339492797851562e+00 1.919434738159180e+01 -1.671367645263672e+01 22 | dst volume info 23 | valid = 1 # volume info valid 24 | filename = /scratch/fmriprep_25_0_wf/sub_pixar008_wf/bold_task_pixar_wf/bold_fit_wf/bold_reg_wf/fsl_bbr_wf/mri_coreg/sub-pixar008_desc-preproc_T1w_masked.nii.gz 25 | volume = 176 192 192 26 | voxelsize = 9.999998211860657e-01 1.000000000000000e+00 1.000000000000000e+00 27 | xras = 9.774559140205383e-01 1.631659567356110e-01 1.340029984712601e-01 28 | yras = -2.085019201040268e-01 8.459347486495972e-01 4.908373951911926e-01 29 | zras = -3.326984494924545e-02 -5.077117681503296e-01 8.608843684196472e-01 30 | cras = 7.209014892578125e-02 4.299778366088867e+01 -4.446340942382812e+01 31 | subject unknown 32 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-01_run-01_echo-1_bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/sub-01_run-01_echo-1_bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-01_run-01_echo-2_bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/sub-01_run-01_echo-2_bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-01_run-01_echo-3_bold.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/sub-01_run-01_echo-3_bold.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-01_task-mixedgamblestask_run-01_desc-hmc_boldref.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/sub-01_task-mixedgamblestask_run-01_desc-hmc_boldref.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-01_task-mixedgamblestask_run-01_desc-motion_timeseries.tsv: -------------------------------------------------------------------------------- 1 | trans_x trans_y trans_z rot_x rot_y rot_z framewise_displacement rmsd 2 | 1.19425e-05 0.0443863 0.00472985 0.000356176 -0.000617445 0.0 n/a n/a 3 | -2.57666e-05 0.0463662 0.0623273 -0.000208795 -0.00012937 0.0 0.1122673591 0.0725718 4 | -2.64055e-05 -0.00438628 0.067513 -2.59508e-05 -0.00012937 0.000173904 0.0737762289 0.0527961 5 | 0.0161645 -0.0226134 0.0630764 -2.59508e-05 -0.000199844 0.000279081 0.0476371754999999 0.0260938 6 | 0.0161497 -0.0263834 0.0464668 0.000161259 -0.00012937 0.000573335 0.04799129 0.0257898 7 | 0.0161482 -0.0226144 0.0345415 6.52323e-05 -7.276439999999998e-05 0.000573335 0.023327415 0.0131254 8 | 0.0121946 -0.00426109 0.0671039 -2.59508e-05 -0.00012937 0.000312581 0.075296445 0.0410418 9 | 0.0121556 -0.0175135 0.04042 -2.59508e-05 -0.00012937 0.000166363 0.04728621 0.0306652 10 | 0.0126526 -0.000813328 0.0778061 -2.59508e-05 -0.00012937 0.000166363 0.054583272 0.0409495 11 | 0.012614 0.0250656 0.106248 -0.000320333 0.000149271 0.000166363 0.0830105879999999 0.0452599 12 | 0.0126599 -0.0252459 0.0731423999999999 2.99512e-05 -0.000204037 0.000166363 0.11864261 0.0669517 13 | -0.00608005 0.0349207 0.110289 -0.000485119 -0.00012937 8.57718e-05 0.1495695699999999 0.0801947999999999 14 | -0.00607796 -0.00933714 0.0796319999999999 -0.000126125 -0.00012937 0.000166363 0.09689619 0.0586617 15 | 0.0124531 0.00996903 0.0986678 -0.000266813 -0.000207949 0.000166363 0.06783638 0.0343961 16 | 0.010915 -0.00933714 0.0986667 -0.000126125 -0.000248281 0.000166363 0.02989637 0.0208872 17 | 0.0119349 0.00531637 0.0808524 -0.000209587 -0.0 0.000226933 0.0531033599999999 0.0263331 18 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-01_task-mixedgamblestask_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt: -------------------------------------------------------------------------------- 1 | #Insight Transform File V1.0 2 | #Transform 0 3 | Transform: AffineTransform_float_3_3 4 | Parameters: 1 2.19652e-07 -0.000617 2.19652e-07 1 0.000356 0.000617 -0.000356 0.999999 -0.0198273 0.0558417 -0.00925011 5 | FixedParameters: 0 0 0 6 | 7 | #Transform 1 8 | Transform: AffineTransform_float_3_3 9 | Parameters: 1 -2.6961e-08 -0.000129 -2.6961e-08 1 -0.000209 0.000129 0.000209 1 -0.00408853 0.0396441 -0.0579032 10 | FixedParameters: 0 0 0 11 | 12 | #Transform 2 13 | Transform: AffineTransform_float_3_3 14 | Parameters: 1 0.000173997 -0.000129005 -0.000174003 1 -2.59776e-05 0.000128995 2.60224e-05 1 -0.000785439 -0.00589913 -0.0665673 15 | FixedParameters: 0 0 0 16 | 17 | #Transform 3 18 | Transform: AffineTransform_float_3_3 19 | Parameters: 1 0.000278995 -0.000200007 -0.000279005 1 -2.59442e-05 0.000199993 2.60558e-05 1 -0.0172875 -0.0245076 -0.0618151 20 | FixedParameters: 0 0 0 21 | 22 | #Transform 4 23 | Transform: AffineTransform_float_3_3 24 | Parameters: 1 0.000573021 -0.000128908 -0.000572979 1 0.000161074 0.000129092 -0.000160926 1 -0.00936206 -0.0233705 -0.0490914 25 | FixedParameters: 0 0 0 26 | 27 | #Transform 5 28 | Transform: AffineTransform_float_3_3 29 | Parameters: 1 0.000573005 -7.29627e-05 -0.000572995 1 6.50418e-05 7.30372e-05 -6.49581e-05 1 -0.0076044 -0.0226739 -0.0354961 30 | FixedParameters: 0 0 0 31 | 32 | #Transform 6 33 | Transform: AffineTransform_float_3_3 34 | Parameters: 1 0.000312997 -0.000129008 -0.000313003 1 -2.59596e-05 0.000128992 2.60404e-05 1 -0.0103974 -0.00632903 -0.0661615 35 | FixedParameters: 0 0 0 36 | 37 | #Transform 7 38 | Transform: AffineTransform_float_3_3 39 | Parameters: 1 0.000165997 -0.000129004 -0.000166003 1 -2.59786e-05 0.000128996 2.60214e-05 1 -0.0130841 -0.0189498 -0.0394762 40 | FixedParameters: 0 0 0 41 | 42 | #Transform 8 43 | Transform: AffineTransform_float_3_3 44 | Parameters: 1 0.000165997 -0.000129004 -0.000166003 1 -2.59786e-05 0.000128996 2.60214e-05 1 -0.0135735 -0.00224875 -0.0768618 45 | FixedParameters: 0 0 0 46 | 47 | #Transform 9 48 | Transform: AffineTransform_float_3_3 49 | Parameters: 1 0.000166048 0.000148947 -0.000165952 1 -0.000320025 -0.000149053 0.000319975 1 -0.00466364 0.014244 -0.100674 50 | FixedParameters: 0 0 0 51 | 52 | #Transform 10 53 | Transform: AffineTransform_float_3_3 54 | Parameters: 1 0.000166006 -0.000203995 -0.000165994 1 3.00339e-05 0.000204005 -2.99661e-05 1 -0.0160123 -0.0248835 -0.0729365 55 | FixedParameters: 0 0 0 56 | 57 | #Transform 11 58 | Transform: AffineTransform_float_3_3 59 | Parameters: 1 8.59374e-05 -0.000129042 -8.60625e-05 1 -0.000484989 0.000128958 0.000485011 1 0.00358861 0.0190405 -0.100594 60 | FixedParameters: 0 0 0 61 | 62 | #Transform 12 63 | Transform: AffineTransform_float_3_3 64 | Parameters: 1 0.000165984 -0.000129021 -0.000166016 1 -0.000125979 0.000128979 0.000126021 1 0.00515558 -0.0139722 -0.0767701 65 | FixedParameters: 0 0 0 66 | 67 | #Transform 13 68 | Transform: AffineTransform_float_3_3 69 | Parameters: 1 0.000165944 -0.000208044 -0.000166056 1 -0.000266965 0.000207956 0.000267034 1 -0.0159206 0.000794425 -0.0928171 70 | FixedParameters: 0 0 0 71 | 72 | #Transform 14 73 | Transform: AffineTransform_float_3_3 74 | Parameters: 1 0.000165969 -0.000248021 -0.000166031 1 -0.000125959 0.000247979 0.000126041 1 -0.0156607 -0.0139734 -0.0953506 75 | FixedParameters: 0 0 0 76 | 77 | #Transform 15 78 | Transform: AffineTransform_float_3_3 79 | Parameters: 1 0.000227 -4.767e-08 -0.000227 1 -0.00021 -4.767e-08 0.00021 1 -0.00762153 -0.00231912 -0.0768985 80 | FixedParameters: 0 0 0 81 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-pixar008_desc-preproc_T1w.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/sub-pixar008_desc-preproc_T1w.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/data/sub-pixar008_task-pixar_desc-coreg_boldref.nii.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/interfaces/tests/data/sub-pixar008_task-pixar_desc-coreg_boldref.nii.gz -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/test_bids.py: -------------------------------------------------------------------------------- 1 | """Tests for fmriprep.interfaces.bids.""" 2 | 3 | 4 | def test_BIDSURI(): 5 | """Test the BIDSURI interface.""" 6 | from fmriprep.interfaces.bids import BIDSURI 7 | 8 | dataset_links = { 9 | 'raw': '/data', 10 | 'deriv-0': '/data/derivatives/source-1', 11 | } 12 | out_dir = '/data/derivatives/fmriprep' 13 | 14 | # A single element as a string 15 | interface = BIDSURI( 16 | numinputs=1, 17 | dataset_links=dataset_links, 18 | out_dir=out_dir, 19 | ) 20 | interface.inputs.in1 = '/data/sub-01/func/sub-01_task-rest_bold.nii.gz' 21 | results = interface.run() 22 | assert results.outputs.out == ['bids:raw:sub-01/func/sub-01_task-rest_bold.nii.gz'] 23 | 24 | # A single element as a list 25 | interface = BIDSURI( 26 | numinputs=1, 27 | dataset_links=dataset_links, 28 | out_dir=out_dir, 29 | ) 30 | interface.inputs.in1 = ['/data/sub-01/func/sub-01_task-rest_bold.nii.gz'] 31 | results = interface.run() 32 | assert results.outputs.out == ['bids:raw:sub-01/func/sub-01_task-rest_bold.nii.gz'] 33 | 34 | # Two inputs: a string and a list 35 | interface = BIDSURI( 36 | numinputs=2, 37 | dataset_links=dataset_links, 38 | out_dir=out_dir, 39 | ) 40 | interface.inputs.in1 = '/data/sub-01/func/sub-01_task-rest_bold.nii.gz' 41 | interface.inputs.in2 = [ 42 | '/data/derivatives/source-1/sub-01/func/sub-01_task-rest_bold.nii.gz', 43 | '/out/sub-01/func/sub-01_task-rest_bold.nii.gz', 44 | ] 45 | results = interface.run() 46 | assert results.outputs.out == [ 47 | 'bids:raw:sub-01/func/sub-01_task-rest_bold.nii.gz', 48 | 'bids:deriv-0:sub-01/func/sub-01_task-rest_bold.nii.gz', 49 | '/out/sub-01/func/sub-01_task-rest_bold.nii.gz', # No change 50 | ] 51 | 52 | # Two inputs as lists 53 | interface = BIDSURI( 54 | numinputs=2, 55 | dataset_links=dataset_links, 56 | out_dir=out_dir, 57 | ) 58 | interface.inputs.in1 = [ 59 | '/data/sub-01/func/sub-01_task-rest_bold.nii.gz', 60 | 'bids:raw:sub-01/func/sub-01_task-rest_boldref.nii.gz', 61 | ] 62 | interface.inputs.in2 = [ 63 | '/data/derivatives/source-1/sub-01/func/sub-01_task-rest_bold.nii.gz', 64 | '/out/sub-01/func/sub-01_task-rest_bold.nii.gz', 65 | ] 66 | results = interface.run() 67 | assert results.outputs.out == [ 68 | 'bids:raw:sub-01/func/sub-01_task-rest_bold.nii.gz', 69 | 'bids:raw:sub-01/func/sub-01_task-rest_boldref.nii.gz', # No change 70 | 'bids:deriv-0:sub-01/func/sub-01_task-rest_bold.nii.gz', 71 | '/out/sub-01/func/sub-01_task-rest_bold.nii.gz', # No change 72 | ] 73 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/test_maths.py: -------------------------------------------------------------------------------- 1 | import nibabel as nb 2 | import numpy as np 3 | from nipype.pipeline import engine as pe 4 | 5 | from fmriprep.interfaces.maths import Clip 6 | 7 | 8 | def test_Clip(tmp_path): 9 | in_file = str(tmp_path / 'input.nii') 10 | data = np.array([[[-1.0, 1.0], [-2.0, 2.0]]]) 11 | nb.Nifti1Image(data, np.eye(4)).to_filename(in_file) 12 | 13 | threshold = pe.Node(Clip(in_file=in_file, minimum=0), name='threshold', base_dir=tmp_path) 14 | 15 | ret = threshold.run() 16 | 17 | assert ret.outputs.out_file == str(tmp_path / 'threshold/input_clipped.nii') 18 | out_img = nb.load(ret.outputs.out_file) 19 | assert np.allclose(out_img.get_fdata(), [[[0.0, 1.0], [0.0, 2.0]]]) 20 | 21 | threshold2 = pe.Node(Clip(in_file=in_file, minimum=-3), name='threshold2', base_dir=tmp_path) 22 | 23 | ret = threshold2.run() 24 | 25 | assert ret.outputs.out_file == in_file 26 | out_img = nb.load(ret.outputs.out_file) 27 | assert np.allclose(out_img.get_fdata(), [[[-1.0, 1.0], [-2.0, 2.0]]]) 28 | 29 | clip = pe.Node(Clip(in_file=in_file, minimum=-1, maximum=1), name='clip', base_dir=tmp_path) 30 | 31 | ret = clip.run() 32 | 33 | assert ret.outputs.out_file == str(tmp_path / 'clip/input_clipped.nii') 34 | out_img = nb.load(ret.outputs.out_file) 35 | assert np.allclose(out_img.get_fdata(), [[[-1.0, 1.0], [-1.0, 1.0]]]) 36 | 37 | nonpositive = pe.Node(Clip(in_file=in_file, maximum=0), name='nonpositive', base_dir=tmp_path) 38 | 39 | ret = nonpositive.run() 40 | 41 | assert ret.outputs.out_file == str(tmp_path / 'nonpositive/input_clipped.nii') 42 | out_img = nb.load(ret.outputs.out_file) 43 | assert np.allclose(out_img.get_fdata(), [[[-1.0, 0.0], [-2.0, 0.0]]]) 44 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/test_nitransforms.py: -------------------------------------------------------------------------------- 1 | import nitransforms as nt 2 | import numpy as np 3 | from nibabel.tmpdirs import InGivenDirectory 4 | 5 | from fmriprep.interfaces import nitransforms as fin 6 | 7 | 8 | def test_ConvertAffine(tmp_path, data_dir): 9 | bold = data_dir / 'sub-pixar008_task-pixar_desc-coreg_boldref.nii.gz' 10 | anat = data_dir / 'sub-pixar008_desc-preproc_T1w.nii.gz' 11 | 12 | # lta_affine = nt.linear.load(data_dir / 'mri_coreg.lta') 13 | lta_convert_fsl = nt.linear.load( 14 | data_dir / 'mri_coreg-lta_convert.mat', moving=bold, reference=anat, fmt='fsl' 15 | ) 16 | lta_convert_itk = nt.linear.load(data_dir / 'mri_coreg-lta_convert.txt') 17 | c3d_itk = nt.linear.load(data_dir / 'mri_coreg-c3d.txt') 18 | lta_convert_itk_inv = nt.linear.load(data_dir / 'mri_coreg-lta_convert-invert.txt') 19 | c3d_itk_inv = nt.linear.load(data_dir / 'mri_coreg-c3d-invert.txt') 20 | 21 | with InGivenDirectory(tmp_path): 22 | lta_to_fsl = fin.ConvertAffine( 23 | in_xfm=data_dir / 'mri_coreg.lta', 24 | reference=anat, 25 | moving=bold, 26 | out_fmt='fsl', 27 | ).run() 28 | assert lta_to_fsl.outputs.out_xfm == str(tmp_path / 'mri_coreg_fwd.mat') 29 | assert not lta_to_fsl.outputs.out_inv 30 | 31 | nitransforms_fsl = nt.linear.load( 32 | lta_to_fsl.outputs.out_xfm, moving=bold, reference=anat, fmt='fsl' 33 | ) 34 | assert np.allclose(nitransforms_fsl.matrix, lta_convert_fsl.matrix, atol=1e-4) 35 | 36 | lta_to_itk = fin.ConvertAffine(in_xfm=data_dir / 'mri_coreg.lta', inverse=True).run() 37 | assert lta_to_itk.outputs.out_xfm == str(tmp_path / 'mri_coreg_fwd.txt') 38 | assert lta_to_itk.outputs.out_inv == str(tmp_path / 'mri_coreg_inv.txt') 39 | 40 | nitransforms_itk = nt.linear.load(lta_to_itk.outputs.out_xfm) 41 | assert np.allclose(nitransforms_itk.matrix, lta_convert_itk.matrix, atol=1e-4) 42 | assert np.allclose(nitransforms_itk.matrix, c3d_itk.matrix, atol=1e-4) 43 | 44 | nitransforms_itk_inv = nt.linear.load(lta_to_itk.outputs.out_inv) 45 | assert np.allclose(nitransforms_itk_inv.matrix, lta_convert_itk_inv.matrix, atol=1e-4) 46 | assert np.allclose(nitransforms_itk_inv.matrix, c3d_itk_inv.matrix, atol=1e-4) 47 | 48 | fsl_to_itk = fin.ConvertAffine( 49 | in_xfm=data_dir / 'mri_coreg-lta_convert.mat', 50 | reference=anat, 51 | moving=bold, 52 | out_fmt='itk', 53 | inverse=True, 54 | ).run() 55 | 56 | nitransforms_itk = nt.linear.load(fsl_to_itk.outputs.out_xfm) 57 | assert np.allclose(nitransforms_itk.matrix, lta_convert_itk.matrix, atol=1e-4) 58 | assert np.allclose(nitransforms_itk.matrix, c3d_itk.matrix, atol=1e-4) 59 | 60 | nitransforms_itk_inv = nt.linear.load(fsl_to_itk.outputs.out_inv) 61 | assert np.allclose(nitransforms_itk_inv.matrix, lta_convert_itk_inv.matrix, atol=1e-4) 62 | assert np.allclose(nitransforms_itk_inv.matrix, c3d_itk_inv.matrix, atol=1e-4) 63 | -------------------------------------------------------------------------------- /fmriprep/interfaces/tests/test_reports.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | import pytest 24 | 25 | from ..reports import get_world_pedir 26 | 27 | 28 | @pytest.mark.parametrize( 29 | ('orientation', 'pe_dir', 'expected'), 30 | [ 31 | ('RAS', 'j', 'Posterior-Anterior'), 32 | ('RAS', 'j-', 'Anterior-Posterior'), 33 | ('RAS', 'i', 'Left-Right'), 34 | ('RAS', 'i-', 'Right-Left'), 35 | ('RAS', 'k', 'Inferior-Superior'), 36 | ('RAS', 'k-', 'Superior-Inferior'), 37 | ('LAS', 'j', 'Posterior-Anterior'), 38 | ('LAS', 'i-', 'Left-Right'), 39 | ('LAS', 'k-', 'Superior-Inferior'), 40 | ('LPI', 'j', 'Anterior-Posterior'), 41 | ('LPI', 'i-', 'Left-Right'), 42 | ('LPI', 'k-', 'Inferior-Superior'), 43 | ('SLP', 'k-', 'Posterior-Anterior'), 44 | ('SLP', 'k', 'Anterior-Posterior'), 45 | ('SLP', 'j-', 'Left-Right'), 46 | ('SLP', 'j', 'Right-Left'), 47 | ('SLP', 'i', 'Inferior-Superior'), 48 | ('SLP', 'i-', 'Superior-Inferior'), 49 | ], 50 | ) 51 | def test_get_world_pedir(tmpdir, orientation, pe_dir, expected): 52 | assert get_world_pedir(orientation, pe_dir) == expected 53 | -------------------------------------------------------------------------------- /fmriprep/reports/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/reports/__init__.py -------------------------------------------------------------------------------- /fmriprep/reports/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/reports/tests/__init__.py -------------------------------------------------------------------------------- /fmriprep/reports/tests/test_reports.py: -------------------------------------------------------------------------------- 1 | import shutil 2 | from pathlib import Path 3 | 4 | import pytest 5 | from bids.layout import BIDSLayout 6 | 7 | from fmriprep.reports.core import generate_reports 8 | 9 | from ... import config, data 10 | 11 | data_dir = data.load('tests') 12 | 13 | 14 | # Test with and without sessions' aggregation 15 | @pytest.mark.parametrize( 16 | ('aggr_ses_reports', 'expected_files'), 17 | [ 18 | ( 19 | 3, 20 | [ 21 | 'sub-001_anat.html', 22 | 'sub-001_ses-001_func.html', 23 | 'sub-001_ses-003_func.html', 24 | 'sub-001_ses-004_func.html', 25 | 'sub-001_ses-005_func.html', 26 | ], 27 | ), 28 | (4, ['sub-001.html']), 29 | ], 30 | ) 31 | # Test with and without crash file 32 | @pytest.mark.parametrize('error', [True, False]) 33 | # Test with and without boilerplate 34 | @pytest.mark.parametrize('boilerplate', [True, False]) 35 | # Test ses- prefix stripping 36 | @pytest.mark.parametrize( 37 | 'session_list', [['001', '003', '004', '005'], ['ses-001', 'ses-003', 'ses-004', 'ses-005']] 38 | ) 39 | # Test sub- prefix stripping 40 | @pytest.mark.parametrize('subject_label', ['001', 'sub-001']) 41 | @pytest.mark.skipif( 42 | not Path.exists(data_dir / 'work'), 43 | reason='Package installed - large test data directory excluded from wheel', 44 | ) 45 | def test_ReportSeparation( 46 | tmp_path, 47 | monkeypatch, 48 | aggr_ses_reports, 49 | expected_files, 50 | error, 51 | boilerplate, 52 | session_list, 53 | subject_label, 54 | ): 55 | fake_uuid = 'fake_uuid' 56 | 57 | sub_dir = tmp_path / 'sub-001' 58 | shutil.copytree(data_dir / 'work/reportlets/fmriprep/sub-001', sub_dir) 59 | 60 | # Test report generation with and without crash file 61 | if error: 62 | crash_file = next(data_dir.glob('crash_files/crash*.txt')) 63 | run_log_dir = sub_dir / 'log' / fake_uuid 64 | run_log_dir.mkdir(parents=True, exist_ok=True) 65 | shutil.copy2(crash_file, run_log_dir / crash_file.name) 66 | 67 | # Test report generation with and without boilerplate 68 | if boilerplate: 69 | log_dir = tmp_path / 'logs' 70 | log_dir.mkdir() 71 | shutil.copy2(data_dir / 'logs/CITATION.html', log_dir / 'CITATION.html') 72 | 73 | monkeypatch.setattr(config.execution, 'aggr_ses_reports', aggr_ses_reports) 74 | 75 | def mock_session_list(*args, **kwargs): 76 | return session_list 77 | 78 | config.execution.layout = BIDSLayout(data_dir / 'ds000005') 79 | monkeypatch.setattr(config.execution.layout, 'get_sessions', mock_session_list) 80 | monkeypatch.setattr( 81 | config.execution, 'bids_filters', {'bold': {'session': ['001', '003', '004', '005']}} 82 | ) 83 | 84 | # Generate report 85 | failed_reports = generate_reports([subject_label], tmp_path, fake_uuid) 86 | 87 | # Verify that report generation was successful 88 | assert not failed_reports 89 | 90 | # Check that all expected files were generated 91 | for expected_file in expected_files: 92 | file_path = tmp_path / expected_file 93 | assert file_path.is_file(), f'Expected file {expected_file} is missing' 94 | 95 | # Check if there are no unexpected HTML files 96 | unexpected_files = {file.name for file in tmp_path.glob('*.html')} - set(expected_files) 97 | assert not unexpected_files, f'Unexpected HTML files found: {unexpected_files}' 98 | 99 | if not (boilerplate or error): 100 | return 101 | 102 | html_content = Path.read_text(tmp_path / expected_files[0]) 103 | if boilerplate: 104 | assert 'The boilerplate text was automatically generated' in html_content, ( 105 | f'The file {expected_files[0]} did not contain the reported error.' 106 | ) 107 | 108 | if error: 109 | assert 'One or more execution steps failed' in html_content, ( 110 | f'The file {expected_files[0]} did not contain the reported error.' 111 | ) 112 | -------------------------------------------------------------------------------- /fmriprep/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/tests/__init__.py -------------------------------------------------------------------------------- /fmriprep/tests/test_fsl6.py: -------------------------------------------------------------------------------- 1 | import shutil 2 | from pathlib import Path 3 | 4 | import pytest 5 | import templateflow.api as tf 6 | from looseversion import LooseVersion 7 | from nipype.interfaces import fsl 8 | 9 | fslversion = fsl.Info.version() 10 | TEMPLATE = tf.get('MNI152NLin2009cAsym', resolution=2, desc=None, suffix='T1w') 11 | 12 | 13 | @pytest.mark.skipif(fslversion is None, reason='fsl required') 14 | @pytest.mark.skipif( 15 | fslversion and LooseVersion(fslversion) < LooseVersion('6.0.0'), reason='FSL6 test' 16 | ) 17 | @pytest.mark.parametrize( 18 | ('path_parent', 'filename'), 19 | [ 20 | ('.', 'brain.nii.gz'), 21 | ( 22 | 'pneumonoultramicroscopicsilicovolcanoconiosis/floccinaucinihilipilification', 23 | 'supercalifragilisticexpialidocious.nii.gz', 24 | ), 25 | ( 26 | 'pneumonoultramicroscopicsilicovolcanoconiosis/floccinaucinihilipilification/' 27 | 'antidisestablishmentarianism/pseudopseudohypoparathyroidism/sesquipedalian', 28 | 'brain.nii.gz', 29 | ), 30 | ], 31 | ) 32 | def test_fsl6_long_filenames(tmp_path, path_parent, filename): 33 | test_dir = tmp_path / path_parent 34 | test_dir.mkdir(parents=True, exist_ok=True) 35 | in_file = test_dir / filename 36 | out_file = test_dir / 'output.nii.gz' 37 | shutil.copy(TEMPLATE, in_file) 38 | 39 | bet = fsl.BET(in_file=in_file, out_file=out_file).run() 40 | assert Path(bet.outputs.out_file).exists() 41 | -------------------------------------------------------------------------------- /fmriprep/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/utils/__init__.py -------------------------------------------------------------------------------- /fmriprep/utils/asynctools.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from collections.abc import Callable 3 | from typing import TypeVar 4 | 5 | R = TypeVar('R') 6 | 7 | 8 | async def worker(job: Callable[[], R], semaphore: asyncio.Semaphore) -> R: 9 | async with semaphore: 10 | loop = asyncio.get_running_loop() 11 | return await loop.run_in_executor(None, job) 12 | -------------------------------------------------------------------------------- /fmriprep/utils/debug.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | # STATEMENT OF CHANGES: This file is derived from sources licensed under the Apache-2.0 terms, 24 | # and uses the following portion of the original code: 25 | # https://github.com/dandi/dandi-cli/blob/da3b7a726c4a352dfb53a0c6bee59e660de827e6/dandi/utils.py#L49-L82 26 | # 27 | # 28 | # ORIGINAL WORK'S ATTRIBUTION NOTICE: 29 | # 30 | # Copyright DANDI Client Developers 31 | # 32 | # Licensed under the Apache License, Version 2.0 (the "License"); 33 | # you may not use this file except in compliance with the License. 34 | # You may obtain a copy of the License at 35 | # 36 | # http://www.apache.org/licenses/LICENSE-2.0 37 | # 38 | # Unless required by applicable law or agreed to in writing, software 39 | # distributed under the License is distributed on an "AS IS" BASIS, 40 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 41 | # See the License for the specific language governing permissions and 42 | # limitations under the License. 43 | # 44 | import sys 45 | 46 | 47 | def is_interactive(): 48 | """Return True if all in/outs are tty""" 49 | # TODO: check on windows if hasattr check would work correctly and add value: 50 | # 51 | return sys.stdin.isatty() and sys.stdout.isatty() and sys.stderr.isatty() 52 | 53 | 54 | def setup_exceptionhook(ipython=False): 55 | """Overloads default sys.excepthook with our exceptionhook handler. 56 | If interactive, our exceptionhook handler will invoke 57 | pdb.post_mortem; if not interactive, then invokes default handler. 58 | """ 59 | 60 | def _pdb_excepthook(type, value, tb): 61 | import traceback 62 | 63 | traceback.print_exception(type, value, tb) 64 | print() 65 | if is_interactive(): 66 | import pdb 67 | 68 | pdb.post_mortem(tb) 69 | 70 | if ipython: 71 | from IPython.core import ultratb 72 | 73 | sys.excepthook = ultratb.FormattedTB( 74 | mode='Verbose', 75 | # color_scheme='Linux', 76 | call_pdb=is_interactive(), 77 | ) 78 | else: 79 | sys.excepthook = _pdb_excepthook 80 | -------------------------------------------------------------------------------- /fmriprep/utils/meepi.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Multi-echo EPI utilities.""" 24 | 25 | 26 | def combine_meepi_source(in_files): 27 | """ 28 | Create a new source name when optimally 29 | combining multiple multi-echo EPIs 30 | 31 | >>> combine_meepi_source([ 32 | ... 'sub-01_run-01_echo-1_bold.nii.gz', 33 | ... 'sub-01_run-01_echo-2_bold.nii.gz', 34 | ... 'sub-01_run-01_echo-3_bold.nii.gz',]) 35 | 'sub-01_run-01_bold.nii.gz' 36 | 37 | """ 38 | import os 39 | 40 | from nipype.utils.filemanip import filename_to_list 41 | 42 | base, in_file = os.path.split(filename_to_list(in_files)[0]) 43 | entities = [ent for ent in in_file.split('_') if not ent.startswith('echo-')] 44 | basename = '_'.join(entities) 45 | return os.path.join(base, basename) 46 | -------------------------------------------------------------------------------- /fmriprep/utils/misc.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Miscellaneous utilities.""" 24 | 25 | from functools import cache 26 | 27 | 28 | def check_deps(workflow): 29 | """Make sure dependencies are present in this system.""" 30 | from nipype.utils.filemanip import which 31 | 32 | return sorted( 33 | (node.interface.__class__.__name__, node.interface._cmd) 34 | for node in workflow._get_all_nodes() 35 | if (hasattr(node.interface, '_cmd') and which(node.interface._cmd.split()[0]) is None) 36 | ) 37 | 38 | 39 | def fips_enabled(): 40 | """ 41 | Check if FIPS is enabled on the system. 42 | 43 | For more information, see: 44 | https://github.com/nipreps/fmriprep/issues/2480#issuecomment-891199276 45 | """ 46 | from pathlib import Path 47 | 48 | fips = Path('/proc/sys/crypto/fips_enabled') 49 | return fips.exists() and fips.read_text()[0] != '0' 50 | 51 | 52 | @cache 53 | def estimate_bold_mem_usage(bold_fname: str) -> tuple[int, dict]: 54 | import nibabel as nb 55 | import numpy as np 56 | 57 | img = nb.load(bold_fname) 58 | nvox = int(np.prod(img.shape, dtype='u8')) 59 | # Assume tools will coerce to 8-byte floats to be safe 60 | bold_size_gb = 8 * nvox / (1024**3) 61 | bold_tlen = img.shape[-1] 62 | mem_gb = { 63 | 'filesize': bold_size_gb, 64 | 'resampled': bold_size_gb * 4, 65 | 'largemem': bold_size_gb * (max(bold_tlen / 100, 1.0) + 4), 66 | } 67 | 68 | return bold_tlen, mem_gb 69 | -------------------------------------------------------------------------------- /fmriprep/utils/tests/test_derivative_cache.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | import pytest 4 | 5 | from fmriprep.utils import bids 6 | 7 | 8 | @pytest.mark.parametrize('desc', ['hmc', 'coreg']) 9 | def test_baseline_found_as_str(tmp_path: Path, desc: str): 10 | subject = '0' 11 | task = 'rest' 12 | 13 | to_find = tmp_path.joinpath( 14 | f'sub-{subject}', 'func', f'sub-{subject}_task-{task}_desc-{desc}_boldref.nii.gz' 15 | ) 16 | to_find.parent.mkdir(parents=True) 17 | to_find.touch() 18 | 19 | entities = { 20 | 'subject': subject, 21 | 'task': task, 22 | 'suffix': 'bold', 23 | 'extension': '.nii.gz', 24 | } 25 | 26 | derivs = bids.collect_derivatives(derivatives_dir=tmp_path, entities=entities) 27 | assert dict(derivs) == {f'{desc}_boldref': str(to_find), 'transforms': {}} 28 | 29 | 30 | @pytest.mark.parametrize('xfm', ['boldref2fmap', 'boldref2anat', 'hmc']) 31 | def test_transforms_found_as_str(tmp_path: Path, xfm: str): 32 | subject = '0' 33 | task = 'rest' 34 | fromto = { 35 | 'hmc': 'from-orig_to-boldref', 36 | 'boldref2fmap': 'from-boldref_to-auto00000', 37 | 'boldref2anat': 'from-boldref_to-anat', 38 | }[xfm] 39 | 40 | to_find = tmp_path.joinpath( 41 | f'sub-{subject}', 'func', f'sub-{subject}_task-{task}_{fromto}_mode-image_xfm.txt' 42 | ) 43 | to_find.parent.mkdir(parents=True) 44 | to_find.touch() 45 | 46 | entities = { 47 | 'subject': subject, 48 | 'task': task, 49 | 'suffix': 'bold', 50 | 'extension': '.nii.gz', 51 | } 52 | 53 | derivs = bids.collect_derivatives( 54 | derivatives_dir=tmp_path, 55 | entities=entities, 56 | fieldmap_id='auto_00000', 57 | ) 58 | assert derivs == {'transforms': {xfm: str(to_find)}} 59 | -------------------------------------------------------------------------------- /fmriprep/utils/transforms.py: -------------------------------------------------------------------------------- 1 | """Utilities for loading transforms for resampling""" 2 | 3 | from pathlib import Path 4 | 5 | import nitransforms as nt 6 | 7 | 8 | def load_transforms(xfm_paths: list[Path], inverse: list[bool]) -> nt.base.TransformBase: 9 | """Load a series of transforms as a nitransforms TransformChain 10 | 11 | An empty list will return an identity transform 12 | """ 13 | if len(inverse) == 1: 14 | inverse *= len(xfm_paths) 15 | elif len(inverse) != len(xfm_paths): 16 | raise ValueError('Mismatched number of transforms and inverses') 17 | 18 | chain = None 19 | for path, inv in zip(xfm_paths[::-1], inverse[::-1], strict=False): 20 | path = Path(path) 21 | if path.suffix == '.h5': 22 | # Load as a TransformChain 23 | xfm = nt.manip.load(path) 24 | else: 25 | xfm = nt.linear.load(path) 26 | if inv: 27 | xfm = ~xfm 28 | if chain is None: 29 | chain = xfm 30 | else: 31 | chain += xfm 32 | if chain is None: 33 | chain = nt.Affine() # Identity 34 | return chain 35 | -------------------------------------------------------------------------------- /fmriprep/workflows/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/workflows/__init__.py -------------------------------------------------------------------------------- /fmriprep/workflows/bold/__init__.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | """ 4 | 5 | Pre-processing fMRI - BOLD signal workflows 6 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 8 | .. automodule:: fmriprep.workflows.bold.base 9 | .. automodule:: fmriprep.workflows.bold.hmc 10 | .. automodule:: fmriprep.workflows.bold.stc 11 | .. automodule:: fmriprep.workflows.bold.t2s 12 | .. automodule:: fmriprep.workflows.bold.registration 13 | .. automodule:: fmriprep.workflows.bold.resampling 14 | .. automodule:: fmriprep.workflows.bold.confounds 15 | 16 | 17 | """ 18 | 19 | from .confounds import init_bold_confs_wf 20 | from .hmc import init_bold_hmc_wf 21 | from .registration import init_bold_reg_wf 22 | from .resampling import init_bold_surf_wf 23 | from .stc import init_bold_stc_wf 24 | from .t2s import init_bold_t2s_wf 25 | 26 | __all__ = [ 27 | 'init_bold_confs_wf', 28 | 'init_bold_hmc_wf', 29 | 'init_bold_reg_wf', 30 | 'init_bold_stc_wf', 31 | 'init_bold_surf_wf', 32 | 'init_bold_t2s_wf', 33 | ] 34 | -------------------------------------------------------------------------------- /fmriprep/workflows/bold/hmc.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """ 24 | Head-Motion Estimation and Correction (HMC) of BOLD images 25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 26 | 27 | .. autofunction:: init_bold_hmc_wf 28 | 29 | """ 30 | 31 | from nipype.interfaces import fsl 32 | from nipype.interfaces import utility as niu 33 | from nipype.pipeline import engine as pe 34 | 35 | 36 | def init_bold_hmc_wf(mem_gb: float, omp_nthreads: int, name: str = 'bold_hmc_wf'): 37 | """ 38 | Build a workflow to estimate head-motion parameters. 39 | 40 | This workflow estimates the motion parameters to perform 41 | :abbr:`HMC (head motion correction)` over the input 42 | :abbr:`BOLD (blood-oxygen-level dependent)` image. 43 | 44 | Workflow Graph 45 | .. workflow:: 46 | :graph2use: orig 47 | :simple_form: yes 48 | 49 | from fmriprep.workflows.bold import init_bold_hmc_wf 50 | wf = init_bold_hmc_wf( 51 | mem_gb=3, 52 | omp_nthreads=1) 53 | 54 | Parameters 55 | ---------- 56 | mem_gb : :obj:`float` 57 | Size of BOLD file in GB 58 | omp_nthreads : :obj:`int` 59 | Maximum number of threads an individual process may use 60 | name : :obj:`str` 61 | Name of workflow (default: ``bold_hmc_wf``) 62 | 63 | Inputs 64 | ------ 65 | bold_file 66 | BOLD series NIfTI file 67 | raw_ref_image 68 | Reference image to which BOLD series is motion corrected 69 | 70 | Outputs 71 | ------- 72 | xforms 73 | ITKTransform file aligning each volume to ``ref_image`` 74 | 75 | """ 76 | from niworkflows.engine.workflows import LiterateWorkflow as Workflow 77 | from niworkflows.interfaces.itk import MCFLIRT2ITK 78 | 79 | workflow = Workflow(name=name) 80 | workflow.__desc__ = """\ 81 | Head-motion parameters with respect to the BOLD reference 82 | (transformation matrices, and six corresponding rotation and translation 83 | parameters) are estimated before any spatiotemporal filtering using 84 | `mcflirt` [FSL {fsl_ver}, @mcflirt]. 85 | """.format(fsl_ver=fsl.Info().version() or '') 86 | 87 | inputnode = pe.Node( 88 | niu.IdentityInterface(fields=['bold_file', 'raw_ref_image']), name='inputnode' 89 | ) 90 | outputnode = pe.Node(niu.IdentityInterface(fields=['xforms']), name='outputnode') 91 | 92 | # Head motion correction (hmc) 93 | mcflirt = pe.Node(fsl.MCFLIRT(save_mats=True), name='mcflirt', mem_gb=mem_gb * 3) 94 | 95 | fsl2itk = pe.Node(MCFLIRT2ITK(), name='fsl2itk', mem_gb=0.05, n_procs=omp_nthreads) 96 | 97 | workflow.connect([ 98 | (inputnode, mcflirt, [('raw_ref_image', 'ref_file'), 99 | ('bold_file', 'in_file')]), 100 | (inputnode, fsl2itk, [('raw_ref_image', 'in_source'), 101 | ('raw_ref_image', 'in_reference')]), 102 | (mcflirt, fsl2itk, [('mat_file', 'in_files')]), 103 | (fsl2itk, outputnode, [('out_file', 'xforms')]), 104 | ]) # fmt:skip 105 | 106 | return workflow 107 | -------------------------------------------------------------------------------- /fmriprep/workflows/bold/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/fmriprep/workflows/bold/tests/__init__.py -------------------------------------------------------------------------------- /fmriprep/workflows/bold/tests/test_base.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | import nibabel as nb 4 | import numpy as np 5 | import pytest 6 | from nipype.pipeline.engine.utils import generate_expanded_graph 7 | from niworkflows.utils.testing import generate_bids_skeleton 8 | 9 | from .... import config 10 | from ...tests import mock_config 11 | from ...tests.test_base import BASE_LAYOUT 12 | from ..base import init_bold_wf 13 | 14 | 15 | @pytest.fixture(scope='module', autouse=True) 16 | def _quiet_logger(): 17 | import logging 18 | 19 | logger = logging.getLogger('nipype.workflow') 20 | old_level = logger.getEffectiveLevel() 21 | logger.setLevel(logging.ERROR) 22 | yield 23 | logger.setLevel(old_level) 24 | 25 | 26 | @pytest.fixture(scope='module') 27 | def bids_root(tmp_path_factory): 28 | base = tmp_path_factory.mktemp('boldbase') 29 | bids_dir = base / 'bids' 30 | generate_bids_skeleton(bids_dir, BASE_LAYOUT) 31 | return bids_dir 32 | 33 | 34 | @pytest.mark.parametrize('task', ['rest', 'nback']) 35 | @pytest.mark.parametrize('fieldmap_id', ['phasediff', None]) 36 | @pytest.mark.parametrize('freesurfer', [False, True]) 37 | @pytest.mark.parametrize('level', ['minimal', 'resampling', 'full']) 38 | @pytest.mark.parametrize('bold2anat_init', ['t1w', 't2w']) 39 | def test_bold_wf( 40 | bids_root: Path, 41 | tmp_path: Path, 42 | task: str, 43 | fieldmap_id: str | None, 44 | freesurfer: bool, 45 | level: str, 46 | bold2anat_init: str, 47 | ): 48 | """Test as many combinations of precomputed files and input 49 | configurations as possible.""" 50 | output_dir = tmp_path / 'output' 51 | output_dir.mkdir() 52 | 53 | img = nb.Nifti1Image(np.zeros((10, 10, 10, 10)), np.eye(4)) 54 | 55 | if task == 'rest': 56 | bold_series = [ 57 | str(bids_root / 'sub-01' / 'func' / 'sub-01_task-rest_run-1_bold.nii.gz'), 58 | ] 59 | sbref = str(bids_root / 'sub-01' / 'func' / 'sub-01_task-rest_run-1_sbref.nii.gz') 60 | elif task == 'nback': 61 | bold_series = [ 62 | str(bids_root / 'sub-01' / 'func' / f'sub-01_task-nback_echo-{i}_bold.nii.gz') 63 | for i in range(1, 4) 64 | ] 65 | sbref = str(bids_root / 'sub-01' / 'func' / 'sub-01_task-nback_echo-1_sbref.nii.gz') 66 | 67 | # The workflow will attempt to read file headers 68 | for path in bold_series: 69 | img.to_filename(path) 70 | img.to_filename(sbref) 71 | 72 | with mock_config(bids_dir=bids_root): 73 | config.workflow.bold2anat_init = bold2anat_init 74 | config.workflow.level = level 75 | config.workflow.run_reconall = freesurfer 76 | wf = init_bold_wf( 77 | bold_series=bold_series, 78 | fieldmap_id=fieldmap_id, 79 | precomputed={}, 80 | ) 81 | 82 | flatgraph = wf._create_flat_graph() 83 | generate_expanded_graph(flatgraph) 84 | -------------------------------------------------------------------------------- /fmriprep/workflows/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 2 | # vi: set ft=python sts=4 ts=4 sw=4 et: 3 | # 4 | # Copyright The NiPreps Developers 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # We support and encourage derived works from this project, please read 19 | # about our expectations at 20 | # 21 | # https://www.nipreps.org/community/licensing/ 22 | # 23 | """Utilities and mocks for testing and documentation building.""" 24 | 25 | import os 26 | import shutil 27 | from contextlib import contextmanager 28 | from pathlib import Path 29 | from tempfile import mkdtemp 30 | 31 | from toml import loads 32 | 33 | from ... import data 34 | 35 | 36 | @contextmanager 37 | def mock_config(bids_dir=None): 38 | """Create a mock config for documentation and testing purposes.""" 39 | from ... import config 40 | 41 | _old_fs = os.getenv('FREESURFER_HOME') 42 | if not _old_fs: 43 | os.environ['FREESURFER_HOME'] = mkdtemp() 44 | 45 | settings = loads(data.load.readable('tests/config.toml').read_text()) 46 | for sectionname, configs in settings.items(): 47 | if sectionname != 'environment': 48 | section = getattr(config, sectionname) 49 | section.load(configs, init=False) 50 | config.nipype.omp_nthreads = 1 51 | config.nipype.init() 52 | config.loggers.init() 53 | config.init_spaces() 54 | 55 | bids_dir = bids_dir or data.load('tests/ds000005').absolute() 56 | 57 | config.execution.work_dir = Path(mkdtemp()) 58 | config.execution.bids_dir = bids_dir 59 | config.execution.fmriprep_dir = Path(mkdtemp()) 60 | config.execution.bids_database_dir = None 61 | config.execution._layout = None 62 | config.execution.init() 63 | 64 | yield 65 | 66 | shutil.rmtree(config.execution.work_dir) 67 | shutil.rmtree(config.execution.fmriprep_dir) 68 | 69 | if not _old_fs: 70 | del os.environ['FREESURFER_HOME'] 71 | -------------------------------------------------------------------------------- /long_description.rst: -------------------------------------------------------------------------------- 1 | Preprocessing of functional MRI (fMRI) involves numerous steps to clean and standardize 2 | the data before statistical analysis. 3 | Generally, researchers create ad hoc preprocessing workflows for each dataset, 4 | building upon a large inventory of available tools. 5 | The complexity of these workflows has snowballed with rapid advances in 6 | acquisition and processing. 7 | fMRIPrep is an analysis-agnostic tool that addresses the challenge of robust and 8 | reproducible preprocessing for task-based and resting fMRI data. 9 | fMRIPrep automatically adapts a best-in-breed workflow to the idiosyncrasies of 10 | virtually any dataset, ensuring high-quality preprocessing without manual intervention. 11 | fMRIPrep robustly produces high-quality results on diverse fMRI data. 12 | Additionally, fMRIPrep introduces less uncontrolled spatial smoothness than observed 13 | with commonly used preprocessing tools. 14 | fMRIPrep equips neuroscientists with an easy-to-use and transparent preprocessing 15 | workflow, which can help ensure the validity of inference and the interpretability 16 | of results. 17 | 18 | The workflow is based on `Nipype `_ and encompasses a large 19 | set of tools from well-known neuroimaging packages, including 20 | `FSL `_, 21 | `ANTs `_, 22 | `FreeSurfer `_, 23 | `AFNI `_, 24 | and `Nilearn `_. 25 | This pipeline was designed to provide the best software implementation for each state of 26 | preprocessing, and will be updated as newer and better neuroimaging software becomes 27 | available. 28 | 29 | fMRIPrep performs basic preprocessing steps (coregistration, normalization, unwarping, noise 30 | component extraction, segmentation, skullstripping etc.) providing outputs that can be 31 | easily submitted to a variety of group level analyses, including task-based or resting-state 32 | fMRI, graph theory measures, surface or volume-based statistics, etc. 33 | fMRIPrep allows you to easily do the following: 34 | 35 | * Take fMRI data from *unprocessed* (only reconstructed) to ready for analysis. 36 | * Implement tools from different software packages. 37 | * Achieve optimal data processing quality by using the best tools available. 38 | * Generate preprocessing-assessment reports, with which the user can easily identify problems. 39 | * Receive verbose output concerning the stage of preprocessing for each subject, including 40 | meaningful errors. 41 | * Automate and parallelize processing steps, which provides a significant speed-up from 42 | typical linear, manual processing. 43 | 44 | [Nat Meth doi:`10.1038/s41592-018-0235-4 `_] 45 | [Documentation `fmriprep.org `_] 46 | [Software doi:`10.5281/zenodo.852659 `_] 47 | [Support `neurostars.org `_] 48 | 49 | License information 50 | ------------------- 51 | *fMRIPrep* adheres to the 52 | `general licensing guidelines `__ 53 | of the *NiPreps framework*. 54 | 55 | License 56 | ~~~~~~~ 57 | Copyright (c) the *NiPreps* Developers. 58 | 59 | As of the 21.0.x pre-release and release series, *fMRIPrep* is 60 | licensed under the Apache License, Version 2.0 (the "License"); 61 | you may not use this file except in compliance with the License. 62 | You may obtain a copy of the License at 63 | `http://www.apache.org/licenses/LICENSE-2.0 64 | `__. 65 | 66 | Unless required by applicable law or agreed to in writing, software 67 | distributed under the License is distributed on an "AS IS" BASIS, 68 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 69 | See the License for the specific language governing permissions and 70 | limitations under the License. 71 | -------------------------------------------------------------------------------- /scripts/generate_reference_mask.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | 4 | from nipype.interfaces import utility as niu 5 | from nipype.pipeline import engine as pe 6 | from niworkflows.func.util import init_bold_reference_wf 7 | 8 | 9 | def sink_mask_file(in_file, orig_file, out_dir): 10 | import os 11 | 12 | from nipype.utils.filemanip import copyfile, fname_presuffix 13 | 14 | os.makedirs(out_dir, exist_ok=True) 15 | out_file = fname_presuffix(orig_file, suffix='_mask', newpath=out_dir) 16 | copyfile(in_file, out_file, copy=True, use_hardlink=True) 17 | return out_file 18 | 19 | 20 | def init_main_wf(bold_file, out_dir, base_dir=None, name='main_wf'): 21 | wf = init_bold_reference_wf(omp_nthreads=4, name=name) 22 | wf.base_dir = base_dir 23 | wf.inputs.inputnode.bold_file = bold_file 24 | 25 | sink = pe.Node(niu.Function(function=sink_mask_file), name='sink') 26 | sink.inputs.out_dir = out_dir 27 | sink.inputs.orig_file = bold_file 28 | wf.connect( 29 | [ 30 | (wf.get_node('outputnode'), sink, [('bold_mask', 'in_file')]), 31 | ] 32 | ) 33 | return wf 34 | 35 | 36 | def main(): 37 | main_wf = init_main_wf(sys.argv[1], sys.argv[2]) 38 | main_wf.run(plugin='MultiProc') 39 | 40 | 41 | if __name__ == '__main__': 42 | main() 43 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | requires = 3 | tox>=4 4 | envlist = 5 | py3{10,11,12,13}-{latest,pre} 6 | py310-min 7 | skip_missing_interpreters = true 8 | 9 | # Configuration that allows us to split tests across GitHub runners effectively 10 | [gh-actions] 11 | python = 12 | 3.10: py310 13 | 3.11: py311 14 | 3.12: py312 15 | 3.13: py313 16 | 17 | [gh-actions:env] 18 | DEPENDS = 19 | min: min 20 | latest: latest 21 | pre: pre 22 | 23 | [testenv] 24 | description = Pytest with coverage 25 | labels = test 26 | pip_pre = 27 | pre: true 28 | pass_env = 29 | # getpass.getuser() sources for Windows: 30 | LOGNAME 31 | USER 32 | LNAME 33 | USERNAME 34 | # Pass user color preferences through 35 | PY_COLORS 36 | FORCE_COLOR 37 | NO_COLOR 38 | CLICOLOR 39 | CLICOLOR_FORCE 40 | PYTHON_GIL 41 | deps = 42 | py313: traits @ git+https://github.com/enthought/traits.git@10954eb 43 | extras = test 44 | setenv = 45 | pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple 46 | pre: UV_INDEX=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple 47 | pre: UV_INDEX_STRATEGY=unsafe-best-match 48 | uv_resolution = 49 | min: lowest-direct 50 | 51 | commands_pre = 52 | # Use py* to disable for other environments 53 | py3{10,11,12,13}: python scripts/fetch_templates.py 54 | commands = 55 | pytest --cov-report term-missing --durations=20 --durations-min=1.0 {posargs:-n auto} 56 | 57 | [testenv:style] 58 | description = Check our style guide 59 | labels = check 60 | deps = 61 | ruff 62 | skip_install = true 63 | commands = 64 | ruff check --diff 65 | ruff format --diff 66 | 67 | [testenv:style-fix] 68 | description = Auto-apply style guide to the extent possible 69 | labels = pre-release 70 | deps = 71 | ruff 72 | skip_install = true 73 | commands = 74 | ruff check --fix 75 | ruff format 76 | ruff check --select ISC001 77 | 78 | [testenv:spellcheck] 79 | description = Check spelling 80 | labels = check 81 | deps = 82 | codespell[toml] 83 | skip_install = true 84 | commands = 85 | codespell . {posargs} 86 | 87 | [testenv:build{,-strict}] 88 | labels = 89 | check 90 | pre-release 91 | deps = 92 | build 93 | twine 94 | skip_install = true 95 | set_env = 96 | # Ignore specific known warnings: 97 | # https://github.com/pypa/pip/issues/11684 98 | # https://github.com/pypa/pip/issues/12243 99 | strict: PYTHONWARNINGS=error,once:pkg_resources is deprecated as an API.:DeprecationWarning:pip._internal.metadata.importlib._envs,once:Unimplemented abstract methods {'locate_file'}:DeprecationWarning:pip._internal.metadata.importlib._dists 100 | commands = 101 | python -m build 102 | python -m twine check dist/* 103 | 104 | [testenv:publish] 105 | depends = build 106 | labels = release 107 | deps = 108 | twine 109 | skip_install = true 110 | commands = 111 | python -m twine upload dist/* 112 | -------------------------------------------------------------------------------- /wrapper/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) the Nipreps developers. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of fmriprep nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /wrapper/README.rst: -------------------------------------------------------------------------------- 1 | The *fMRIPrep* on Docker wrapper 2 | -------------------------------- 3 | fMRIprep is a functional magnetic resonance image pre-processing pipeline 4 | that is designed to provide an easily accessible, state-of-the-art interface 5 | that is robust to differences in scan acquisition protocols and that requires 6 | minimal user input, while providing easily interpretable and comprehensive 7 | error and output reporting. 8 | 9 | This is a lightweight Python wrapper to run *fMRIPrep*. 10 | It generates the appropriate Docker commands, providing an intuitive interface 11 | to running the *fMRIPrep* workflow in a Docker environment. 12 | Docker must be installed and running. This can be checked 13 | running :: 14 | 15 | docker info 16 | 17 | Please acknowledge this work using the citation boilerplate that *fMRIPrep* includes 18 | in the visual report generated for every subject processed. 19 | For a more detailed description of the citation boilerplate and its relevance, 20 | please check out the 21 | `NiPreps documentation `__. 22 | Please report any feedback to our `GitHub repository `__. 23 | -------------------------------------------------------------------------------- /wrapper/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling", "hatch-vcs", "nipreps-versions"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "fmriprep-docker" 7 | description = "A wrapper for generating Docker commands using regular fMRIPrep syntax" 8 | readme = "README.rst" 9 | authors = [{name = "The NiPreps Developers", email = "nipreps@gmail.com"}] 10 | classifiers = [ 11 | "Development Status :: 5 - Production/Stable", 12 | "Intended Audience :: Science/Research", 13 | "Topic :: Scientific/Engineering :: Image Recognition", 14 | "License :: OSI Approved :: Apache Software License", 15 | "License :: OSI Approved :: BSD License", 16 | "Programming Language :: Python :: 2.7", 17 | "Programming Language :: Python :: 3.5", 18 | "Programming Language :: Python :: 3.6", 19 | "Programming Language :: Python :: 3.7", 20 | "Programming Language :: Python :: 3.8", 21 | "Programming Language :: Python :: 3.9", 22 | "Programming Language :: Python :: 3.10", 23 | ] 24 | license = {file = "LICENSE"} 25 | requires-python = ">=2.7" 26 | dependencies = [] 27 | dynamic = ["version"] 28 | 29 | [project.urls] 30 | Homepage = "https://github.com/nipreps/fmriprep" 31 | Documentation = "https://fmriprep.org" 32 | Paper = "https://doi.org/10.1038/s41592-018-0235-4" 33 | "Docker Images" = "https://hub.docker.com/r/nipreps/fmriprep/tags/" 34 | NiPreps = "https://www.nipreps.org/" 35 | 36 | [project.scripts] 37 | fmriprep-docker = "fmriprep_docker.__main__:main" 38 | 39 | # 40 | # Build tool configurations 41 | # 42 | 43 | [tool.hatch.build.targets.wheel] 44 | packages = ["src/fmriprep_docker"] 45 | 46 | [tool.hatch.version] 47 | source = "vcs" 48 | raw-options = { version_scheme = "nipreps-calver", root = ".." } 49 | 50 | [tool.hatch.build.hooks.vcs] 51 | version-file = "src/fmriprep_docker/_version.py" 52 | template = """\ 53 | # file generated by setuptools_scm 54 | # don't change, don't track in version control 55 | __version__ = version = {version!r} 56 | __version_tuple__ = version_tuple = {version_tuple!r} 57 | """ 58 | 59 | [tool.distutils.bdist_wheel] 60 | universal = true 61 | 62 | # 63 | # Developer tool configurations 64 | # 65 | 66 | # Disable black 67 | [tool.black] 68 | exclude = ".*" 69 | 70 | [tool.ruff] 71 | line-length = 99 72 | 73 | [tool.ruff.lint] 74 | extend-select = [ 75 | "F", 76 | "E", 77 | "W", 78 | "I", 79 | "YTT", 80 | "BLE", 81 | "B", 82 | "A", 83 | # "CPY", 84 | "C4", 85 | "DTZ", 86 | "T10", 87 | # "EM", 88 | "EXE", 89 | "FA", 90 | "ISC", 91 | "ICN", 92 | "PT", 93 | "Q", 94 | ] 95 | ignore = [ 96 | "S311", # We are not using random for cryptographic purposes 97 | ] 98 | 99 | [tool.ruff.lint.flake8-quotes] 100 | inline-quotes = "single" 101 | 102 | [tool.ruff.lint.extend-per-file-ignores] 103 | "*/test_*.py" = ["S101"] 104 | "fmriprep/utils/debug.py" = ["A002", "T100"] 105 | "docs/conf.py" = ["A001"] 106 | 107 | [tool.ruff.format] 108 | quote-style = "single" 109 | -------------------------------------------------------------------------------- /wrapper/src/fmriprep_docker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nipreps/fmriprep/dfd7d296f115468491b1fab1dba5e5553e7c2d67/wrapper/src/fmriprep_docker/__init__.py --------------------------------------------------------------------------------