Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
nilearn.interfaces.bids.save_glm_to_bids#
- nilearn.interfaces.bids.save_glm_to_bids(model, contrasts, contrast_types=None, out_dir='.', prefix=None)[source]#
Save GLM results to BIDS-like files.
New in version 0.9.2.
- Parameters:
- model
FirstLevelModelorSecondLevelModel First- or second-level model from which to save outputs.
- contrasts
stror array of shape (n_col) orlistof (stror array of shape (n_col)) ordict Contrast definitions. This may be one of the following:
- contrast_typesNone or
dictofstr, default=None An optional dictionary mapping some or all of the contrast names to specific contrast types (‘t’ or ‘F’). If None, all contrast types will be automatically inferred based on the contrast arrays (1D arrays are t-contrasts, 2D arrays are F-contrasts). Keys in this dictionary must match the keys in the
contrastsdictionary, but only those contrasts for which contrast type must be explicitly set need to be included.- out_dir
str, optional Output directory for files. Default is current working directory.
- prefix
stror None, default=None String to prepend to generated filenames. If a string is provided, ‘_’ will be added to the end.
- model
Warning
The files generated by this function are a best approximation of appropriate names for GLM-based BIDS derivatives. However, BIDS does not currently have GLM-based derivatives supported in the specification, and there is no guarantee that the files created by this function will be BIDS-compatible if and when the specification supports model derivatives.
Notes
This function writes files for the following:
Modeling software information (
dataset_description.json)Model-level metadata (
statmap.json)Model design matrix (
design.tsv)Model design matrix figure (
design.svg)Model error (
stat-errorts_statmap.nii.gz)Model r-squared (
stat-rSquare_statmap.nii.gz)Contrast ‘parameter estimates’ (
contrast-[name]_stat-effect_statmap.nii.gz)Variance of the contrast parameter estimates (
contrast-[name]_stat-variance_statmap.nii.gz)Contrast test statistics (
contrast-[name]_stat-[F|t]_statmap.nii.gz)Contrast p- and z-values (
contrast-[name]_stat-[p|z]_statmap.nii.gz)Contrast weights figure (
contrast-[name]_design.svg)
Examples using nilearn.interfaces.bids.save_glm_to_bids#
First level analysis of a complete BIDS dataset from openneuro