@brainpilot/skills 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
- package/skills/01_Meta-Skills/contribute-skill/SKILL.md +277 -0
- package/skills/01_Meta-Skills/contribute-skills-via-pr/SKILL.md +163 -0
- package/skills/01_Meta-Skills/paper-to-skill/SKILL.md +435 -0
- package/skills/01_Meta-Skills/paper-to-skill/references/extraction-guide.md +286 -0
- package/skills/01_Meta-Skills/paper-to-skill/references/skill-template.md +250 -0
- package/skills/01_Meta-Skills/repo-to-skill/SKILL.md +289 -0
- package/skills/01_Meta-Skills/share-case/SKILL.md +253 -0
- package/skills/01_Meta-Skills/share-usage/README.md +63 -0
- package/skills/01_Meta-Skills/share-usage/SKILL.md +395 -0
- package/skills/01_Meta-Skills/verify-skill/SKILL.md +331 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/SKILL.md +194 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/references/effect-sizes.md +352 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/references/sample-size-guide.md +407 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-statistics/SKILL.md +361 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-statistics/references/common-analyses.md +517 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-visualization/SKILL.md +292 -0
- package/skills/02_Cross-Domain_Foundation/cogsci-visualization/references/plot-recipes.md +709 -0
- package/skills/02_Cross-Domain_Foundation/research-literacy/SKILL.md +286 -0
- package/skills/02_Cross-Domain_Foundation/research-literacy/references/common-assumptions.md +320 -0
- package/skills/02_Cross-Domain_Foundation/research-literacy/references/planning-template.md +143 -0
- package/skills/03_Cognitive_Psychology/alternative-uses-task-designer/SKILL.md +197 -0
- package/skills/03_Cognitive_Psychology/alternative-uses-task-designer/references/instruction-templates.md +60 -0
- package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/SKILL.md +246 -0
- package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/references/classic-paradigms.md +435 -0
- package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/references/design-principles.md +256 -0
- package/skills/03_Cognitive_Psychology/creativity-self-efficacy-mediation/SKILL.md +270 -0
- package/skills/03_Cognitive_Psychology/creativity-self-efficacy-mediation/references/lavaan-templates.md +172 -0
- package/skills/03_Cognitive_Psychology/divergent-thinking-scoring/SKILL.md +238 -0
- package/skills/03_Cognitive_Psychology/divergent-thinking-scoring/references/scoring-rubric.md +143 -0
- package/skills/03_Cognitive_Psychology/drift-diffusion-model/SKILL.md +203 -0
- package/skills/03_Cognitive_Psychology/drift-diffusion-model/references/fitting-guide.md +571 -0
- package/skills/03_Cognitive_Psychology/drift-diffusion-model/references/model-variants.md +427 -0
- package/skills/03_Cognitive_Psychology/evidence-accumulation-selector/SKILL.md +310 -0
- package/skills/03_Cognitive_Psychology/evidence-accumulation-selector/references/ez-diffusion-formulas.md +137 -0
- package/skills/03_Cognitive_Psychology/signal-detection-analysis/SKILL.md +300 -0
- package/skills/03_Cognitive_Psychology/signal-detection-analysis/references/application-guide.md +278 -0
- package/skills/03_Cognitive_Psychology/signal-detection-analysis/references/sdt-formulas.md +318 -0
- package/skills/03_Cognitive_Psychology/visual-search-array-generator/SKILL.md +283 -0
- package/skills/03_Cognitive_Psychology/visual-search-array-generator/references/array-generation-parameters.yaml +111 -0
- package/skills/04_Psycholinguistics/reading-time-analysis/SKILL.md +301 -0
- package/skills/04_Psycholinguistics/reading-time-analysis/references/measure-computation-guide.md +195 -0
- package/skills/04_Psycholinguistics/self-paced-reading-designer/SKILL.md +257 -0
- package/skills/04_Psycholinguistics/self-paced-reading-designer/references/analysis-guide.md +356 -0
- package/skills/04_Psycholinguistics/self-paced-reading-designer/references/region-segmentation.md +266 -0
- package/skills/04_Psycholinguistics/sentence-stimulus-norming/SKILL.md +346 -0
- package/skills/04_Psycholinguistics/sentence-stimulus-norming/references/lexical-databases-guide.md +184 -0
- package/skills/05_EEG_ERP/eeg-paradigm-designer/SKILL.md +226 -0
- package/skills/05_EEG_ERP/eeg-paradigm-designer/references/component-paradigm-map.md +276 -0
- package/skills/05_EEG_ERP/eeg-paradigm-designer/references/timing-parameters.md +244 -0
- package/skills/05_EEG_ERP/eeg-preprocessing-pipeline-guide/SKILL.md +367 -0
- package/skills/05_EEG_ERP/eeg-preprocessing-pipeline-guide/references/parameter-lookup-tables.md +138 -0
- package/skills/05_EEG_ERP/erp-analysis/SKILL.md +185 -0
- package/skills/05_EEG_ERP/erp-analysis/references/erp-components.md +447 -0
- package/skills/05_EEG_ERP/erp-analysis/references/preprocessing-pipeline.md +277 -0
- package/skills/05_EEG_ERP/erp-analysis/references/statistical-approaches.md +351 -0
- package/skills/05_EEG_ERP/mne-python-guide/SKILL.md +174 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/decoding.md +178 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/io_formats.md +160 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/preprocessing.md +259 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/simulation.md +173 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/source_localization.md +234 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/statistics.md +196 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/time_frequency.md +165 -0
- package/skills/05_EEG_ERP/mne-python-guide/references/visualization.md +175 -0
- package/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/SKILL.md +317 -0
- package/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/references/method-implementation-guide.md +116 -0
- package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/SKILL.md +296 -0
- package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/design-matrix-guide.md +214 -0
- package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/statistical-inference.md +288 -0
- package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/SKILL.md +274 -0
- package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/references/quality-control.md +336 -0
- package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/references/step-by-step-pipeline.md +380 -0
- package/skills/06_fMRI_Neuroimaging/fmri-task-design-guide/SKILL.md +264 -0
- package/skills/06_fMRI_Neuroimaging/fmri-task-design-guide/references/design-optimization-examples.md +114 -0
- package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/SKILL.md +273 -0
- package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/references/decoding-methods.md +170 -0
- package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/references/rsa-guide.md +266 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/SKILL.md +123 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/database-subjects.md +179 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/dataset-types.md +208 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/freesurfer-fmriprep.md +162 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/mapping-transforms.md +181 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/mni-utils.md +207 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/surface-analysis.md +219 -0
- package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/visualization.md +251 -0
- package/skills/07_Computational_Modeling/act-r-model-builder/SKILL.md +297 -0
- package/skills/07_Computational_Modeling/act-r-model-builder/references/model-patterns.md +197 -0
- package/skills/07_Computational_Modeling/act-r-model-builder/references/parameter-table.yaml +204 -0
- package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/SKILL.md +294 -0
- package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/references/diagnostics-checklist.md +351 -0
- package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/references/prior-selection-guide.md +241 -0
- package/skills/07_Computational_Modeling/parameter-recovery-checker/SKILL.md +269 -0
- package/skills/07_Computational_Modeling/parameter-recovery-checker/references/recovery-diagnostics.md +207 -0
- package/skills/08_Computational_Neuroscience/brain-connectivity-modeler/SKILL.md +317 -0
- package/skills/08_Computational_Neuroscience/brain-connectivity-modeler/references/method-implementation-guide.md +116 -0
- package/skills/08_Computational_Neuroscience/neural-decoding-analysis/SKILL.md +273 -0
- package/skills/08_Computational_Neuroscience/neural-decoding-analysis/references/decoding-methods.md +170 -0
- package/skills/08_Computational_Neuroscience/neural-decoding-analysis/references/rsa-guide.md +266 -0
- package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/SKILL.md +305 -0
- package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/references/data-requirements.md +60 -0
- package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/references/method-comparison.md +151 -0
- package/skills/08_Computational_Neuroscience/spiking-network-model-builder/SKILL.md +376 -0
- package/skills/08_Computational_Neuroscience/spiking-network-model-builder/references/hh-parameters.md +117 -0
- package/skills/08_Computational_Neuroscience/spiking-network-model-builder/references/network-regimes.md +130 -0
- package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/SKILL.md +258 -0
- package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/references/indicator-parameters.md +242 -0
- package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/references/pipeline-details.md +211 -0
- package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/SKILL.md +261 -0
- package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/references/opsin-catalog.md +124 -0
- package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/references/stimulation-parameters.md +304 -0
- package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/SKILL.md +367 -0
- package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/references/disconnection-guide.md +152 -0
- package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/references/vlsm-pipeline.md +182 -0
- package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/SKILL.md +250 -0
- package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/references/deficit-profiles.md +302 -0
- package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/references/test-catalog.md +304 -0
- package/skills/11_Developmental_Cognition/infant-looking-time-designer/SKILL.md +345 -0
- package/skills/11_Developmental_Cognition/infant-looking-time-designer/references/age-parameters.yaml +186 -0
- package/skills/12_Social_Cognition/tom-task-selector/SKILL.md +379 -0
- package/skills/12_Social_Cognition/tom-task-selector/references/task-database.md +317 -0
- package/skills/13_Visualization/nature-figure/README.md +442 -0
- package/skills/13_Visualization/nature-figure/SKILL.md +60 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-01-bar-charts.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-02-line-trends.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-03-heatmaps.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-04-scatter-bubble.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-05-radar-polar.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-06-distributions.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-07-forest-interval.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-08-area-stacked.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-09-image-plates.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-10-network-matrix.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_motivation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_observation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_observation_distillation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_contrastive.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_results_CEDAR.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_results_IEDB.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_schematic.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/RNAGenScape_schematic.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/figures/ablation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/figures/comparison.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/plot_ablation.py +86 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/plot_comparison.py +109 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/diffusion_swiss_roll.py +97 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/diffusion_swiss_roll.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.pdf +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.pdf +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.pdf +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_Ablation.py +64 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_GeneRegulatory.py +74 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_Trajectory.py +74 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/figures/idea.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/figures/illustration.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/plot_idea.py +76 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/plot_illustration.py +404 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_FPGM/figures/freq_prior.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_FPGM/plot_freq_prior.py +146 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_ablation_Cancer.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_ablation_IEDB.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_comparison_Cancer.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_comparison_IEDB.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/plot_bars.py +216 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/raw_data.py +125 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/manifold.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/manifold_holes.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_comparison_optimization.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_comparison_speed.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_sweep.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_comparison.py +228 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_hole_manifold.py +82 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_manifold.py +61 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_sweep.py +77 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/figures/comparison_posttraining.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/figures/comparison_radar.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/plot_comparison_radar.py +173 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/plot_posttraining.py +82 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/brute_force.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/correctness_by_category.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/correctness_by_subcategory.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/rewriting.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/selfcorrection_math.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_brute_force.py +248 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_correctness_by_category.py +132 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_correctness_by_subcategory.py +131 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_rewriting.py +105 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_selfcorrection_math.py +99 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/figures/composition_heatmap.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/figures/trend_by_month.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/plot_composition.py +81 -0
- package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/plot_trend.py +125 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig1-material-mechanism-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig2-spatial-imaging-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig3-in-vivo-efficacy-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig4-single-cell-systems-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/assets/gallery/fig5-validation-perturbation-rich.png +0 -0
- package/skills/13_Visualization/nature-figure/evals/evals.json +37 -0
- package/skills/13_Visualization/nature-figure/manifest.yaml +57 -0
- package/skills/13_Visualization/nature-figure/references/api.md +428 -0
- package/skills/13_Visualization/nature-figure/references/backend-selection.md +100 -0
- package/skills/13_Visualization/nature-figure/references/chart-types.md +281 -0
- package/skills/13_Visualization/nature-figure/references/common-patterns.md +350 -0
- package/skills/13_Visualization/nature-figure/references/demos.md +65 -0
- package/skills/13_Visualization/nature-figure/references/design-theory.md +436 -0
- package/skills/13_Visualization/nature-figure/references/figure-contract.md +93 -0
- package/skills/13_Visualization/nature-figure/references/nature-2026-observations.md +112 -0
- package/skills/13_Visualization/nature-figure/references/qa-contract.md +119 -0
- package/skills/13_Visualization/nature-figure/references/r-template-index.md +66 -0
- package/skills/13_Visualization/nature-figure/references/r-workflow.md +161 -0
- package/skills/13_Visualization/nature-figure/references/tutorials.md +251 -0
- package/skills/13_Visualization/nature-figure/static/core/contract.md +29 -0
- package/skills/13_Visualization/nature-figure/static/core/stance.md +37 -0
- package/skills/13_Visualization/nature-figure/static/fragments/backend/python.md +37 -0
- package/skills/13_Visualization/nature-figure/static/fragments/backend/r.md +44 -0
- package/skills/14_Writing/markdown-report-writing/SKILL.md +306 -0
- package/skills/14_Writing/markdown-report-writing/references/compatibility-matrix.md +72 -0
- package/skills/14_Writing/markdown-report-writing/references/templates.md +299 -0
- package/skills/15_Others/neuroimaging-power-guide/SKILL.md +324 -0
- package/skills/15_Others/neuroimaging-power-guide/references/effect-size-lookup-tables.md +102 -0
- package/skills/15_Others/neuroimaging-sample-size-calculator/SKILL.md +330 -0
- package/skills/15_Others/neuroimaging-sample-size-calculator/references/worked-examples.md +220 -0
package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/statistical-inference.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Statistical Inference for fMRI GLM Results
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
After fitting the GLM and computing contrast maps, the resulting statistical images (typically z-maps or t-maps) must be thresholded to identify statistically significant activations. Because approximately **100,000 voxels** are tested simultaneously, correction for multiple comparisons is essential (Poldrack et al., 2011, Ch. 6).
|
|
6
|
+
|
|
7
|
+
This reference provides detailed guidance on each correction method, its assumptions, strengths, and weaknesses.
|
|
8
|
+
|
|
9
|
+
## The Multiple Comparisons Problem
|
|
10
|
+
|
|
11
|
+
At a nominal alpha of 0.05, testing 100,000 voxels produces approximately **5,000 false positives** if no correction is applied. Two families of correction exist:
|
|
12
|
+
|
|
13
|
+
1. **Family-Wise Error Rate (FWE/FWER)**: Controls the probability of any false positive across all voxels. More conservative; fewer false positives, more false negatives
|
|
14
|
+
2. **False Discovery Rate (FDR)**: Controls the expected proportion of false positives among significant results. Less conservative; more discoveries, but some proportion are expected to be false
|
|
15
|
+
|
|
16
|
+
## Voxelwise Correction Methods
|
|
17
|
+
|
|
18
|
+
### Random Field Theory (RFT) FWE
|
|
19
|
+
|
|
20
|
+
**Method**: Uses the smoothness of the statistical map to estimate the number of independent tests (resolution elements, or "resels"), then applies a correction based on the expected Euler characteristic of the thresholded random field (Worsley et al., 1996).
|
|
21
|
+
|
|
22
|
+
**Assumptions** (all must be met):
|
|
23
|
+
- Data are sufficiently smooth (FWHM of smoothness > **3x voxel size**; Worsley et al., 1996)
|
|
24
|
+
- The error fields are a good lattice approximation to a continuous Gaussian random field
|
|
25
|
+
- The smoothness estimate is accurate (requires > **20 degrees of freedom** for reliable estimation; Worsley et al., 1996)
|
|
26
|
+
|
|
27
|
+
**When to use**: When you expect highly localized activations and need the strictest control of false positives.
|
|
28
|
+
|
|
29
|
+
**Typical threshold**: p < 0.05, FWE-corrected (corresponds to z > approximately **4.5-5.0** for typical whole-brain analyses).
|
|
30
|
+
|
|
31
|
+
**Limitations**: Very conservative; may miss real but distributed effects.
|
|
32
|
+
|
|
33
|
+
### Bonferroni Correction
|
|
34
|
+
|
|
35
|
+
**Method**: Divides the alpha level by the number of tests (voxels). Threshold = 0.05 / n_voxels.
|
|
36
|
+
|
|
37
|
+
**When to use**: When you have a small number of tests (e.g., a few pre-specified ROIs). For whole-brain analysis, this is excessively conservative because it ignores spatial correlation (the data are smooth, so neighboring voxels are not independent).
|
|
38
|
+
|
|
39
|
+
**Typical threshold**: For 100,000 voxels, p < 0.0000005 (z > 4.93). This is slightly more conservative than RFT-FWE because it does not account for smoothness.
|
|
40
|
+
|
|
41
|
+
### False Discovery Rate (FDR)
|
|
42
|
+
|
|
43
|
+
**Method**: The Benjamini-Hochberg procedure ranks all voxel p-values and applies an adaptive threshold such that the expected proportion of false positives among rejected voxels is controlled at q (Benjamini & Hochberg, 1995; Genovese et al., 2002).
|
|
44
|
+
|
|
45
|
+
**Advantages:**
|
|
46
|
+
- More powerful than FWER methods when effects are distributed across many voxels
|
|
47
|
+
- Adaptive: the threshold adjusts based on the signal present in the data
|
|
48
|
+
- Does not require assumptions about smoothness
|
|
49
|
+
|
|
50
|
+
**When to use**: When you expect distributed activations across many brain regions and can tolerate a known proportion of false positives.
|
|
51
|
+
|
|
52
|
+
**Typical threshold**: q < 0.05 (5% of detected voxels are expected to be false positives).
|
|
53
|
+
|
|
54
|
+
**Limitations**: The actual threshold depends on the data, so it cannot be predicted in advance. When signal is sparse, FDR can be as conservative as FWE.
|
|
55
|
+
|
|
56
|
+
## Cluster-Based Inference
|
|
57
|
+
|
|
58
|
+
### How It Works
|
|
59
|
+
|
|
60
|
+
Cluster-based inference is a two-stage procedure:
|
|
61
|
+
|
|
62
|
+
1. **Stage 1 -- Cluster-defining threshold (CDT)**: Threshold the statistical map at an uncorrected p-value (e.g., p < 0.001). This defines contiguous clusters of suprathreshold voxels
|
|
63
|
+
2. **Stage 2 -- Cluster-level correction**: For each cluster, compute the probability of observing a cluster of that size (or larger) by chance, given the estimated smoothness. Retain only clusters with corrected p < 0.05
|
|
64
|
+
|
|
65
|
+
### The Critical CDT Choice
|
|
66
|
+
|
|
67
|
+
The CDT is the most consequential decision in cluster-based inference. **This is where many fMRI analyses go wrong.**
|
|
68
|
+
|
|
69
|
+
| CDT | Validity | False Positive Rate | Source |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| p < 0.001 | Valid | Near nominal (5%) for parametric methods | Eklund et al., 2016 |
|
|
72
|
+
| p < 0.01 | **Invalid** | **Up to 60-70%** instead of 5% | Eklund et al., 2016 |
|
|
73
|
+
| p < 0.05 | **Severely invalid** | Dramatically inflated | Eklund et al., 2016 |
|
|
74
|
+
|
|
75
|
+
**The Eklund et al. (2016) findings**: Using resting-state fMRI data from 499 healthy controls to create null (no-task) datasets, the authors performed 3 million task group analyses across SPM, FSL, and AFNI. They found that parametric cluster-based inference with a CDT of p < 0.01 produced false positive rates up to **70%** (instead of the nominal 5%). With a CDT of p < 0.001, false positive rates were much closer to nominal, though still somewhat inflated in some software packages (Eklund et al., 2016).
|
|
76
|
+
|
|
77
|
+
**Mandatory practice**: Always use a CDT of **p < 0.001** (uncorrected) or stricter for cluster-based inference. The commonly used CDT of p < 0.01 is demonstrably invalid.
|
|
78
|
+
|
|
79
|
+
### Cluster-Based Inference Limitations
|
|
80
|
+
|
|
81
|
+
Even with valid CDT, cluster-based inference has inherent limitations:
|
|
82
|
+
|
|
83
|
+
1. **No spatial specificity within clusters**: A significant cluster only tells you that the cluster as a whole is unlikely to have occurred by chance. Individual voxels within the cluster are not individually significant (Woo et al., 2014)
|
|
84
|
+
2. **Bias toward large clusters**: Large, diffuse activations are more likely to be detected than small, focal activations, regardless of effect size
|
|
85
|
+
3. **Non-stationarity**: The smoothness of fMRI data varies across the brain (e.g., more smoothing near sulci). Standard cluster-based inference assumes uniform smoothness, which can inflate false positives in smooth regions and reduce power in less smooth regions (Worsley et al., 1999)
|
|
86
|
+
|
|
87
|
+
## Threshold-Free Cluster Enhancement (TFCE)
|
|
88
|
+
|
|
89
|
+
### Method
|
|
90
|
+
|
|
91
|
+
TFCE (Smith & Nichols, 2009) avoids the arbitrary CDT by integrating cluster-like information across all possible thresholds. For each voxel, the TFCE score aggregates the extent (cluster size) and height (statistical value) of the cluster containing that voxel at every possible threshold level.
|
|
92
|
+
|
|
93
|
+
The TFCE-transformed image is then submitted to permutation testing to obtain FWE-corrected p-values for each voxel.
|
|
94
|
+
|
|
95
|
+
### Parameters
|
|
96
|
+
|
|
97
|
+
The TFCE transformation uses two exponents:
|
|
98
|
+
- **E** (extent weight): default = **0.5** (Smith & Nichols, 2009)
|
|
99
|
+
- **H** (height weight): default = **2.0** (Smith & Nichols, 2009)
|
|
100
|
+
|
|
101
|
+
These defaults were chosen to approximate the sensitivity of cluster-based inference while providing voxelwise specificity (Smith & Nichols, 2009).
|
|
102
|
+
|
|
103
|
+
### Advantages
|
|
104
|
+
|
|
105
|
+
- No arbitrary cluster-forming threshold
|
|
106
|
+
- Provides voxelwise inference (unlike cluster-based methods)
|
|
107
|
+
- Generally more sensitive than both voxelwise and cluster-based RFT approaches across a range of signal shapes (Smith & Nichols, 2009)
|
|
108
|
+
- Combined with permutation testing, makes no distributional assumptions
|
|
109
|
+
|
|
110
|
+
### Limitations
|
|
111
|
+
|
|
112
|
+
- Requires permutation testing (computationally expensive)
|
|
113
|
+
- The E and H parameters, while empirically justified, are still somewhat arbitrary
|
|
114
|
+
- Less widely implemented than parametric cluster-based methods (primarily available in FSL's randomise and standalone implementations)
|
|
115
|
+
|
|
116
|
+
### When to Use
|
|
117
|
+
|
|
118
|
+
TFCE is recommended as the default method when:
|
|
119
|
+
- Permutation testing is computationally feasible
|
|
120
|
+
- You want both sensitivity and spatial specificity
|
|
121
|
+
- You want to avoid choosing an arbitrary CDT
|
|
122
|
+
|
|
123
|
+
## Permutation Testing
|
|
124
|
+
|
|
125
|
+
### Method
|
|
126
|
+
|
|
127
|
+
Nonparametric permutation testing (Nichols & Holmes, 2002) generates the null distribution empirically by permuting the data (e.g., randomly flipping sign of contrast maps in a one-sample test, or shuffling group labels in a two-sample test), re-computing the test statistic under each permutation, and comparing the observed statistic to this null distribution.
|
|
128
|
+
|
|
129
|
+
### Number of Permutations
|
|
130
|
+
|
|
131
|
+
| Number of Permutations | Use Case | Source |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| 500 | Preliminary exploration only | Nichols & Holmes, 2002 |
|
|
134
|
+
| 1,000 | Minimum for any reported result | Nichols & Holmes, 2002 |
|
|
135
|
+
| 5,000 | Standard for publication | Nichols & Holmes, 2002 |
|
|
136
|
+
| 10,000 | Gold standard; gives stable p-values at p = 0.05 | Nichols & Holmes, 2002 |
|
|
137
|
+
|
|
138
|
+
**Domain insight**: With N permutations, the minimum achievable p-value is 1/(N+1). For 500 permutations, the minimum p-value is approximately 0.002, which is fine for detecting strong effects but insufficient for very stringent thresholds. For publication-quality results, use at least **5,000 permutations** (Nichols & Holmes, 2002).
|
|
139
|
+
|
|
140
|
+
### Advantages
|
|
141
|
+
|
|
142
|
+
- No assumptions about the noise distribution (valid even when parametric assumptions are violated)
|
|
143
|
+
- Controls FWE exactly (not approximately)
|
|
144
|
+
- Can be combined with any test statistic (voxelwise, cluster-based, TFCE)
|
|
145
|
+
- Gold standard for validation of parametric methods
|
|
146
|
+
|
|
147
|
+
### Limitations
|
|
148
|
+
|
|
149
|
+
- Computationally expensive (especially for large datasets)
|
|
150
|
+
- Requires exchangeability under the null hypothesis (met for most group analyses but not for within-subject time series)
|
|
151
|
+
- For one-sample tests, requires sign-flipping; sample size should be at least **12-15 subjects** for a reasonable number of unique permutations (with n subjects, there are 2^n sign-flip permutations; n=12 gives 4,096 permutations; Nichols & Holmes, 2002)
|
|
152
|
+
|
|
153
|
+
### Software Implementation
|
|
154
|
+
|
|
155
|
+
| Software | Tool | Permutation Types |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| FSL | randomise | Voxelwise, cluster, TFCE; sign-flipping, group shuffling |
|
|
158
|
+
| Nilearn | non_parametric_inference | Sign-flipping for second-level models |
|
|
159
|
+
| SnPM (SPM extension) | SnPM | Voxelwise and cluster permutation |
|
|
160
|
+
| PALM (FSL extension) | palm | Multi-modal permutation with TFCE support |
|
|
161
|
+
|
|
162
|
+
## Region of Interest (ROI) Analysis
|
|
163
|
+
|
|
164
|
+
ROI analysis tests hypotheses in pre-specified brain regions, reducing the multiple comparisons burden.
|
|
165
|
+
|
|
166
|
+
### Approaches
|
|
167
|
+
|
|
168
|
+
#### A Priori ROI (Preferred)
|
|
169
|
+
|
|
170
|
+
Define ROIs based on prior literature or anatomical atlases before analyzing the data.
|
|
171
|
+
|
|
172
|
+
| ROI Source | Approach | Advantages |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| Anatomical atlas | Use standard atlases (AAL, Harvard-Oxford, Desikan-Killiany) | Reproducible, unbiased |
|
|
175
|
+
| Prior study coordinates | Spherical ROI around published peak coordinate (radius **6-10 mm**; Poldrack et al., 2011, Ch. 6) | Theory-driven |
|
|
176
|
+
| Functional localizer | Independent scan to identify functional region (e.g., FFA from face localizer) | Individually tailored |
|
|
177
|
+
|
|
178
|
+
**Typical sphere radius**: **6-8 mm** for cortical regions, **4-6 mm** for subcortical structures (smaller due to smaller structures; Poldrack et al., 2011, Ch. 6).
|
|
179
|
+
|
|
180
|
+
#### Leave-One-Subject-Out (LOSO) ROI
|
|
181
|
+
|
|
182
|
+
When no independent localizer is available, define the ROI from the group analysis excluding the subject to be tested:
|
|
183
|
+
|
|
184
|
+
1. Run the group analysis N times, each time leaving out one subject
|
|
185
|
+
2. For each iteration, define the ROI from the N-1 group map
|
|
186
|
+
3. Extract the left-out subject's data from this independently defined ROI
|
|
187
|
+
4. Test effects on the extracted values
|
|
188
|
+
|
|
189
|
+
This avoids circularity while using data-driven ROI definition (Esterman et al., 2010).
|
|
190
|
+
|
|
191
|
+
#### Functional Localizer
|
|
192
|
+
|
|
193
|
+
An independent scanning run designed to identify a specific functional region (e.g., fusiform face area, motion-selective area MT+; Saxe et al., 2006).
|
|
194
|
+
|
|
195
|
+
**Domain warning**: Even functional localizers require a threshold choice, and the ROI definition can influence results. Report the contrast, threshold, and minimum cluster size used to define the ROI.
|
|
196
|
+
|
|
197
|
+
### ROI Correction
|
|
198
|
+
|
|
199
|
+
Within-ROI analysis still requires correction if multiple voxels within the ROI are tested:
|
|
200
|
+
- **Small volume correction (SVC)**: Apply RFT-FWE correction within the ROI volume only (Worsley et al., 1996)
|
|
201
|
+
- **Mean extraction**: Average the parameter estimate or contrast value across all voxels in the ROI, producing a single value per subject. Then test this single value with a standard t-test. No multiple comparison correction is needed because there is one test per ROI (Poldrack et al., 2011, Ch. 6)
|
|
202
|
+
- **If testing multiple ROIs**: Apply Bonferroni or FDR correction across the number of ROIs tested
|
|
203
|
+
|
|
204
|
+
### Avoiding Circular ROI Selection
|
|
205
|
+
|
|
206
|
+
As established by Kriegeskorte et al. (2009), defining an ROI based on the same contrast you intend to test creates circular (non-independent) analysis. This inflates effect sizes and produces invalid p-values.
|
|
207
|
+
|
|
208
|
+
**Valid approaches:**
|
|
209
|
+
- A priori anatomical ROIs
|
|
210
|
+
- Functional localizer from independent data
|
|
211
|
+
- LOSO procedure
|
|
212
|
+
- Orthogonal contrast for ROI definition (e.g., define ROI by main effect of task, test interaction within that ROI)
|
|
213
|
+
|
|
214
|
+
**Invalid approaches:**
|
|
215
|
+
- Select voxels based on Condition A > B, then test Condition A > B in those voxels (inflated effect)
|
|
216
|
+
- Use the group t-map to define "activated" regions, then report mean activation in those regions
|
|
217
|
+
|
|
218
|
+
## Decision Tree: Choosing an Inference Method
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
What is your primary research question?
|
|
222
|
+
|
|
|
223
|
+
+-- Specific ROI hypothesis (e.g., "is hippocampus active?")
|
|
224
|
+
| |
|
|
225
|
+
| +-- A priori ROI available?
|
|
226
|
+
| |
|
|
227
|
+
| +-- YES --> Extract mean from ROI, simple t-test (no MCP needed)
|
|
228
|
+
| | OR small volume correction within ROI
|
|
229
|
+
| |
|
|
230
|
+
| +-- NO --> LOSO ROI or functional localizer
|
|
231
|
+
|
|
|
232
|
+
+-- Whole-brain analysis
|
|
233
|
+
|
|
|
234
|
+
+-- Is permutation testing feasible (< 50,000 voxels, < 1 day compute)?
|
|
235
|
+
|
|
|
236
|
+
+-- YES --> TFCE with permutation testing (recommended default)
|
|
237
|
+
| OR cluster-based permutation (if spatial extent is of interest)
|
|
238
|
+
|
|
|
239
|
+
+-- NO --> Is the effect expected to be focal or distributed?
|
|
240
|
+
|
|
|
241
|
+
+-- FOCAL --> Voxelwise RFT-FWE (most conservative, best spatial specificity)
|
|
242
|
+
|
|
|
243
|
+
+-- DISTRIBUTED --> Cluster-based RFT with CDT p < 0.001
|
|
244
|
+
OR FDR q < 0.05
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Reporting Statistical Results
|
|
248
|
+
|
|
249
|
+
Based on COBIDAS guidelines (Nichols et al., 2017):
|
|
250
|
+
|
|
251
|
+
### Required Information
|
|
252
|
+
|
|
253
|
+
- Inference method (voxelwise FWE, cluster-based, FDR, permutation, TFCE)
|
|
254
|
+
- For cluster-based: the cluster-defining threshold used
|
|
255
|
+
- For permutation: number of permutations
|
|
256
|
+
- For ROI analyses: how ROIs were defined, and whether correction was applied across ROIs
|
|
257
|
+
- Smoothing applied before group analysis (kernel FWHM in mm; typically **6-8 mm** for 2-mm voxels; Poldrack et al., 2011, Ch. 5)
|
|
258
|
+
- Coordinates of peak activations (in MNI or Talairach space)
|
|
259
|
+
- Cluster extent (number of voxels or volume in mm^3)
|
|
260
|
+
- Peak and cluster-level statistics and p-values
|
|
261
|
+
|
|
262
|
+
### Recommended Table Format
|
|
263
|
+
|
|
264
|
+
| Region | Cluster Size (voxels) | Peak Z | Peak MNI (x, y, z) | Cluster p (FWE) |
|
|
265
|
+
|---|---|---|---|---|
|
|
266
|
+
| L Inferior Frontal Gyrus | 342 | 5.12 | -48, 14, 22 | < 0.001 |
|
|
267
|
+
| R Fusiform Gyrus | 156 | 4.78 | 42, -52, -18 | 0.003 |
|
|
268
|
+
|
|
269
|
+
### Reporting Unthresholded Maps
|
|
270
|
+
|
|
271
|
+
In addition to thresholded results, consider uploading unthresholded statistical maps to NeuroVault (Gorgolewski et al., 2015) to facilitate meta-analysis and replication. This is increasingly expected by journals and reviewers.
|
|
272
|
+
|
|
273
|
+
## References
|
|
274
|
+
|
|
275
|
+
- Benjamini, Y., & Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to multiple testing. *Journal of the Royal Statistical Society B*, 57(1), 289-300.
|
|
276
|
+
- Eklund, A., Nichols, T. E., & Knutsson, H. (2016). Cluster failure: Why fMRI inferences for spatial extent have inflated false-positive rates. *PNAS*, 113(28), 7900-7905.
|
|
277
|
+
- Esterman, M., Tamber-Rosenau, B. J., Chiu, Y. C., & Yantis, S. (2010). Avoiding non-independence in fMRI data analysis: Leave one subject out. *NeuroImage*, 50(2), 572-576.
|
|
278
|
+
- Genovese, C. R., Lazar, N. A., & Nichols, T. (2002). Thresholding of statistical maps in functional neuroimaging using the false discovery rate. *NeuroImage*, 15(4), 870-878.
|
|
279
|
+
- Gorgolewski, K. J., Varoquaux, G., Rivera, G., et al. (2015). NeuroVault.org: A web-based repository for collecting and sharing unthresholded statistical maps of the human brain. *Frontiers in Neuroinformatics*, 9, 8.
|
|
280
|
+
- Kriegeskorte, N., Simmons, W. K., Bellgowan, P. S., & Baker, C. I. (2009). Circular analysis in systems neuroscience: The dangers of double dipping. *Nature Neuroscience*, 12(5), 535-540.
|
|
281
|
+
- Nichols, T. E., Das, S., Eickhoff, S. B., et al. (2017). Best practices in data analysis and sharing in neuroimaging using MRI (COBIDAS). *Nature Neuroscience*, 20(3), 299-303.
|
|
282
|
+
- Nichols, T. E., & Holmes, A. P. (2002). Nonparametric permutation tests for functional neuroimaging: A primer with examples. *Human Brain Mapping*, 15(1), 1-25.
|
|
283
|
+
- Poldrack, R. A., Mumford, J. A., & Nichols, T. E. (2011). *Handbook of Functional MRI Data Analysis*. Cambridge University Press.
|
|
284
|
+
- Saxe, R., Brett, M., & Kanwisher, N. (2006). Divide and conquer: A defense of functional localizers. *NeuroImage*, 30(4), 1088-1096.
|
|
285
|
+
- Smith, S. M., & Nichols, T. E. (2009). Threshold-free cluster enhancement: Addressing problems of smoothing, threshold dependence and localisation in cluster inference. *NeuroImage*, 44(1), 83-98.
|
|
286
|
+
- Woo, C. W., Krishnan, A., & Wager, T. D. (2014). Cluster-extent based thresholding in fMRI analyses: Pitfalls and recommendations. *NeuroImage*, 91, 412-419.
|
|
287
|
+
- Worsley, K. J., Andermann, M., Koulis, T., MacDonald, D., & Evans, A. C. (1999). Detecting changes in nonisotropic images. *Human Brain Mapping*, 8(2-3), 98-101.
|
|
288
|
+
- Worsley, K. J., Marrett, S., Neelin, P., Vandal, A. C., Friston, K. J., & Evans, A. C. (1996). A unified statistical approach for determining significant signals in images of cerebral activation. *Human Brain Mapping*, 4(1), 58-73.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "fmri-preprocessing-pipeline-guide"
|
|
3
|
+
description: "Domain-validated guidance for fMRI preprocessing decisions: motion correction, slice timing, spatial normalization, smoothing, confound regression, and quality control"
|
|
4
|
+
domain: "neuroimaging-methodology"
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
authors:
|
|
7
|
+
- "awesome_cognitive_and_neuroscience_skills contributors"
|
|
8
|
+
papers:
|
|
9
|
+
- "Poldrack, Mumford, & Nichols, 2011"
|
|
10
|
+
- "Esteban et al., 2019"
|
|
11
|
+
- "Power et al., 2012"
|
|
12
|
+
- "Power et al., 2014"
|
|
13
|
+
- "Jenkinson et al., 2002"
|
|
14
|
+
- "Sladky et al., 2011"
|
|
15
|
+
- "Ashburner & Friston, 2005"
|
|
16
|
+
dependencies:
|
|
17
|
+
required:
|
|
18
|
+
- research-literacy
|
|
19
|
+
recommended:
|
|
20
|
+
- fmri-glm-analysis-guide
|
|
21
|
+
review_status: "ai-generated"
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# fMRI Preprocessing Pipeline Guide
|
|
25
|
+
|
|
26
|
+
## Purpose
|
|
27
|
+
|
|
28
|
+
fMRI preprocessing transforms raw scanner data into a form suitable for statistical analysis. Unlike generic data cleaning, every preprocessing decision in fMRI involves domain-specific trade-offs: choosing the wrong step order can introduce artifacts that mimic neural signal, smoothing at the wrong scale destroys the spatial information needed for multivariate analyses, and failing to correct for susceptibility distortions misaligns brain regions by several millimeters.
|
|
29
|
+
|
|
30
|
+
A competent programmer without neuroimaging training would get many of these decisions wrong. This skill encodes the domain knowledge required to make correct preprocessing choices for different analysis goals.
|
|
31
|
+
|
|
32
|
+
## When to Use This Skill
|
|
33
|
+
|
|
34
|
+
- Setting up a preprocessing pipeline for task fMRI, resting-state fMRI, or MVPA
|
|
35
|
+
- Choosing between preprocessing tools (fMRIPrep, FSL, SPM, AFNI)
|
|
36
|
+
- Deciding which steps to include, skip, or modify for a specific analysis type
|
|
37
|
+
- Performing quality control on preprocessed data
|
|
38
|
+
- Reviewing or troubleshooting an existing preprocessing pipeline
|
|
39
|
+
- Selecting parameters for motion correction, smoothing, or normalization
|
|
40
|
+
|
|
41
|
+
## Research Planning Protocol
|
|
42
|
+
|
|
43
|
+
Before executing the domain-specific steps below, you MUST:
|
|
44
|
+
|
|
45
|
+
1. **State the research question** — What analysis will follow preprocessing and what does it require?
|
|
46
|
+
2. **Justify the preprocessing choices** — Why these steps in this order? What alternatives were considered?
|
|
47
|
+
3. **Declare expected quality metrics** — What motion thresholds, SNR values, and exclusion criteria will you use?
|
|
48
|
+
4. **Note assumptions and limitations** — What does this pipeline assume about the data? Where could it mislead?
|
|
49
|
+
5. **Present the plan to the user and WAIT for confirmation** before proceeding.
|
|
50
|
+
|
|
51
|
+
For detailed methodology guidance, see the `research-literacy` skill.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## ⚠️ Verification Notice
|
|
55
|
+
|
|
56
|
+
This skill was generated by AI from academic literature. All parameters, thresholds, and citations require independent verification before use in research. If you find errors, please [open an issue](https://github.com/HaoxuanLiTHUAI/awesome_cognitive_and_neuroscience_skills/issues).
|
|
57
|
+
|
|
58
|
+
## Pipeline Order Decision Tree
|
|
59
|
+
|
|
60
|
+
The standard preprocessing order is well-established, but branch points exist depending on the analysis type. The canonical order is:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
1. DICOM to NIfTI conversion (BIDS format)
|
|
64
|
+
2. Discard non-steady-state volumes
|
|
65
|
+
3. Slice timing correction (conditional)
|
|
66
|
+
4. Motion correction (rigid body)
|
|
67
|
+
5. Distortion correction (fieldmap-based)
|
|
68
|
+
6. Coregistration (functional to structural)
|
|
69
|
+
7. Spatial normalization (to MNI/template space)
|
|
70
|
+
8. Smoothing (conditional on analysis type)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Decision points:**
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Is your TR < 1 second (e.g., multiband)?
|
|
77
|
+
|
|
|
78
|
+
+-- YES --> Skip slice timing correction; use temporal derivative in GLM instead
|
|
79
|
+
| (Sladky et al., 2011; HCP consortium recommendation)
|
|
80
|
+
|
|
|
81
|
+
+-- NO --> Apply slice timing correction before motion correction
|
|
82
|
+
(AFNI and SPM convention; Sladky et al., 2011)
|
|
83
|
+
|
|
84
|
+
What is your analysis type?
|
|
85
|
+
|
|
|
86
|
+
+-- Task activation (univariate GLM)
|
|
87
|
+
| --> Full pipeline with smoothing (FWHM = 2-3x voxel size)
|
|
88
|
+
|
|
|
89
|
+
+-- Resting-state connectivity
|
|
90
|
+
| --> Full pipeline + aggressive confound regression; smoothing 4-6 mm
|
|
91
|
+
|
|
|
92
|
+
+-- MVPA / multivariate decoding
|
|
93
|
+
--> Full pipeline WITHOUT smoothing (or minimal, <= 2 mm)
|
|
94
|
+
Smooth only after first-level pattern extraction
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Core Preprocessing Steps
|
|
98
|
+
|
|
99
|
+
### Step 1: DICOM to NIfTI Conversion
|
|
100
|
+
|
|
101
|
+
Convert raw DICOM files to NIfTI format organized in BIDS (Brain Imaging Data Structure; Gorgolewski et al., 2016). BIDS standardizes file naming and metadata, enabling automated pipeline tools like fMRIPrep to detect acquisition parameters automatically.
|
|
102
|
+
|
|
103
|
+
**Tools**: `dcm2niix` (Li et al., 2016), `heudiconv`, `BIDScoin`
|
|
104
|
+
|
|
105
|
+
### Step 2: Discard Non-Steady-State Volumes
|
|
106
|
+
|
|
107
|
+
The first few volumes of an fMRI run are acquired before the MR signal reaches T1 equilibrium, producing artificially high signal intensity. Discard the first **3-5 volumes** (approximately 5-10 seconds) unless the scanner automatically acquired dummy scans (Poldrack et al., 2011, Ch. 5).
|
|
108
|
+
|
|
109
|
+
**Domain insight**: Modern scanners often acquire dummy scans that are not saved. Check the acquisition protocol. fMRIPrep detects non-steady-state volumes automatically using signal intensity changes.
|
|
110
|
+
|
|
111
|
+
### Step 3: Slice Timing Correction
|
|
112
|
+
|
|
113
|
+
Within each TR, slices are acquired sequentially (not simultaneously), creating temporal offsets of up to one full TR between first and last slices. Slice timing correction (STC) interpolates each slice to a common time point (Sladky et al., 2011).
|
|
114
|
+
|
|
115
|
+
| Condition | Recommendation | Rationale |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| TR > 2 s, interleaved acquisition | **Always apply STC** | Temporal offset is large; significant benefit (Sladky et al., 2011) |
|
|
118
|
+
| TR 1-2 s | Apply STC; moderate benefit | Still corrects meaningful timing offsets |
|
|
119
|
+
| TR < 1 s (multiband) | **Skip STC**; use temporal derivative in GLM | Minimal offset; correction provides negligible benefit (HCP consortium) |
|
|
120
|
+
| Using dynamic causal modeling (DCM) | **Mandatory STC** | DCM requires precise timing alignment across regions |
|
|
121
|
+
|
|
122
|
+
**Order debate**: STC before motion correction is standard in AFNI and SPM. FSL applies STC after motion correction. Both are acceptable; the optimal order depends on the level of motion and slice acquisition pattern (Parker & Razlighi, 2019). Ideally, joint correction would be applied (Roche, 2011), but this is not yet standard in major packages.
|
|
123
|
+
|
|
124
|
+
### Step 4: Motion Correction
|
|
125
|
+
|
|
126
|
+
Align all volumes to a reference volume using **6-parameter rigid body** (3 translation, 3 rotation) transformation (Jenkinson et al., 2002). This is the single most critical preprocessing step.
|
|
127
|
+
|
|
128
|
+
| Parameter | Recommendation | Source |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| Degrees of freedom | **6** (rigid body) | Jenkinson et al., 2002 |
|
|
131
|
+
| Reference volume | Mean image or middle volume | Jenkinson et al., 2002 |
|
|
132
|
+
| Cost function | Normalized correlation | Jenkinson et al., 2002 (MCFLIRT default) |
|
|
133
|
+
| Interpolation | Trilinear (during estimation); sinc or spline (final reslice) | Poldrack et al., 2011, Ch. 5 |
|
|
134
|
+
|
|
135
|
+
**Domain insight**: Motion correction is inherently imperfect because each slice within a volume was acquired at a different time. When the head moves during a TR, each slice has a slightly different rigid-body transformation, but whole-volume correction applies a single transformation. This is an unavoidable limitation (Jenkinson et al., 2002).
|
|
136
|
+
|
|
137
|
+
**Output**: Save the 6 motion parameters for use as confound regressors in the GLM (see `fmri-glm-analysis-guide`).
|
|
138
|
+
|
|
139
|
+
### Step 5: Distortion Correction
|
|
140
|
+
|
|
141
|
+
EPI images suffer geometric distortions along the phase-encoding direction due to B0 field inhomogeneities. Distortions are worst near air-tissue boundaries: orbitofrontal cortex, anterior temporal lobes, and inferior temporal regions (Jezzard & Balaban, 1995).
|
|
142
|
+
|
|
143
|
+
| Method | Data Required | Tool | Source |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| Fieldmap-based (FUGUE) | Dual-echo gradient echo fieldmap | FSL FUGUE | Jezzard & Balaban, 1995 |
|
|
146
|
+
| Reverse phase-encoding (TOPUP) | Opposite-PE EPI pair (AP/PA) | FSL TOPUP | Andersson et al., 2003 |
|
|
147
|
+
| SyN-based (fieldmapless) | T1-weighted image only | ANTs SyN-SDC | fMRIPrep fallback |
|
|
148
|
+
|
|
149
|
+
**Domain warning**: If no fieldmap data were acquired, fMRIPrep can perform fieldmapless distortion correction using nonlinear registration to the T1, but this is less accurate than fieldmap-based methods. Always acquire fieldmap data when possible.
|
|
150
|
+
|
|
151
|
+
### Step 6: Coregistration
|
|
152
|
+
|
|
153
|
+
Align the functional (EPI) image to the subject's structural (T1-weighted) image. This enables projecting functional results onto anatomical space and provides the bridge to template normalization.
|
|
154
|
+
|
|
155
|
+
- **Method**: Boundary-based registration (BBR; Greve & Fischl, 2009) is preferred over intensity-based methods for EPI-to-T1 alignment because it uses white matter boundaries, which are well-defined in both modalities
|
|
156
|
+
- **Always visually inspect** the coregistration overlay (functional edges on structural image)
|
|
157
|
+
|
|
158
|
+
### Step 7: Spatial Normalization
|
|
159
|
+
|
|
160
|
+
Warp each subject's brain to a standard template space to enable group-level comparisons.
|
|
161
|
+
|
|
162
|
+
| Parameter | Recommendation | Source |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| Template | **MNI152NLin2009cAsym** (fMRIPrep default) or MNI152NLin6Asym | Fonov et al., 2011 |
|
|
165
|
+
| Method | Nonlinear (ANTs SyN or SPM Unified Segmentation) | Ashburner & Friston, 2005; Avants et al., 2008 |
|
|
166
|
+
| Output resolution | **2 mm isotropic** (standard) | Convention; matches MNI template resolution |
|
|
167
|
+
| For high-resolution data | Match native resolution (e.g., 1.5 mm) | Preserve spatial detail |
|
|
168
|
+
|
|
169
|
+
**Domain warning**: Always visually inspect normalization quality. Check that major sulci (central sulcus, Sylvian fissure) and subcortical structures (caudate, putamen) align with the template. Poor normalization is a common but silent source of error in group analyses.
|
|
170
|
+
|
|
171
|
+
### Step 8: Spatial Smoothing
|
|
172
|
+
|
|
173
|
+
Smoothing with a Gaussian kernel increases SNR, satisfies the smoothness assumptions of Random Field Theory, and reduces inter-subject anatomical variability (Mikl et al., 2008).
|
|
174
|
+
|
|
175
|
+
| Analysis Type | FWHM Recommendation | Rationale | Source |
|
|
176
|
+
|---|---|---|---|
|
|
177
|
+
| Univariate (task GLM) | **2-3x voxel size** (e.g., 6-8 mm for 2-3 mm voxels) | Matches expected activation extent; maximizes sensitivity | Mikl et al., 2008; Poldrack et al., 2011 |
|
|
178
|
+
| Resting-state connectivity | **4-6 mm** | Moderate smoothing; balance noise reduction and spatial specificity | Ciric et al., 2017 |
|
|
179
|
+
| MVPA / decoding | **None or <= 2 mm** | Smoothing destroys fine-grained spatial patterns essential for decoding | Misaki et al., 2013 |
|
|
180
|
+
| Searchlight analysis | **None** | Searchlight already averages within the sphere | Etzel et al., 2013 |
|
|
181
|
+
|
|
182
|
+
**Domain warning**: Smoothing before MVPA is one of the most common preprocessing errors. For multivariate analyses, skip smoothing during preprocessing entirely. If group-level smoothing is needed, apply it only after the first-level pattern analysis is complete (Misaki et al., 2013).
|
|
183
|
+
|
|
184
|
+
### Step 9: Confound Regression
|
|
185
|
+
|
|
186
|
+
Confound regression removes variance from non-neural sources. This step is typically performed during the statistical model (GLM) rather than as a separate preprocessing step, but the preprocessing pipeline must output the confound time series.
|
|
187
|
+
|
|
188
|
+
For detailed confound regression guidance, see the `fmri-glm-analysis-guide` skill.
|
|
189
|
+
|
|
190
|
+
**Key confounds to extract during preprocessing:**
|
|
191
|
+
- 6 motion parameters (from Step 4) and their temporal derivatives and squared terms (24-parameter model; Friston et al., 1996)
|
|
192
|
+
- Framewise displacement (FD; Power et al., 2012)
|
|
193
|
+
- DVARS (Power et al., 2012)
|
|
194
|
+
- aCompCor components from white matter and CSF (Behzadi et al., 2007)
|
|
195
|
+
- Global signal (optional; controversial for connectivity analyses; Murphy & Fox, 2017)
|
|
196
|
+
|
|
197
|
+
## Pipeline Variants by Analysis Type
|
|
198
|
+
|
|
199
|
+
| Step | Task Activation | Resting-State Connectivity | MVPA |
|
|
200
|
+
|---|---|---|---|
|
|
201
|
+
| Non-steady-state removal | Yes | Yes | Yes |
|
|
202
|
+
| Slice timing correction | Yes (if TR > 1 s) | Yes (if TR > 1 s) | Yes (if TR > 1 s) |
|
|
203
|
+
| Motion correction | Yes | Yes | Yes |
|
|
204
|
+
| Distortion correction | Yes | Yes | Yes |
|
|
205
|
+
| Coregistration | Yes | Yes | Yes |
|
|
206
|
+
| Normalization | Yes (2 mm) | Yes (2 mm) | Optional; can stay in native space |
|
|
207
|
+
| Smoothing | 6-8 mm FWHM | 4-6 mm FWHM | **None** |
|
|
208
|
+
| High-pass filter | 128 s (in GLM) | 0.01 Hz (in preprocessing) | 128 s (in GLM) |
|
|
209
|
+
| Band-pass filter | **No** | 0.01-0.1 Hz (controversial) | **No** |
|
|
210
|
+
| Motion threshold (FD) | 0.5 mm (spike regress) | **0.2 mm** (scrub or regress) | 0.5 mm |
|
|
211
|
+
| Confound model | 24-param + aCompCor | 36-param or aCompCor + GSR | Minimal (6-param motion) |
|
|
212
|
+
|
|
213
|
+
## fMRIPrep as the Recommended Standard
|
|
214
|
+
|
|
215
|
+
**fMRIPrep** (Esteban et al., 2019) is recommended as the default preprocessing tool for most fMRI studies. It provides:
|
|
216
|
+
|
|
217
|
+
- **Automated, analysis-agnostic preprocessing** that adapts to the specific dataset
|
|
218
|
+
- **Transparent, reproducible workflow** with detailed visual reports for QC
|
|
219
|
+
- **Best-in-breed algorithms**: ANTs for normalization, FreeSurfer for surface reconstruction, MCFLIRT/ANTs for motion correction
|
|
220
|
+
- **BIDS-compatible** input and output
|
|
221
|
+
- **Comprehensive confound time series** output (motion, CompCor, FD, DVARS)
|
|
222
|
+
|
|
223
|
+
**What fMRIPrep does NOT do:**
|
|
224
|
+
- Smoothing (intentionally left to the user because the optimal kernel depends on analysis type)
|
|
225
|
+
- Temporal filtering (left to the GLM stage)
|
|
226
|
+
- Confound regression (outputs confounds but does not regress them)
|
|
227
|
+
- Statistical analysis
|
|
228
|
+
|
|
229
|
+
**Domain insight**: fMRIPrep outputs the preprocessed BOLD data in both MNI space and native space. For MVPA, use the native-space output. For group analyses, use the MNI-space output.
|
|
230
|
+
|
|
231
|
+
## Common Pitfalls
|
|
232
|
+
|
|
233
|
+
1. **Smoothing before MVPA**: Spatial smoothing destroys the fine-grained voxel patterns that multivariate methods rely on. Skip smoothing entirely for MVPA and searchlight analyses (Misaki et al., 2013)
|
|
234
|
+
|
|
235
|
+
2. **Wrong interpolation for final reslicing**: Use sinc or spline interpolation for the final reslice step. Trilinear interpolation is acceptable during motion parameter estimation but introduces blurring in final images (Poldrack et al., 2011, Ch. 5)
|
|
236
|
+
|
|
237
|
+
3. **Not checking normalization quality**: Normalization can fail silently, especially in populations with atypical anatomy (older adults, patients with lesions, pediatric). Always visually inspect the overlap of normalized functional images with the template
|
|
238
|
+
|
|
239
|
+
4. **Motion-connectivity confound in resting-state**: Head motion creates spurious short-distance correlations and reduces long-distance correlations in functional connectivity (Power et al., 2012). For resting-state analyses, use stringent motion thresholds (FD < **0.2 mm**; Power et al., 2014) and aggressive confound regression (Ciric et al., 2017)
|
|
240
|
+
|
|
241
|
+
5. **Skipping distortion correction**: Without distortion correction, orbitofrontal and anterior temporal signals are mislocalized by several millimeters. This is especially problematic for studies of emotion, reward, and memory, which involve these regions (Jezzard & Balaban, 1995)
|
|
242
|
+
|
|
243
|
+
6. **Applying band-pass filtering for task fMRI**: Band-pass filtering (0.01-0.1 Hz) is appropriate for resting-state connectivity analysis but removes task-related signal in event-related and block designs. For task fMRI, use only high-pass filtering in the GLM
|
|
244
|
+
|
|
245
|
+
7. **Not discarding non-steady-state volumes**: The first few volumes have inflated signal intensity. If not removed, they can bias motion estimates and inflate variance (Poldrack et al., 2011, Ch. 5)
|
|
246
|
+
|
|
247
|
+
For detailed step-by-step parameters and software-specific guidance, see `references/step-by-step-pipeline.md`.
|
|
248
|
+
For quality control metrics, thresholds, and exclusion criteria, see `references/quality-control.md`.
|
|
249
|
+
|
|
250
|
+
## Key References
|
|
251
|
+
|
|
252
|
+
- Andersson, J. L. R., Skare, S., & Ashburner, J. (2003). How to correct susceptibility distortions in spin-echo echo-planar images: application to diffusion tensor imaging. *NeuroImage*, 20(2), 870-888.
|
|
253
|
+
- Ashburner, J., & Friston, K. J. (2005). Unified segmentation. *NeuroImage*, 26(3), 839-851.
|
|
254
|
+
- Avants, B. B., Epstein, C. L., Grossman, M., & Gee, J. C. (2008). Symmetric diffeomorphic image registration with cross-correlation. *Medical Image Analysis*, 12(1), 26-41.
|
|
255
|
+
- Behzadi, Y., Restom, K., Liau, J., & Liu, T. T. (2007). A component based noise correction method (CompCor) for BOLD and perfusion based fMRI. *NeuroImage*, 37(1), 90-101.
|
|
256
|
+
- Ciric, R., Wolf, D. H., Power, J. D., et al. (2017). Benchmarking of participant-level confound regression strategies. *NeuroImage*, 154, 174-187.
|
|
257
|
+
- Esteban, O., Birman, D., Schaer, M., et al. (2017). MRIQC: Advancing the automatic prediction of image quality in MRI from unseen sites. *PLoS ONE*, 12(9), e0184661.
|
|
258
|
+
- Esteban, O., Markiewicz, C. J., Blair, R. W., et al. (2019). fMRIPrep: a robust preprocessing pipeline for functional MRI. *Nature Methods*, 16, 111-116.
|
|
259
|
+
- Fonov, V. S., Evans, A. C., Botteron, K., et al. (2011). Unbiased average age-appropriate atlases for pediatric studies. *NeuroImage*, 54(1), 313-327.
|
|
260
|
+
- Friston, K. J., Williams, S., Howard, R., et al. (1996). Movement-related effects in fMRI time-series. *Magnetic Resonance in Medicine*, 35(3), 346-355.
|
|
261
|
+
- Gorgolewski, K. J., Auer, T., Calhoun, V. D., et al. (2016). The brain imaging data structure. *Scientific Data*, 3, 160044.
|
|
262
|
+
- Greve, D. N., & Fischl, B. (2009). Accurate and robust brain image alignment using boundary-based registration. *NeuroImage*, 48(1), 63-72.
|
|
263
|
+
- Jenkinson, M., Bannister, P., Brady, J. M., & Smith, S. M. (2002). Improved optimization for the robust and accurate linear registration and motion correction of brain images. *NeuroImage*, 17(2), 825-841.
|
|
264
|
+
- Jezzard, P., & Balaban, R. S. (1995). Correction for geometric distortion in echo planar images from B0 field variations. *Magnetic Resonance in Medicine*, 34(1), 65-73.
|
|
265
|
+
- Mikl, M., Marecek, R., Hlustik, P., et al. (2008). Effects of spatial smoothing on fMRI group inferences. *Magnetic Resonance Imaging*, 26(4), 490-503.
|
|
266
|
+
- Misaki, M., Luh, W. M., & Bandettini, P. A. (2013). The effect of spatial smoothing on fMRI decoding of columnar-level organization. *NeuroImage*, 78, 13-22.
|
|
267
|
+
- Murphy, K., & Fox, M. D. (2017). Towards a consensus regarding global signal regression for resting state functional connectivity MRI. *NeuroImage*, 154, 169-173.
|
|
268
|
+
- Parker, D. B., & Razlighi, Q. R. (2019). The benefit of slice timing correction in common fMRI preprocessing pipelines. *Frontiers in Neuroscience*, 13, 821.
|
|
269
|
+
- Poldrack, R. A., Mumford, J. A., & Nichols, T. E. (2011). *Handbook of Functional MRI Data Analysis*. Cambridge University Press.
|
|
270
|
+
- Power, J. D., Barnes, K. A., Snyder, A. Z., et al. (2012). Spurious but systematic correlations in functional connectivity MRI networks arise from subject motion. *NeuroImage*, 59(3), 2142-2154.
|
|
271
|
+
- Power, J. D., Mitra, A., Laumann, T. O., et al. (2014). Methods to detect, characterize, and remove motion artifact in resting state fMRI. *NeuroImage*, 84, 320-341.
|
|
272
|
+
- Sladky, R., Friston, K., Trostl, J., et al. (2011). Slice-timing effects and their correction in functional MRI. *NeuroImage*, 58(2), 588-594.
|
|
273
|
+
|
|
274
|
+
See `references/` for detailed pipeline parameters and quality control procedures.
|