nilearn-fmri

Fit nilearn GLMs for task fMRI and compute contrast maps.

33|6|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/xjtulyc/awesome-rosetta-skills --skill nilearn-fmri
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nilearn-fmri
Source: https://github.com/xjtulyc/awesome-rosetta-skills/tree/main/skills/05-neuroscience/nilearn-fmri
Command: npx skills add https://github.com/xjtulyc/awesome-rosetta-skills --skill nilearn-fmri

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires nilearn, nibabel, numpy, scipy, pandas, scikit-learn, matplotlib, joblib.

What problem does it solve?

This Skill helps you analyze task-based and resting-state fMRI data end-to-end, producing statistical maps, functional connectivity, ICA components, and MVPA decoding results without stitching together many separate tools by hand.

Core Features & Use Cases

  • Task fMRI GLM (First- and Second-Level): Build first-level design matrices, fit GLMs, compute z/t contrasts, and run group-level one-sample analyses.
  • Resting-State Connectivity & Parcellation: Extract ROI time series from common atlases (Schaefer or AAL), compute connectivity matrices, and compare connectivity across groups.
  • ICA + MVPA Decoding: Run CanICA for spatial ICA decomposition and support classification via SVM-based MVPA (including examples using FC-derived features).

Quick Start

Ask the AI to run a first-level GLM contrast on your NIfTI task fMRI data with events and confounds, then compute a group-level z-map and visualize the results.

Frequently Asked Questions about nilearn-fmri

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a first-level GLM analysis on task-based fMRI data?

To run a first-level GLM on task-based fMRI data, provide your NIfTI files along with events and confounds. The analysis fits a nilearn GLM to compute z or t contrast maps for specified conditions.

Can I compute resting-state functional connectivity using an atlas?

Yes, you can compute resting-state functional connectivity by extracting ROI time series from atlases like Schaefer or AAL. It applies bandpass filtering and detrending before generating connectivity matrices for group comparisons.

How do I perform MVPA decoding on fMRI data using SVM?

You can perform MVPA decoding by extracting voxel-level or connectivity-derived features and training a support vector machine (SVM) classifier via scikit-learn to identify patterns distinguishing experimental conditions.

Does CanICA work for spatial ICA decomposition of fMRI datasets?

Yes, CanICA works for spatial ICA decomposition by extracting independent component maps from fMRI datasets. It identifies spatially independent brain networks directly from preprocessed NIfTI inputs.

What dependencies do I need installed to analyze fMRI data with nilearn?

You need nilearn, nibabel, numpy, scipy, pandas, scikit-learn, matplotlib, and joblib installed. These scientific Python dependencies support NIfTI loading, statistical modeling, and visualization.

Can I visualize group-level z-maps after running a second-level GLM?

Yes, you can visualize group-level z-maps after running a second-level GLM. The workflow computes one-sample group analyses from first-level contrasts and generates visual outputs using matplotlib.