Extracting Regionwise Signals From Activity Recording

Extracting Regionwise Signals From Activity Recording

siibra integrates nilearn to allow seemles extraction of signals given recordings such as fMRI, PET, and others. This notebook downloads two fMRI images from AOMIC-PIOP2 dataset (https://openneuro.org/datasets/ds002790/versions/2.0.0) and compares the extraction results for different tasks.

We start by importing the Python packages used in this notebook. siibra provides access to brain atlases, spaces, maps, and datasets. nilearn.plotting is used for interactive neuroimaging visualizations. plotly.express.imshow helps us display matrix-like signal data, while matplotlib and pandas are used for plotting and tabular data analysis.

import siibra
from nilearn import plotting
from plotly.express import imshow
import matplotlib.pyplot as plt
import pandas as pd
import json
import pathlib
import requests

Note

The surface time-series analysis at the end of this notebook requires a FreeSurfer fsaverage5 template and a parcellation map defined in the same space. The Julich-Brain fsaverage5 map is not available out of the box, however, fsaverage7 version can be downsampled using Workbench. This notebook loads the map from a dedicated configuration branch where this map is precomputred.

siibra.use_configuration(
    siibra.retrieval.repositories.GithubConnector(
        owner="FZJ-INM1-BDA",
        repo="siibra-configurations",
        reftag="feat_timeseries_volume",
    )
)

The fMRI data used in this example comes from the AOMIC-PIOP2 dataset hosted on OpenNeuro. Here we define the subject identifier and construct the base URL that points to the preprocessed fMRI files generated by fMRIPrep. This allows us to build the full download URLs for different tasks by changing only the file name.

subject = "sub-0001"
dataset_base_url = "https://s3.amazonaws.com/openneuro.org/ds002790/"
folder = f"derivatives/fmriprep/{subject}/func/"
url_template = dataset_base_url + folder + "{file}"

We first load the preprocessed working-memory fMRI image. The file is in MNI152 space, which is a commonly used standard anatomical reference space. The image is wrapped as a siibra volume using siibra.volumes.from_url, which allows the data to be passed directly to siibra-based workflows. The time=[] argument indicates that the full 4D time series should be used.

file = f"{subject}_task-workingmemory_acq-seq_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
workingmemory_fmri = siibra.volumes.from_url(
    url_template.format(file=file), space="mni152", time=[]
)
print(type(workingmemory_fmri))
<class 'siibra.volumes.volume.TimeSeriesVolume'>

Next, we load the resting-state fMRI recording from the same subject. This image has the same spatial reference space as the working-memory image, which makes it possible to compare the extracted region-wise signals across both recordings using the same brain atlas.

file = f"{subject}_task-restingstate_acq-seq_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
restingstate_fmri = siibra.volumes.from_url(
    url_template.format(file=file), space="mni152", time=[]
)

Functional MRI recordings often contain noise caused by motion, physiology, scanner drift, or other non-neural sources. The fMRIPrep outputs include confound regressors that can be used during signal extraction. Here we load the confound files for both the working-memory and resting-state recordings into pandas DataFrames. Later, we will use the CSF signal as an example confound.

filename = f"{subject}_task-workingmemory_acq-seq_desc-confounds_regressors.tsv"
workingmemory_confounds = pd.read_csv(url_template.format(file=filename), sep="\t")
filename = f"{subject}_task-restingstate_acq-seq_desc-confounds_regressors.tsv"
restingstate_confounds = pd.read_csv(url_template.format(file=filename), sep="\t")

We now select the brain parcellation that will define the regions from which signals are extracted. In this example, we use the Julich-Brain 3.1 in MNI152 space. Since the fMRI data is also in MNI152 space, this atlas is suitable for extracting region-wise signals from the volume data.

julichbrain = siibra.get_map("julich 3.1", "mni152")

The extract_signals_with_nilearn` method extracts one signal per region from the input fMRI image. Internally, this uses nilearn functionality to summarize the voxel-wise data within each labelled brain region. The result is returned as a pandas DataFrame, where each column corresponds to a region and each row corresponds to one time point of the fMRI recording. We also pass the CSF confound signal so that nilearn can regress it out during signal extraction.

[NiftiLabelsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f04846890d0>
[NiftiLabelsMasker.wrapped] Loading regions from <nibabel.nifti1.Nifti1Image object at 0x7f0545c92590>
[NiftiLabelsMasker.wrapped] Resampling regions
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: UserWarning: After resampling the label image to the data image, the following labels were removed: {np.uint16(17), np.uint16(125), np.uint16(61), np.uint16(223)}. Label image only contains 411 labels (including background).
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[NiftiLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
________________________________________________________________________________
[Memory] Calling nilearn.maskers.base_masker.filter_and_extract...
filter_and_extract(<nibabel.nifti1.Nifti1Image object at 0x7f04846890d0>, <nilearn.maskers.nifti_labels_masker._ExtractionFunctor object at 0x7f04cbb6d6d0>,
{ 'background_label': 0,
  'clean_args': None,
  'clean_kwargs': {},
  'cmap': None,
  'detrend': False,
  'dtype': None,
  'high_pass': None,
  'high_variance_confounds': False,
  'keep_masked_labels': False,
  'labels': None,
  'labels_img': <nibabel.nifti1.Nifti1Image object at 0x7f0545c92590>,
  'low_pass': None,
  'lut':      index                     name    color
0        1    Area 3b (PostCG) left  #f63e00
1        2   Area hOc4la (LOC) left  #e9a8bc
2        3       Area PF (IPL) left  #e1d23c
3        4     Area CoS1 (CoS) left  #007880
4        5     Astr (Amygdala) left      NaN
..     ...                      ...      ...
409    410     Area Fo2 (OFC) right  #00ff00
410    411  Area Te 2.2 (STG) right  #8a3ec0
411    412    Area hIP7 (IPS) right  #46c4da
412    413     Area 7PC (SPL) right  #fb581c
413    414     Area TeI (STG) right  #164e5c

[414 rows x 3 columns],
  'mask_img': None,
  'reports': True,
  'smoothing_fwhm': None,
  'standardize': False,
  'standardize_confounds': True,
  'strategy': 'mean',
  't_r': None,
  'target_affine': None,
  'target_shape': None}, confounds=[array([34159.246094, ..., 34129.640625], shape=(160,))], sample_mask=None, memory=Memory(location=/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/siibra-cache/joblib/joblib), memory_level=1, verbose=1, sklearn_output_config=None)
[NiftiLabelsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f04846890d0>
[NiftiLabelsMasker.wrapped] Extracting region signals
[NiftiLabelsMasker.wrapped] Cleaning extracted signals
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
_______________________________________________filter_and_extract - 1.4s, 0.0min
region Area 3b (PostCG) left Area hOc4la (LOC) left Area PF (IPL) left Area CoS1 (CoS) left Astr (Amygdala) left Area Id8 (Insula) left Area SFG4 (SFG) left Area 1 (PostCG) left Po (Thalamus, posterior Nucleus) left Area Te 1.0 (HESCHL) left Area STS2 (STS) left LD (Thalamus, lateral dorsal Nucleus) left Area 6mp (SMA, mesial SFG) left Area Id3 (Insula) left ZI (Thalamus, zona incerta) left CGM (Metathalamus) left Area PirTB (PiriformCortexMesial, temporobasal) left NRp (Midbrain, Nucleus Ruber, parvocellular part) left Area PFt (IPL) left Area p24ab (pACC) left Area TI (STG) left Area FG5 (FusG) left PUm (Thalamus, medial pulvinar) left PUi (Thalamus, inferior pulvinar) left Area Te 3 (STG) left Area MFG1 (MFG) left Frontal-to-Occipital (GapMap) left Area 7P (SPL) left Area 6r1 (PreCG) left Area 6d1 (PreCG) left VA (Thalamus, ventral anterior Nucleus (ventral)) left Area hIP4 (IPS) left Area Op6 (Frontal Operculum) left Area FG2 (FusG) left Area hIP6 (IPS) left Area Fo5 (OFC) left Area TPJ (STG, SMG) left BST (Basal Forebrain, Bed Nucleus) left AM (Thalamus, anteromedial Nucleus) left Area Op7 (Frontal Operculum) left ... VPL (Thalamus, ventral posterior lateral Nucleus) right Sg (Thalamus, suprageniculate Nucleus) right Area 7A (SPL) right Area Op3 (POperc) right Subc (Hippocampus, Subicular complex) right TrS (Hippocampus, Transsubiculum) right CA3 (Hippocampus) right Frontal-II (GapMap) right VLA (Thalamus, ventral lateral anterior Nucleus) right Area STS1 (STS) right VPM (Thalamus, ventral posterior medial Nucleus) right Area 5L (SPL) right Area Id9 (Insula) right SNR (Midbrain, Substantia Nigra pars reticulata) right Area FG3 (FusG) right Area IFS2 (IFS) right AV (Thalamus, anteroventral Nucleus) right VP (Ventral Pallidum) right Area s32 (sACC) right Nfast (Cerebellum, Fastigial Nucleus) right MF (Amygdala) right Area hOc5 (LOC) right sPf (Thalamus, subparafascicular Nucleus) right SF (Amygdala) right Area Fo1 (OFC) right VPMpc (Thalamus, ventral posterior medial Nucleus, parvocellular part) right VPi (Thalamus, ventroposterior inferior Nucleus) right Area 8d1 (SFG) right Area IFJ1 (IFS, PreCS) right Area s24 (sACC) right Area hOc4v (LingG) right Area PFop (IPL) right Area 6v2 (PreCG) right Area Ph2 (PhG) right AcbL (Ventral Striatum, Lateral Accumbens) right Area Fo2 (OFC) right Area Te 2.2 (STG) right Area hIP7 (IPS) right Area 7PC (SPL) right Area TeI (STG) right
time
0 27748.222656 27989.632812 28503.976562 13207.304688 29967.091797 28214.724609 26837.867188 26928.169922 26719.134766 29845.183594 26788.203125 28466.382812 28610.029297 32053.396484 21661.812500 23145.332031 0 22475.392578 28653.324219 20301.298828 31746.199219 13819.365234 29221.091797 26628.312500 26228.166016 26163.417969 30429.656250 32834.382812 28344.140625 28910.757812 24484.589844 31881.585938 30048.423828 27290.876953 32144.830078 23707.070312 27380.644531 23365.019531 20594.099609 28766.408203 ... 26790.789062 26532.564453 31661.945312 27261.378906 22512.318359 32197.843750 29822.330078 26523.183594 23214.593750 26105.533203 24087.468750 27779.369141 31291.449219 21072.257812 27491.792969 21674.576172 26686.330078 17543.089844 5149.338379 29414.144531 25496.972656 27261.390625 25128.357422 21401.910156 1322.199463 23383.296875 24493.171875 26919.597656 24158.189453 12095.719727 27347.460938 23770.564453 25686.314453 30082.871094 17620.326172 6299.088379 26663.673828 30752.626953 28571.988281 26932.285156
1 27739.070312 28012.662109 28593.712891 12779.000977 29871.960938 28367.060547 26856.486328 26967.695312 26666.300781 29645.787109 26784.500000 28413.392578 28594.433594 31918.785156 21632.863281 22879.332031 0 22429.500000 28735.205078 20262.222656 31615.810547 13418.458984 29262.550781 26838.066406 26145.054688 26180.935547 30440.453125 32874.343750 28419.697266 28995.253906 24508.525391 32019.591797 30181.792969 27226.851562 32110.750000 23567.529297 27242.847656 23306.714844 20998.220703 28796.062500 ... 26917.964844 26723.251953 31796.234375 27181.523438 22327.875000 32349.767578 29708.087891 26444.955078 23301.638672 26001.003906 23877.330078 27828.724609 31213.908203 21180.341797 27375.705078 21726.871094 26988.861328 17371.578125 5024.319336 29457.482422 25430.044922 27325.322266 25387.169922 21137.208984 1311.678345 23745.005859 24180.080078 26924.824219 24227.679688 12091.167969 27154.154297 23790.906250 25701.125000 30115.492188 17637.406250 6167.893555 26480.283203 30866.505859 28664.087891 26803.587891
2 27888.433594 28124.138672 28616.041016 12953.875977 29761.958984 28343.382812 26959.054688 27113.519531 26709.898438 29675.787109 26814.257812 28833.433594 28749.414062 31987.212891 21832.345703 22913.796875 0 22884.781250 28920.595703 20358.445312 31844.503906 13661.957031 29150.517578 26565.761719 26171.667969 26273.640625 30555.214844 33231.281250 28372.369141 29152.818359 24662.011719 31956.796875 30038.302734 27500.320312 32471.029297 23610.169922 27237.107422 23230.271484 20711.603516 28657.572266 ... 26726.957031 26295.523438 31957.679688 27389.732422 22418.654297 32071.166016 29877.689453 26730.833984 23167.554688 26101.666016 23997.126953 27798.042969 31074.595703 21226.183594 27761.568359 21761.193359 26857.181641 17467.197266 5040.833984 29566.857422 25726.363281 27430.306641 25178.738281 21205.873047 1273.701904 23721.625000 24554.337891 27041.751953 24361.251953 12065.904297 27406.837891 23761.628906 25861.740234 30120.322266 17832.517578 6180.375488 26425.720703 30886.724609 28767.992188 26798.927734
3 27983.820312 28059.183594 28545.017578 13259.023438 29716.097656 28293.996094 26958.048828 27076.724609 26671.166016 29628.044922 26893.343750 29069.589844 28729.939453 31961.259766 21995.367188 23296.158203 0 22620.951172 28902.498047 20287.259766 31617.060547 13980.927734 29415.373047 26592.095703 26279.294922 26369.789062 30580.550781 33224.449219 28420.839844 29138.914062 24596.419922 31842.041016 30028.099609 27470.392578 32553.228516 23808.099609 27241.001953 23433.875000 20829.263672 28696.234375 ... 26786.267578 26327.021484 31890.056641 27141.507812 22572.029297 32046.660156 29955.085938 26592.351562 23242.919922 26168.531250 24441.562500 27876.318359 31050.390625 20989.738281 27627.583984 21760.298828 27147.275391 17507.072266 5095.121582 29516.474609 25502.730469 27479.929688 24423.578125 21389.888672 1331.339600 23697.832031 24647.031250 27039.328125 24190.976562 12187.303711 27294.101562 23800.123047 25730.085938 29998.777344 17719.542969 6277.050781 26531.390625 30763.933594 28755.148438 26900.974609
4 27805.873047 27908.275391 28433.330078 12942.353516 29696.250000 28229.105469 26752.099609 26866.941406 26755.044922 29536.109375 26697.466797 28524.511719 28570.941406 31769.097656 21694.394531 23079.103516 0 22438.867188 28691.960938 20127.539062 31409.056641 13494.095703 29125.115234 26860.931641 26180.929688 26262.113281 30407.794922 33141.699219 28254.767578 28949.611328 24421.562500 31874.710938 30003.595703 27185.708984 32546.337891 23651.716797 27168.998047 23302.683594 20759.085938 28889.304688 ... 26941.470703 26397.941406 31809.917969 27476.171875 22155.884766 31863.572266 29759.000000 26580.750000 23184.835938 26040.369141 24389.017578 27766.248047 31096.041016 21318.566406 27408.201172 21684.347656 26807.234375 17455.767578 4992.916992 30022.148438 26852.337891 27493.060547 24758.914062 21164.130859 1336.527588 23656.662109 24556.597656 26844.810547 24224.068359 11940.528320 27137.259766 23584.146484 25594.523438 29786.394531 17498.898438 6149.057129 26357.482422 30798.904297 28554.787109 26556.451172
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
155 27718.736328 27950.835938 28195.494141 13415.387695 29810.630859 28228.328125 26737.589844 26781.679688 26882.755859 29468.314453 26678.718750 28239.048828 28428.507812 31658.017578 21996.617188 23256.599609 0 22323.542969 28765.484375 20418.398438 31235.119141 14015.452148 29151.500000 26524.193359 25851.457031 26313.744141 30318.968750 32976.757812 28294.791016 28814.837891 24437.367188 31865.771484 29890.607422 27249.042969 32151.943359 23807.636719 27091.589844 23433.292969 20731.162109 28683.333984 ... 26777.904297 26558.923828 31836.623047 27038.349609 22521.240234 31677.425781 29622.318359 26257.287109 23136.720703 25718.748047 24362.328125 27652.412109 31161.970703 21277.175781 27657.353516 21883.089844 26725.585938 17126.316406 5056.184570 29436.380859 23017.869141 27184.927734 26114.064453 21217.255859 1363.213135 23860.626953 24058.675781 26653.099609 24357.410156 12184.083008 27352.269531 23607.181641 25533.916016 29890.908203 17492.195312 6376.526855 26205.179688 30942.824219 28696.871094 26650.457031
156 27803.242188 27949.023438 28345.359375 13339.725586 29802.750000 28305.417969 26828.279297 26861.806641 26928.693359 29458.636719 26651.470703 28595.578125 28344.835938 31485.417969 21832.044922 24034.263672 0 22495.103516 28815.691406 20448.568359 31360.816406 13869.274414 29380.427734 26933.429688 25956.921875 26330.523438 30392.830078 32988.417969 28322.763672 28820.978516 24368.406250 31626.611328 30040.328125 27236.513672 32245.113281 23749.994141 27107.357422 23376.833984 20554.671875 28694.228516 ... 26746.611328 26595.279297 31771.398438 26856.642578 22479.515625 32078.824219 29811.960938 26345.142578 23113.109375 25924.033203 24319.593750 27608.539062 31340.066406 21088.785156 27734.642578 22026.947266 26940.998047 17255.134766 5141.435059 28941.349609 23422.822266 27193.666016 25768.205078 21223.830078 1367.262573 23688.943359 24115.568359 26870.378906 24255.027344 12024.058594 27425.994141 23772.201172 25557.552734 29882.052734 17535.992188 6315.443359 26123.593750 30749.091797 28689.826172 26605.767578
157 27800.925781 27926.361328 28375.583984 13319.341797 29622.939453 28350.183594 26805.492188 26805.380859 26928.773438 29635.197266 26671.046875 28366.660156 28601.292969 31790.388672 21901.066406 23613.236328 0 22491.011719 28624.738281 20489.451172 31687.681641 14072.206055 29133.142578 27020.230469 26017.455078 26272.398438 30390.359375 32814.777344 28186.847656 28783.023438 24421.613281 31665.380859 30027.439453 27185.359375 32068.041016 23731.798828 27162.216797 23488.744141 20297.255859 28744.386719 ... 26961.537109 26603.390625 31536.445312 27060.773438 22537.222656 31952.537109 29617.191406 26494.591797 23063.035156 25898.279297 24341.404297 27758.427734 31332.830078 21191.248047 27516.255859 21845.910156 26912.244141 17130.628906 5008.759766 29420.072266 23709.169922 27223.917969 25850.548828 21280.613281 1357.884766 23893.783203 24619.949219 26920.718750 24050.757812 12139.029297 27440.970703 23640.035156 25493.222656 29890.687500 17412.054688 6458.608398 26252.423828 30682.511719 28613.021484 26710.605469
158 27857.093750 27836.523438 28361.466797 13243.213867 30012.417969 28336.087891 26940.210938 26864.035156 26692.166016 29645.822266 26747.642578 28915.738281 28609.476562 31769.187500 21904.621094 23784.720703 0 22535.425781 28644.134766 20615.654297 31722.462891 14003.262695 29273.353516 27266.126953 26022.203125 26333.812500 30455.521484 32711.119141 28391.636719 28861.306641 24520.886719 31766.076172 30059.353516 27195.916016 32039.794922 23821.132812 27158.935547 23668.849609 19999.380859 28524.943359 ... 26841.380859 26759.669922 31633.669922 26873.132812 22529.466797 32011.125000 29673.843750 26493.332031 23235.349609 25910.632812 24311.148438 27975.412109 31166.320312 21208.013672 27691.755859 21774.515625 27167.951172 17083.457031 5067.245605 29266.468750 23066.810547 27199.091797 26071.396484 21221.333984 1369.993042 23814.865234 24321.951172 27081.066406 24136.505859 12171.592773 27365.533203 23825.738281 25564.427734 29892.152344 17574.306641 6411.580078 26347.017578 30734.552734 28704.853516 26879.695312
159 27748.123047 27868.468750 28397.568359 13349.028320 29605.556641 28320.173828 27008.511719 26843.638672 26672.458984 29660.392578 26814.398438 28648.523438 28484.058594 31748.869141 21899.595703 23215.992188 0 22533.462891 28631.013672 20452.433594 31402.095703 13898.383789 28948.029297 26770.818359 26041.468750 26304.128906 30495.015625 32740.005859 28145.392578 28742.347656 24506.578125 31566.966797 30087.087891 27089.263672 32038.828125 23778.457031 27229.701172 23438.068359 20645.742188 28840.021484 ... 26775.800781 26474.337891 31573.410156 27237.865234 22411.619141 31892.193359 29828.906250 26497.068359 23214.023438 25815.564453 24457.468750 27820.236328 31255.839844 21186.855469 27746.976562 21821.427734 26854.212891 17076.458984 5071.032227 29587.255859 23350.248047 27274.001953 25701.910156 21228.689453 1295.228027 23719.048828 24456.103516 27091.099609 24089.625000 12177.829102 27229.097656 23658.746094 25541.457031 29883.654297 17592.361328 6295.276855 26395.681641 30599.099609 28650.974609 26820.574219

160 rows × 414 columns



After extracting the time series, we summarize each regional signal using pandas. The describe() method computes statistics such as the mean, standard deviation, minimum, maximum, and quartiles. We transpose the result so that each row corresponds to one brain region, then sort the regions by their mean signal value.

count mean std min 25% 50% 75% max
region
Area hPO1 (POS) left 160.0 35296.476562 131.868011 35004.808594 35206.646484 35297.105469 35391.455078 35658.347656
Area hOc4d (Cuneus) left 160.0 34761.503906 126.507637 34469.351562 34673.365234 34764.679688 34855.586914 35074.023438
Area 7P (SPL) right 160.0 34603.117188 160.234436 34194.128906 34482.595703 34609.042969 34710.579102 34993.273438
Area hPO1 (POS) right 160.0 34109.230469 134.730438 33812.609375 34003.834961 34121.861328 34204.369141 34394.281250
Area Ia1 (Insula) left 160.0 34088.750000 150.010193 33666.003906 33980.474609 34081.798828 34181.907227 34452.843750
... ... ... ... ... ... ... ... ...
Area Fo1 (OFC) left 160.0 1254.338989 22.289782 1197.199097 1236.839539 1254.543152 1268.652496 1313.587402
Pv (Thalamus, paraventricular Nucleus) left 160.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
Area PirTB (PiriformCortexMesial, temporobasal) left 160.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
CGM (Metathalamus) right 160.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
VM (Thalamus, ventral medial Nucleus) left 160.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000

414 rows × 8 columns



To inspect the regional time series, we select the 20 regions with the highest mean signal values during the working-memory task. The selected signals are transposed so that regions are shown along one axis and time points along the other. This provides a compact overview of how the strongest regional signals vary over time.



We repeat the same extraction workflow for the resting-state recording. This gives us a second region-wise signal matrix, again with time points as rows and atlas regions as columns. We then compute summary statistics for each region and sort them by the mean signal value, allowing direct comparison with the working-memory results.

[NiftiLabelsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f05436bbc90>
[NiftiLabelsMasker.wrapped] Loading regions from <nibabel.nifti1.Nifti1Image object at 0x7f0545c92590>
[NiftiLabelsMasker.wrapped] Resampling regions
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: UserWarning: After resampling the label image to the data image, the following labels were removed: {np.uint16(17), np.uint16(125), np.uint16(61), np.uint16(223)}. Label image only contains 411 labels (including background).
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[NiftiLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
________________________________________________________________________________
[Memory] Calling nilearn.maskers.base_masker.filter_and_extract...
filter_and_extract(<nibabel.nifti1.Nifti1Image object at 0x7f05436bbc90>, <nilearn.maskers.nifti_labels_masker._ExtractionFunctor object at 0x7f0542b80190>,
{ 'background_label': 0,
  'clean_args': None,
  'clean_kwargs': {},
  'cmap': None,
  'detrend': False,
  'dtype': None,
  'high_pass': None,
  'high_variance_confounds': False,
  'keep_masked_labels': False,
  'labels': None,
  'labels_img': <nibabel.nifti1.Nifti1Image object at 0x7f0545c92590>,
  'low_pass': None,
  'lut':      index                     name    color
0        1    Area 3b (PostCG) left  #f63e00
1        2   Area hOc4la (LOC) left  #e9a8bc
2        3       Area PF (IPL) left  #e1d23c
3        4     Area CoS1 (CoS) left  #007880
4        5     Astr (Amygdala) left      NaN
..     ...                      ...      ...
409    410     Area Fo2 (OFC) right  #00ff00
410    411  Area Te 2.2 (STG) right  #8a3ec0
411    412    Area hIP7 (IPS) right  #46c4da
412    413     Area 7PC (SPL) right  #fb581c
413    414     Area TeI (STG) right  #164e5c

[414 rows x 3 columns],
  'mask_img': None,
  'reports': True,
  'smoothing_fwhm': None,
  'standardize': False,
  'standardize_confounds': True,
  'strategy': 'mean',
  't_r': None,
  'target_affine': None,
  'target_shape': None}, confounds=[array([34207.414062, ..., 34218.066406], shape=(240,))], sample_mask=None, memory=Memory(location=/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/siibra-cache/joblib/joblib), memory_level=1, verbose=1, sklearn_output_config=None)
[NiftiLabelsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f05436bbc90>
[NiftiLabelsMasker.wrapped] Extracting region signals
[NiftiLabelsMasker.wrapped] Cleaning extracted signals
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
_______________________________________________filter_and_extract - 1.7s, 0.0min
count mean std min 25% 50% 75% max
region
Area hPO1 (POS) left 240.0 34356.000000 134.901077 33995.843750 34264.704102 34349.435547 34449.302734 34762.273438
Area hOc4d (Cuneus) left 240.0 34170.910156 126.396439 33838.296875 34076.482422 34172.482422 34245.599609 34627.480469
Area 7P (SPL) right 240.0 34069.597656 169.913452 33628.988281 33952.399414 34076.054688 34178.803711 34538.082031
Area Ia1 (Insula) left 240.0 33892.878906 167.269623 33425.093750 33779.892578 33878.937500 34000.826172 34348.406250
Area hOc3d (Cuneus) left 240.0 33014.847656 124.499222 32732.101562 32922.211914 33011.376953 33092.689453 33391.039062
... ... ... ... ... ... ... ... ...
Area Fo1 (OFC) left 240.0 1172.950073 25.570959 1111.491455 1155.579041 1171.439331 1189.452698 1237.212891
CGM (Metathalamus) right 240.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
Area PirTB (PiriformCortexMesial, temporobasal) left 240.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
Pv (Thalamus, paraventricular Nucleus) left 240.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
VM (Thalamus, ventral medial Nucleus) left 240.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000

414 rows × 8 columns



Here we create horizontal bar plots for the top 10 regions in each condition. The bar height represents the mean extracted signal, and the error bars show the standard deviation across time. These plots provide a simple summary of which regions have the strongest average signal in each recording.

fig, axs = plt.subplots(1, 2, figsize=(12, 5))
restingstate_signals_stats.iloc[:10, :].plot(
    ax=axs[0], title="resting state", kind="barh", y="mean", xerr="std"
)
workingmemory_signals_stats.iloc[:10, :].plot(
    ax=axs[1], title="working memory", kind="barh", y="mean", xerr="std"
)
fig.tight_layout()
resting state, working memory

To compare the two recordings, we take the union of the top-ranked regions from the working-memory and resting-state summaries. We then create boxplots for the selected regions in both conditions. This allows us to compare the distribution of signal values across time for the same anatomical regions in the two fMRI recordings.

union = workingmemory_signals_stats.index[:20].union(
    restingstate_signals_stats.index[:20]
)
union_sorted = (
    workingmemory_signals_stats.loc[union, :].sort_values("mean", ascending=False).index
)

fig, ax = plt.subplots(figsize=(10, 10))
workingmemory_signals[union_sorted].boxplot(
    ax=ax, rot=90, color="b", label="working memory",
    flierprops={"marker": ".", "markeredgecolor": "b", "markersize": 3},
)
restingstate_signals[union_sorted].boxplot(
    ax=ax, rot=90, color="r", label="resting state",
    flierprops={"marker": ".", "markeredgecolor": "r", "markersize": 3},
)
ax.legend()
ax.set_title(f"Comparison of top {len(union_sorted)} regions for {subject}")
fig.tight_layout()
Comparison of top 22 regions for sub-0001

Instead of extracting the mean signal from each region, we can also use a different summary strategy. Here we use strategy=”variance” to compute the variance of the fMRI signal within each atlas region. This can be useful when we are interested in spatial or temporal variability rather than the average signal intensity.

[NiftiLabelsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f05bb66cd90>
[NiftiLabelsMasker.wrapped] Loading regions from <nibabel.nifti1.Nifti1Image object at 0x7f0545d00cd0>
[NiftiLabelsMasker.wrapped] Resampling regions
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: UserWarning: After resampling the label image to the data image, the following labels were removed: {np.uint16(17), np.uint16(125), np.uint16(61), np.uint16(223)}. Label image only contains 411 labels (including background).
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[NiftiLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
________________________________________________________________________________
[Memory] Calling nilearn.maskers.base_masker.filter_and_extract...
filter_and_extract(<nibabel.nifti1.Nifti1Image object at 0x7f05bb66cd90>, <nilearn.maskers.nifti_labels_masker._ExtractionFunctor object at 0x7f05bb541a50>,
{ 'background_label': 0,
  'clean_args': None,
  'clean_kwargs': {},
  'cmap': None,
  'detrend': False,
  'dtype': None,
  'high_pass': None,
  'high_variance_confounds': False,
  'keep_masked_labels': False,
  'labels': None,
  'labels_img': <nibabel.nifti1.Nifti1Image object at 0x7f0545d00cd0>,
  'low_pass': None,
  'lut':      index                     name    color
0        1    Area 3b (PostCG) left  #f63e00
1        2   Area hOc4la (LOC) left  #e9a8bc
2        3       Area PF (IPL) left  #e1d23c
3        4     Area CoS1 (CoS) left  #007880
4        5     Astr (Amygdala) left      NaN
..     ...                      ...      ...
409    410     Area Fo2 (OFC) right  #00ff00
410    411  Area Te 2.2 (STG) right  #8a3ec0
411    412    Area hIP7 (IPS) right  #46c4da
412    413     Area 7PC (SPL) right  #fb581c
413    414     Area TeI (STG) right  #164e5c

[414 rows x 3 columns],
  'mask_img': None,
  'reports': True,
  'smoothing_fwhm': None,
  'standardize': False,
  'standardize_confounds': True,
  'strategy': 'variance',
  't_r': None,
  'target_affine': None,
  'target_shape': None}, confounds=[array([34159.246094, ..., 34129.640625], shape=(160,))], sample_mask=None, memory=Memory(location=/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/siibra-cache/joblib/joblib), memory_level=1, verbose=1, sklearn_output_config=None)
[NiftiLabelsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f05bb66cd90>
[NiftiLabelsMasker.wrapped] Extracting region signals
/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/venv/lib/python3.11/site-packages/scipy/ndimage/_measurements.py:647: RuntimeWarning: invalid value encountered in divide
  means = sums / counts
[NiftiLabelsMasker.wrapped] Cleaning extracted signals
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
_______________________________________________filter_and_extract - 2.0s, 0.0min
region Area 3b (PostCG) left Area hOc4la (LOC) left Area PF (IPL) left Area CoS1 (CoS) left Astr (Amygdala) left Area Id8 (Insula) left Area SFG4 (SFG) left Area 1 (PostCG) left Po (Thalamus, posterior Nucleus) left Area Te 1.0 (HESCHL) left Area STS2 (STS) left LD (Thalamus, lateral dorsal Nucleus) left Area 6mp (SMA, mesial SFG) left Area Id3 (Insula) left ZI (Thalamus, zona incerta) left CGM (Metathalamus) left Area PirTB (PiriformCortexMesial, temporobasal) left NRp (Midbrain, Nucleus Ruber, parvocellular part) left Area PFt (IPL) left Area p24ab (pACC) left Area TI (STG) left Area FG5 (FusG) left PUm (Thalamus, medial pulvinar) left PUi (Thalamus, inferior pulvinar) left Area Te 3 (STG) left Area MFG1 (MFG) left Frontal-to-Occipital (GapMap) left Area 7P (SPL) left Area 6r1 (PreCG) left Area 6d1 (PreCG) left VA (Thalamus, ventral anterior Nucleus (ventral)) left Area hIP4 (IPS) left Area Op6 (Frontal Operculum) left Area FG2 (FusG) left Area hIP6 (IPS) left Area Fo5 (OFC) left Area TPJ (STG, SMG) left BST (Basal Forebrain, Bed Nucleus) left AM (Thalamus, anteromedial Nucleus) left Area Op7 (Frontal Operculum) left ... VPL (Thalamus, ventral posterior lateral Nucleus) right Sg (Thalamus, suprageniculate Nucleus) right Area 7A (SPL) right Area Op3 (POperc) right Subc (Hippocampus, Subicular complex) right TrS (Hippocampus, Transsubiculum) right CA3 (Hippocampus) right Frontal-II (GapMap) right VLA (Thalamus, ventral lateral anterior Nucleus) right Area STS1 (STS) right VPM (Thalamus, ventral posterior medial Nucleus) right Area 5L (SPL) right Area Id9 (Insula) right SNR (Midbrain, Substantia Nigra pars reticulata) right Area FG3 (FusG) right Area IFS2 (IFS) right AV (Thalamus, anteroventral Nucleus) right VP (Ventral Pallidum) right Area s32 (sACC) right Nfast (Cerebellum, Fastigial Nucleus) right MF (Amygdala) right Area hOc5 (LOC) right sPf (Thalamus, subparafascicular Nucleus) right SF (Amygdala) right Area Fo1 (OFC) right VPMpc (Thalamus, ventral posterior medial Nucleus, parvocellular part) right VPi (Thalamus, ventroposterior inferior Nucleus) right Area 8d1 (SFG) right Area IFJ1 (IFS, PreCS) right Area s24 (sACC) right Area hOc4v (LingG) right Area PFop (IPL) right Area 6v2 (PreCG) right Area Ph2 (PhG) right AcbL (Ventral Striatum, Lateral Accumbens) right Area Fo2 (OFC) right Area Te 2.2 (STG) right Area hIP7 (IPS) right Area 7PC (SPL) right Area TeI (STG) right
time
0 6183241.5 9256688.0 11620509.0 50135348.0 904087.06250 4846511.5 8475410.0 17371956.0 0.0 5894766.0 26437654.0 2949993.75 4552346.0 4374451.50 2437623.50 13843605.0 0 2966875.00 7344362.0 26257850.0 5248858.5 72863416.0 4135943.25 7646967.5 12687684.0 7322185.5 7733145.0 16614610.0 6696513.0 14934314.0 1352028.250 7804864.0 6043004.5 11491730.0 15590435.0 25878666.0 7489972.0 7.042964e+05 26892562.0 5743358.5 ... 8.803709e+05 2648316.50 22865584.0 4221276.0 71956824.0 4922620.0 6656348.5 5473907.0 155344.703125 4588977.0 0.0 21295998.0 8712172.0 3061519.25 5800413.0 3048601.75 2436036.75 2358085.50 6799656.0 3572180.75 0.0 2967143.0 4253480.50 19327054.0 469423.15625 0.0 4806072.500 15994314.0 3931410.00 11446601.0 41202012.0 10985381.0 7831946.5 3694239.25 7.491303e+05 16632729.0 4705827.00 10979139.0 15230785.0 7308580.0
1 6108635.0 9236258.0 12187711.0 56829668.0 413420.50000 4894099.0 8892433.0 17956672.0 0.0 6584799.0 26807094.0 3622242.00 4909077.0 4400168.50 2616583.25 17092750.0 0 2405303.75 7644930.5 26508086.0 5030463.5 68759456.0 3982628.00 8103564.0 13564736.0 7235931.5 7995878.5 17200588.0 6940769.0 15749016.0 1643669.500 8183305.5 6399442.5 12045824.0 15512196.0 25335614.0 7685449.0 6.385053e+05 29298060.0 5573589.0 ... 8.777089e+05 2652186.50 24604410.0 4924369.5 75364512.0 4560644.0 6815905.5 5725012.0 94637.750000 4370055.5 0.0 22659438.0 8390805.0 2965670.25 6518479.5 2908179.00 2373609.25 2643406.75 6451315.5 4858290.00 0.0 3055421.0 4981997.50 21045090.0 432271.15625 0.0 5015896.000 16960188.0 3975402.75 11505989.0 44127460.0 10737757.0 8555464.0 3887151.25 5.029763e+05 16347874.0 4666575.00 11249933.0 15388480.0 7495143.5
2 6290312.5 9414506.0 12164397.0 53696612.0 345648.78125 4210697.5 9026672.0 17740690.0 0.0 5965111.0 26853302.0 3627965.00 4777333.5 4211359.00 2539742.75 14013870.0 0 3078142.50 7744579.0 26023974.0 5806078.0 71700752.0 3867132.00 9374994.0 13146422.0 7239460.5 8132538.5 17165466.0 7066236.0 15824191.0 1393357.375 8382414.0 6223152.5 11578051.0 17526332.0 26322088.0 7858992.0 5.595412e+05 26585416.0 5364122.0 ... 1.036634e+06 2653769.75 24447934.0 4615941.5 71014296.0 4673686.0 6132615.5 5900754.5 138962.515625 4472815.0 0.0 22202640.0 7475299.5 3002945.25 6224370.5 3203965.50 2231012.25 2402230.00 6535100.5 4148401.00 0.0 2776466.5 5011079.00 19653656.0 431326.68750 0.0 3508990.000 16846668.0 4174477.75 11575447.0 43030900.0 10011034.0 7991413.0 4020517.50 8.859569e+05 16841420.0 4539973.50 11675789.0 15266239.0 8622309.0
3 6306517.0 9308387.0 12080316.0 49492984.0 534038.93750 4144622.0 9380361.0 17826962.0 0.0 6476490.0 27002702.0 3484691.25 4868639.5 4298190.00 2450447.00 11989514.0 0 2278316.25 7921765.0 25523310.0 5246519.5 72536024.0 4207837.00 7155906.0 13816259.0 7585209.5 8224896.5 17338774.0 6725375.0 15766608.0 1500750.750 7770048.0 5880788.5 11144794.0 18188894.0 25871610.0 7796155.0 1.044656e+06 25318522.0 5483179.0 ... 7.248223e+05 2542427.75 23824186.0 4424530.0 70700384.0 4714735.0 6463342.5 5565737.5 280850.500000 4796262.0 0.0 21652302.0 6469119.5 3106649.00 6233608.0 3109273.25 2817538.50 2360602.25 6309934.0 3503172.75 0.0 3232638.0 5104841.00 18881920.0 440844.78125 0.0 4516006.000 16499194.0 4115602.25 11560218.0 43110324.0 10336225.0 7891320.5 3857892.00 7.612718e+05 16473667.0 3886226.75 10822401.0 14999386.0 8281333.5
4 6231495.0 9245281.0 11856736.0 52838224.0 439799.68750 4359679.5 8706240.0 18118156.0 0.0 6365392.5 26390522.0 2782361.00 5186604.5 4156734.00 1876336.50 15480371.0 0 2543997.50 7290475.5 25157060.0 4850100.0 70018072.0 4094525.00 8395728.0 12699462.0 6794422.5 8010607.0 17302174.0 6145284.0 15880582.0 1304770.000 8050523.0 6182924.5 12308698.0 17443300.0 25732914.0 7436670.5 7.906253e+05 25083954.0 5432927.0 ... 8.145608e+05 2750148.75 24519684.0 4837526.0 71686312.0 4408832.0 5322190.5 5701096.5 77050.695312 4152393.0 0.0 21979768.0 8301676.0 3283142.75 6876869.5 2964895.00 2522438.50 2396311.00 6365683.5 3687331.75 0.0 2966348.5 4783911.00 20264070.0 434603.81250 0.0 4795858.000 16728392.0 4428860.50 12057172.0 44276560.0 9635669.0 7957959.5 3856543.50 8.292972e+05 15952979.0 4777050.00 10729866.0 14739868.0 7501463.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
155 6254368.0 8891319.0 12248220.0 44639060.0 745550.18750 4777046.0 8799532.0 17806332.0 0.0 6697617.5 26209144.0 7751585.50 4588524.5 4125066.50 2831447.25 12284433.0 0 3178693.25 7926078.0 24987586.0 5017832.0 73455032.0 4112417.50 5724774.5 15038692.0 7227746.0 7880227.0 16174898.0 6265450.5 15369456.0 1858612.125 7717444.0 6094635.5 10009273.0 16390890.0 25393106.0 7923934.5 3.791908e+05 26167354.0 5858382.5 ... 8.376682e+05 2482503.25 25593368.0 4480033.5 71202840.0 4332002.0 6720346.5 5538233.5 16948.416016 4730363.0 0.0 20160770.0 9713702.0 3093875.00 5336238.5 3526188.25 2915001.25 2991799.50 6780109.5 2095943.75 0.0 4345181.5 3005672.25 19802364.0 489851.00000 0.0 2650493.250 16641633.0 4488696.50 13043775.0 35729632.0 9555072.0 7922947.0 2906474.00 1.116048e+06 16489642.0 3968216.75 12413431.0 13298821.0 7504607.0
156 6360470.0 8595827.0 12248702.0 46172536.0 670133.31250 4769500.0 9339511.0 18471934.0 0.0 6859483.5 26152002.0 6725272.50 4822016.0 3588558.75 2531677.75 11664521.0 0 3097373.75 7693213.0 25047798.0 4582033.5 72479264.0 4386979.50 5496930.0 14522036.0 7573707.0 8231626.0 16630520.0 6665559.0 15664221.0 1996824.375 6971209.0 6200309.0 10251457.0 17171598.0 26210236.0 7887516.5 3.606908e+05 24827532.0 5970894.0 ... 1.125055e+06 2683018.00 25789666.0 4859348.0 72062224.0 4753342.0 6617663.0 5740061.5 168170.671875 4672233.0 0.0 19749080.0 9647298.0 3391615.25 5083252.0 3566211.00 2831797.75 2928808.25 6673817.5 2393526.50 0.0 3928859.0 3487724.00 19703204.0 447285.75000 0.0 3294364.250 17626238.0 3997248.25 12896211.0 36717236.0 9749632.0 7842535.5 3283321.75 8.448637e+05 16808042.0 4059740.25 11302148.0 13102294.0 7935746.5
157 6286644.5 8771448.0 11657032.0 44562764.0 695862.25000 5220428.5 9003571.0 17981498.0 0.0 6650981.0 26252782.0 6858545.00 4622028.0 3927415.75 2888515.00 12059638.0 0 3023663.25 7217955.0 25579730.0 5189891.0 72897592.0 3986568.50 4492544.0 13811925.0 7677595.0 8082442.5 16409133.0 6638530.5 15241515.0 1844063.000 7619035.0 6090266.5 10095063.0 15476531.0 25696488.0 7849276.0 7.571191e+05 25041916.0 5710091.5 ... 9.386422e+05 2497361.50 24826664.0 4902233.0 70865472.0 5465084.0 6844584.0 5850029.5 98484.406250 4657099.0 0.0 20569910.0 9300803.0 3237374.00 5970891.0 3231061.75 2682420.75 2886591.75 6625352.5 2118019.00 0.0 3582138.5 3438257.75 19703594.0 488890.59375 0.0 1881630.375 16957170.0 3785815.50 12851889.0 36026336.0 9457578.0 7309237.5 3212895.50 1.009323e+06 16341786.0 3838645.75 10981891.0 13307177.0 7808784.0
158 6359030.5 8899939.0 11741102.0 44100924.0 735620.12500 5169422.0 9903086.0 18474158.0 0.0 6789945.0 27020072.0 6985529.50 4792334.0 3931160.25 2776351.50 11077463.0 0 2992134.50 7386684.0 25692480.0 5822266.5 73869416.0 4044218.75 3456458.5 14701084.0 7819225.0 8182005.0 16085339.0 6534297.5 15419308.0 1870238.875 7358696.0 6103300.0 10221715.0 15888691.0 26350172.0 7696902.5 5.409837e+05 26772064.0 5897696.0 ... 1.008583e+06 2481630.25 25405384.0 4466920.0 71468304.0 4196446.0 6780663.5 6022461.0 85669.132812 4763604.5 0.0 21254922.0 8005787.0 3365790.50 5712400.5 3040933.25 3018714.25 3650696.00 6469112.5 2258537.25 0.0 4216482.5 3793278.75 20440094.0 532213.93750 0.0 3151359.000 16685720.0 4435807.50 12488770.0 35983192.0 8956233.0 7706752.0 3509651.00 1.224284e+06 16108104.0 3682925.00 10914008.0 13778813.0 7267086.0
159 6299186.0 8768827.0 11506031.0 47103964.0 795218.50000 5260304.5 9570612.0 18342434.0 0.0 6584044.0 26806402.0 5695832.00 4892711.0 4313900.50 2913498.25 10740577.0 0 3207874.25 7451525.5 24986022.0 4993945.0 73761816.0 4100000.50 5720110.5 13957900.0 7590585.5 8123773.0 16773602.0 6898074.5 15642904.0 1402513.375 7104612.0 6424826.0 10732196.0 15401712.0 25998946.0 7706192.5 5.831604e+05 26385392.0 5534586.0 ... 8.611431e+05 2222536.75 25885360.0 5122880.0 70934936.0 3691270.5 6648401.5 6070711.0 63241.390625 4668014.5 0.0 21549700.0 9530288.0 3278584.00 6410160.0 3328460.00 2549994.00 2599474.25 6604570.5 2478939.25 0.0 4065337.0 3508085.25 19163538.0 476621.25000 0.0 2215295.000 16794940.0 3912883.75 12522118.0 37923348.0 9087300.0 8159307.5 3613164.50 1.221007e+06 16410814.0 3880293.25 10972222.0 13829141.0 7266331.5

160 rows × 414 columns



The extracted region-wise variance values are mapped back onto the labelled atlas using colorize method. This creates a new image where each region is assigned the corresponding extracted value. We then visualize one time point of the resulting image with nilearn.plotting.view_img, using a magma colormap to show regional differences.

colored_map = julichbrain.colorize(workingmemory_signals_var.mean())
plotting.view_img(colored_map, cmap="magma", symmetric_cmap=False)
[NiftiLabelsMasker.fit] Loading regions from <nibabel.nifti1.Nifti1Image object at 0x7f0545d00cd0>
[NiftiLabelsMasker.fit] Finished fit
[NiftiLabelsMasker.inverse_transform] Computing image from signals
/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/venv/lib/python3.11/site-packages/numpy/_core/fromnumeric.py:840: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)


So far, we used a labelled atlas map, where each voxel belongs to a discrete region. As an alternative, siibra can also work with probabilistic maps. Here we load the DiFuMo 64-component statistical map and use it to extract signals from the working-memory fMRI data. Probabilistic maps can represent spatially overlapping components and are often useful for functional parcellations.

[NiftiMapsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f05bbc3c350>
[NiftiMapsMasker.wrapped] Loading regions from <nibabel.nifti1.Nifti1Image object at 0x7f0542a7fd50>
[NiftiMapsMasker.wrapped] Resampling regions
[NiftiMapsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[NiftiMapsMasker.wrapped] Loading data from <nibabel.nifti1.Nifti1Image object at 0x7f05bbc3c350>
[NiftiMapsMasker.wrapped] Extracting region signals
[NiftiMapsMasker.wrapped] Cleaning extracted signals
region Component 1: Superior frontal sulcus Component 2: Fusiform gyrus Component 3: Calcarine cortex posterior Component 4: Cingulate cortex posterior Component 5: Parieto-occipital sulcus superior Component 6: Insula antero-superior Component 7: Superior temporal sulcus with angular gyrus Component 8: Planum temporale Component 9: Cerebellum Crus II Component 10: Superior parts of Postcentral and Precentral gyri Component 11: Transverse sinus Component 12: Paracentral gyrus right Component 13: Superior occipital gyrus Component 14: Cingulate gyrus mid-posterior Component 15: ventricles Component 16: Fusiform gyrus posterior Component 17: Superior frontal gyrus medial Component 18: Precuneus superior Component 19: Planum polare Component 20: Parieto-occipital sulcus middle Component 21: Cerebellum I-V Component 22: Superior fornix and isthmus Component 23: Anterior Cingulate Cortex Component 24: Descending occipital gyrus Component 25: Putamen Component 26: Cingulate gyrus mid-anterior Component 27: Superior parietal lobule posterior Component 28: Paracentral lobule Component 29: Inferior occipital gyrus Component 30: Superior rostral gyrus Component 31: Calcarine sulcus anterior Component 32: Intraparietal sulcus Component 33: Superior parietal lobule anterior Component 34: Precentral gyrus medial Component 35: Lingual gyrus anterior Component 36: Angular gyrus superior Component 37: Supramarginal gyrus Component 38: Intraparietal sulcus left Component 39: Dorsomedial prefrontal cortex antero-superior Component 40: Precentral gyrus superior Component 41: Postcentral gyrus inferior Component 42: Lateral occipital cortex Component 43: Callosomarginal sulcus Component 44: Paracentral lobule superior Component 45: Heschl’s gyrus Component 46: Occipital pole Component 47: Thalamus Component 48: Intraparietal sulcus right Component 49: Inferior frontal sulcus Component 50: Postcentral gyrus left Component 51: Middle frontal gyrus Component 52: Inferior frontal gyrus Component 53: Parieto-occipital sulcus anterior Component 54: Precuneus anterior Component 55: Lingual gyrus Component 56: Superior occipital sulcus Component 57: Superior parietal lobule Component 58: Middle frontal gyrus anterior Component 59: Angular gyrus inferior Component 60: Cuneus Component 61: Middle temporal gyrus Component 62: Superior frontal gyrus Component 63: Central sulcus Component 64: Caudate
time
0 69454968.0 74180760.0 46767900.0 37200304.0 47543936.0 64524108.0 67354032.0 48675644.0 84250168.0 63790732.0 49226544.0 52518448.0 70613120.0 47212528.0 42718996.0 77470616.0 40338464.0 42129068.0 72565776.0 49606984.0 84598016.0 46407096.0 47266440.0 61154184.0 60863640.0 48891768.0 60231856.0 66236080.0 45701524.0 42664984.0 41764532.0 44485528.0 70835560.0 45663024.0 53165124.0 54958884.0 61672704.0 52145688.0 56452768.0 56719240.0 35679816.0 73180160.0 55886056.0 80087104.0 66398864.0 69512640.0 48419384.0 44984004.0 50088088.0 52091208.0 80798560.0 70511088.0 46803160.0 44533624.0 67440392.0 47673328.0 62145748.0 67185464.0 56986316.0 37462184.0 68806048.0 68503272.0 46784448.0 44989376.0
1 69521296.0 74243552.0 47074644.0 37276056.0 47588664.0 64761620.0 67080652.0 48425464.0 83740392.0 63699832.0 49557448.0 52798260.0 70902384.0 47225732.0 42906832.0 77245504.0 40402444.0 42093328.0 72428264.0 49771616.0 84367856.0 46469520.0 47229464.0 61345056.0 60837872.0 48846232.0 60656200.0 66400244.0 45507856.0 42554576.0 42082308.0 44538704.0 71237040.0 45468976.0 53513416.0 54970924.0 61620256.0 52270816.0 56395340.0 57044592.0 35622936.0 73250400.0 55838852.0 80400248.0 66214668.0 69589408.0 48504280.0 45156056.0 50113084.0 52398864.0 80965752.0 70586416.0 46831912.0 44551664.0 67648568.0 47864680.0 62187640.0 67248168.0 57065152.0 37790832.0 68680576.0 68618360.0 46787476.0 45036888.0
2 69904368.0 74476880.0 47254604.0 37342048.0 47930128.0 64889532.0 67449872.0 48364184.0 84261112.0 64543408.0 49572552.0 53213532.0 70563888.0 47746348.0 42875732.0 77883120.0 40867284.0 42534320.0 72527984.0 49591008.0 84605744.0 46625584.0 47135680.0 61386272.0 60776180.0 48799528.0 60894472.0 66564920.0 46295312.0 42887012.0 41950160.0 45029952.0 71201768.0 45835184.0 53558128.0 55297688.0 61556624.0 52586352.0 56551180.0 57289216.0 35773896.0 73500016.0 56041724.0 80442864.0 66336840.0 69924528.0 48581640.0 45372128.0 50430840.0 52822308.0 81604328.0 70829392.0 47105472.0 44763612.0 67800368.0 48010716.0 62748324.0 67519384.0 57247624.0 37685072.0 69025696.0 69057200.0 46971016.0 45198736.0
3 69889936.0 75225640.0 47082660.0 37524776.0 48388476.0 64891440.0 67835224.0 48832876.0 85089056.0 65459568.0 50044424.0 53234216.0 70651584.0 48136304.0 43135516.0 78149920.0 40989640.0 42971424.0 72730744.0 49727368.0 85143792.0 46976528.0 47180976.0 61358320.0 61233072.0 48971664.0 60949060.0 66878632.0 46324544.0 42867112.0 42167832.0 45360632.0 71319448.0 45895376.0 53442608.0 55562048.0 61636792.0 52867920.0 56392508.0 57372488.0 36078088.0 73668456.0 56250800.0 80864848.0 66316808.0 69817928.0 48704728.0 45557688.0 50456068.0 52739956.0 81991832.0 71107352.0 47072000.0 45006000.0 67794936.0 48134544.0 63470580.0 67619488.0 57267320.0 37704456.0 69612856.0 69116312.0 47175440.0 45199172.0
4 69485856.0 75029984.0 47139364.0 37007304.0 47895172.0 64597776.0 67269144.0 48351388.0 84694536.0 64306688.0 50508248.0 52838496.0 70884192.0 47700208.0 42688092.0 77594400.0 40612020.0 42676468.0 72333904.0 49810600.0 84726528.0 47046216.0 46939344.0 61491464.0 60958112.0 48508268.0 60784372.0 66633632.0 45850200.0 42148636.0 42290680.0 45421376.0 71017600.0 45618096.0 53532408.0 55355160.0 61374792.0 52771412.0 56024112.0 57080952.0 35998536.0 73185256.0 55956580.0 80873424.0 66574996.0 69852120.0 48503560.0 45375068.0 50207868.0 52286096.0 81576240.0 70841280.0 46935984.0 44652548.0 67790912.0 47929752.0 63393740.0 67112128.0 56933968.0 37938824.0 69087088.0 68766600.0 46828048.0 44897708.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
155 69145680.0 74242800.0 47176400.0 36910072.0 47646228.0 64404004.0 66727432.0 47920020.0 84123176.0 63718824.0 49392304.0 52710648.0 70398088.0 47253484.0 42811392.0 77650128.0 40674168.0 42133444.0 71468000.0 49395144.0 84441944.0 46143560.0 47052224.0 61324720.0 60623324.0 48384800.0 60485328.0 65572976.0 46305608.0 42460432.0 41958840.0 44803584.0 70886616.0 45524496.0 53351968.0 54821468.0 60958492.0 52637320.0 55913116.0 56894960.0 35869896.0 73008504.0 55525136.0 79751168.0 65917284.0 69628480.0 48333504.0 45327816.0 50110808.0 52182444.0 80904224.0 70595352.0 46692736.0 44293816.0 67371184.0 48113700.0 63033420.0 67250232.0 56432848.0 37589680.0 68526816.0 68314352.0 46721448.0 45071840.0
156 69328608.0 74334408.0 46955764.0 37146224.0 47650528.0 64490040.0 66856812.0 47749992.0 83628408.0 63113076.0 49358056.0 52452012.0 70414520.0 47621872.0 42663172.0 77462144.0 40357260.0 42082200.0 71552480.0 49447832.0 84097888.0 45798824.0 47140744.0 61001280.0 60719016.0 48446476.0 60173072.0 65895288.0 45863528.0 42600144.0 41756816.0 44971280.0 70655504.0 45292784.0 52874776.0 55176920.0 61047064.0 52408920.0 56088760.0 56570488.0 36012160.0 72756792.0 55449900.0 79879376.0 65825820.0 69426264.0 48345680.0 45277996.0 49948380.0 52167508.0 80848040.0 70324168.0 46699320.0 44433932.0 67334144.0 47707116.0 62588524.0 67098128.0 56926092.0 37522616.0 68651312.0 68396272.0 46698088.0 44912820.0
157 69222992.0 74355992.0 46976520.0 37187416.0 47557592.0 64424456.0 66970292.0 48029892.0 83860072.0 63029036.0 49216752.0 52294340.0 70201592.0 47790124.0 42816272.0 77345232.0 40320984.0 42153800.0 71886592.0 49336400.0 84488504.0 45836944.0 47219608.0 61045016.0 60881168.0 48554424.0 59825020.0 66138936.0 46051192.0 42740544.0 41519140.0 44687536.0 70683624.0 45617384.0 52931068.0 55330308.0 61226368.0 52085452.0 56374040.0 56506248.0 35921864.0 72743736.0 55629572.0 79848664.0 66005724.0 69390992.0 48328260.0 45173056.0 49767072.0 51927384.0 80872480.0 70110440.0 46559720.0 44518208.0 67345856.0 47363104.0 62037420.0 67196200.0 57041192.0 37446272.0 68819704.0 68716832.0 46717784.0 44905992.0
158 69569512.0 74295312.0 46553764.0 37345488.0 47521688.0 64334020.0 66886228.0 48234200.0 83707624.0 62902924.0 49247432.0 52456340.0 70292576.0 47824608.0 43195548.0 77229656.0 40437328.0 42120736.0 72034720.0 49392728.0 84680480.0 45516388.0 47283056.0 60948472.0 60861432.0 48689960.0 59866220.0 66293536.0 45685592.0 42793228.0 41564068.0 44676960.0 70881408.0 45618640.0 52924632.0 55438544.0 61148480.0 51991448.0 56500808.0 56476136.0 35870640.0 72767784.0 55717320.0 80181712.0 66092008.0 68978560.0 48378808.0 45063896.0 49765216.0 52031872.0 80870960.0 70175368.0 46721472.0 44624416.0 67268952.0 47408272.0 61830444.0 67210936.0 57170616.0 37332656.0 68901248.0 68984584.0 46708264.0 45054836.0
159 69750536.0 74222488.0 46285672.0 37576248.0 47474304.0 64357208.0 66884124.0 48226564.0 83663904.0 62502536.0 49149928.0 52314164.0 70197720.0 47990568.0 43117404.0 77143240.0 40455712.0 42210996.0 72175856.0 49324744.0 84369408.0 45863600.0 47278048.0 60933392.0 60740656.0 48690840.0 59903708.0 65862920.0 45279232.0 42964356.0 41519560.0 44645056.0 70789776.0 45668792.0 52910616.0 55514020.0 61334844.0 51918936.0 56645888.0 56527808.0 35625368.0 72831384.0 55817812.0 79983424.0 66239564.0 68931200.0 48356436.0 45075176.0 49601476.0 52045728.0 80811128.0 70122680.0 46997680.0 44667312.0 66996396.0 47284816.0 61740248.0 67360056.0 57352096.0 37253360.0 68927344.0 69081888.0 46754592.0 45110320.0

160 rows × 64 columns



A similar workflow for surface-based fMRI data is possible.

julichbrain_fs5 = siibra.get_map("julich 3.1", "fsaverage5")
fs_variant = "inflated"
file_template = (
    f"{subject}_task-workingmemory_acq-seq_space-fsaverage5_hemi-" + "{}.func.gii"
)
url_template = dataset_base_url + folder + file_template

giivol = siibra.volumes.from_url(
    {h: url_template.format(h[0]) for h in ["Left", "Right"]},
    space="fsaverage5",
    format="gii-timeseries",
    time=list(range(160)),
)
signals = julichbrain_fs5.extract_signals_with_nilearn(
    giivol, surface_variant=fs_variant
)
signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
region Area 45 (IFG) left Area 44 (IFG) left Area Fo1 (OFC) left Area Fo2 (OFC) left Area Fo3 (OFC) left Area hOc5 (LOC) left Area hOc2 (V2, 18) left Area hOc1 (V1, 17, CalcS) left Area hOc4v (LingG) left Area hOc3v (LingG) left Area Te 1.0 (HESCHL) left Area Te 2.1 (STG) left Area TPJ (STG, SMG) left Area Te 1.2 (HESCHL) left Area Te 3 (STG) left Area Te 1.1 (HESCHL) left Area Te 2.2 (STG) left Area 33 (ACC) left Area s32 (sACC) left Area p32 (pACC) left Area Id2 (Insula) left Area Id3 (Insula) left CA2 (Hippocampus) left CA3 (Hippocampus) left Area EC (Hippocampal Region, Entorhinal Cortex) left DG (Hippocampus) left CA1 (Hippocampus) left Area Op4 (POperc) left Area Op1 (POperc) left Area Op2 (POperc) left Area Op3 (POperc) left Area FG2 (FusG) left Area FG1 (FusG) left Area PGp (IPL) left Area PFt (IPL) left Area PGa (IPL) left Area PFop (IPL) left Area PFm (IPL) left Area PFcm (IPL) left Area Ig2 (Insula) left ... Area Ig3 (Insula) right Area Id4 (Insula) right Area Id5 (Insula) right Area Ia1 (Insula) right Area Id6 (Insula) right Area SFS1 (SFS) right Area SFS2 (SFS) right Area MFG1 (MFG) right Area MFG2 (MFG) right Area 6v2 (PreCG) right Area 6v1 (PreCG) right Area 6r1 (PreCG) right Area Op5 (Frontal Operculum) right Area Op6 (Frontal Operculum) right Area Op7 (Frontal Operculum) right Area Ph1 (PhG) right Area Ph2 (PhG) right Area Ph3 (PhG) right Area CoS1 (CoS) right Area SFG2 (SFG) right Area Id9 (Insula) right Area Ia3 (Insula) right Area Ia2 (Insula) right Area Id8 (Insula) right Area Id10 (Insula) right Area Op10 (Frontal Operculum) right Area FG5 (FusG) right Area OTS1 (OTS) right Frontal-II (GapMap) right Temporal-to-Parietal (GapMap) right Frontal-to-Occipital (GapMap) right Frontal-to-Temporal-I (GapMap) right Frontal-to-Temporal-II (GapMap) right Frontal-I.1 (GapMap) right Frontal-I.2 (GapMap) right Area SFG3 (SFG) right Area SFG4 (SFG) right Area MFG4 (MFG) right Area MFG5 (MFG, IFG) right Area 6v3 (PreCG) right
time
0 26039.021484 27793.498047 3103.293945 5655.768555 12016.558594 30267.447266 28430.259766 29809.320312 25349.318359 27889.210938 31139.429688 29114.906250 26131.619141 29619.478516 26597.656250 29884.642578 27252.076172 16162.702148 11156.671875 24842.541016 30998.824219 31059.058594 0.0 0.0 9960.377930 19652.365234 2615.781006 27639.900391 28736.089844 28770.207031 27876.197266 27270.376953 28506.255859 31411.029297 28146.367188 29807.023438 27719.773438 27270.488281 28889.746094 30223.144531 ... 28011.195312 27657.515625 30027.761719 30608.380859 28060.023438 24702.296875 23957.406250 24447.906250 24002.003906 25724.888672 26419.623047 25406.871094 27116.583984 27567.906250 26665.179688 30436.187500 29462.859375 31396.425781 27582.376953 26665.679688 30290.121094 29461.101562 27068.312500 27873.800781 24728.921875 24573.554688 19311.455078 4805.756836 25362.878906 21296.767578 30163.169922 26154.341797 7378.220703 23112.900391 27594.001953 24778.050781 24932.255859 25258.947266 24572.699219 25006.019531
1 26090.376953 27909.818359 3029.443604 5517.776367 11911.737305 30320.097656 28468.382812 30047.021484 25381.621094 27973.375000 31263.708984 28957.976562 26030.675781 29406.867188 26490.812500 29765.513672 27052.984375 16170.198242 11130.068359 24820.458984 31009.960938 30844.189453 0.0 0.0 9728.484375 19577.007812 2602.202637 27600.267578 28632.929688 28751.041016 27701.626953 27196.386719 28691.730469 31427.693359 28264.273438 29842.630859 27725.195312 27308.503906 28797.746094 30092.011719 ... 28113.958984 27586.361328 29986.660156 30594.689453 28103.380859 24700.607422 24004.630859 24442.966797 23972.388672 25745.267578 26500.253906 25386.486328 27068.376953 27630.619141 26720.914062 30359.189453 29495.982422 31485.525391 27439.250000 26641.146484 30251.572266 29536.992188 26864.119141 27836.025391 24765.179688 24671.451172 18991.294922 4647.573242 25307.587891 21201.144531 30174.035156 26096.429688 7379.507812 23144.453125 27644.839844 24750.152344 24847.103516 25263.708984 24526.160156 24980.234375
2 26159.679688 27855.900391 3038.560791 5560.369141 11982.768555 30427.062500 28614.679688 30041.208984 25482.220703 28167.345703 31122.585938 28883.457031 26075.382812 29464.941406 26565.144531 29690.332031 27026.482422 16245.883789 11111.641602 24909.548828 30884.773438 30832.503906 0.0 0.0 9870.886719 19666.441406 2602.196533 27628.105469 28689.785156 28716.121094 27669.339844 27440.417969 28902.591797 31567.527344 28410.775391 30015.794922 27717.976562 27426.197266 28812.347656 30031.718750 ... 28157.632812 27796.683594 30145.541016 30868.531250 28127.605469 24843.277344 24124.486328 24536.162109 24170.343750 25726.994141 26602.730469 25451.994141 27280.330078 27593.214844 26841.427734 30434.142578 29476.462891 31411.847656 27846.585938 26760.035156 30299.230469 29585.044922 27027.958984 28005.542969 24994.259766 24970.449219 19229.443359 4774.485352 25520.373047 21312.703125 30320.105469 26273.113281 7405.889648 23172.246094 27709.406250 24864.162109 25081.388672 25383.101562 24727.970703 25096.257812
3 26216.595703 27905.992188 3088.083252 5660.012695 12018.066406 30486.822266 28678.322266 30048.441406 25515.990234 28100.308594 30790.347656 29144.416016 26085.548828 29650.351562 26783.128906 29712.642578 27181.583984 16225.941406 11187.820312 24821.630859 30980.230469 30855.662109 0.0 0.0 10083.145508 19705.923828 2619.432861 27717.734375 28735.095703 28734.679688 27755.216797 27502.148438 28737.351562 31611.849609 28452.533203 30086.353516 27765.601562 27487.730469 28758.169922 30176.958984 ... 28405.380859 27633.509766 30120.455078 30778.621094 28038.914062 24767.585938 24048.863281 24560.568359 24269.013672 25783.892578 26623.896484 25520.398438 27114.234375 27464.744141 26498.476562 30281.822266 29309.005859 31379.416016 27816.494141 26730.009766 30364.964844 29528.046875 27179.246094 27978.142578 24929.050781 24687.390625 19438.671875 4863.932617 25478.296875 21408.507812 30387.253906 26295.568359 7395.220703 23187.195312 27677.154297 24810.951172 25039.042969 25399.859375 24716.710938 25143.787109
4 26105.851562 27873.685547 3019.736328 5523.677246 11835.663086 30391.644531 28593.900391 30147.449219 25452.130859 28074.812500 31187.646484 28904.855469 26013.048828 29480.853516 26617.890625 29739.744141 27067.201172 16171.034180 11003.254883 24701.720703 30934.771484 30593.720703 0.0 0.0 9850.672852 19638.701172 2591.259277 27667.787109 28678.863281 28679.541016 27789.509766 27317.462891 28789.904297 31431.816406 28301.369141 29999.562500 27602.376953 27432.207031 28679.591797 29985.869141 ... 28234.097656 27814.142578 30143.064453 30675.519531 28015.175781 24625.447266 23904.107422 24437.375000 24187.939453 25548.509766 26513.400391 25415.244141 27345.111328 27699.933594 26869.097656 30366.136719 29307.720703 31527.435547 27721.359375 26558.425781 30224.404297 29326.410156 26648.236328 27879.308594 24715.103516 24385.593750 19082.509766 4692.947754 25452.599609 21242.253906 30217.078125 26181.230469 7398.998535 23059.082031 27560.134766 24662.949219 24917.953125 25199.628906 24647.179688 25037.142578
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
155 26029.888672 27777.093750 3058.863281 5639.889648 12028.750000 30333.171875 28643.574219 30033.960938 25335.535156 28056.482422 30825.298828 28996.789062 25838.589844 29328.521484 26364.964844 29795.359375 26839.958984 16201.418945 11240.016602 24698.558594 30978.152344 30513.263672 0.0 0.0 10002.595703 19674.802734 2608.551514 27424.410156 28432.191406 28453.730469 27556.089844 27192.865234 28665.414062 31149.087891 28225.337891 29669.669922 27394.828125 27225.994141 28580.779297 30083.355469 ... 27786.082031 27495.820312 29848.894531 30933.591797 27728.119141 24573.625000 23844.712891 24332.156250 24043.466797 25647.333984 26379.039062 25245.187500 26973.673828 26979.371094 26321.429688 30222.626953 29268.632812 31253.390625 27270.691406 26515.378906 30159.105469 29221.324219 26532.011719 27944.421875 24760.601562 24338.343750 19472.410156 4881.756836 25185.130859 21238.130859 30134.154297 26041.593750 7389.045410 23085.869141 27476.429688 24614.310547 24769.150391 25167.912109 24583.382812 25039.732422
156 25993.652344 27834.599609 3044.905029 5661.012695 12005.128906 30125.412109 28517.542969 29857.414062 25325.427734 27965.669922 30945.486328 28945.259766 25819.380859 29125.462891 26396.679688 29879.072266 26813.740234 16130.139648 11226.886719 24743.015625 30915.123047 30404.917969 0.0 0.0 9842.327148 19595.064453 2594.211182 27443.890625 28404.708984 28496.236328 27518.078125 27132.039062 28563.619141 31241.949219 28244.177734 29833.117188 27398.931641 27274.976562 28543.220703 29984.757812 ... 27651.310547 27299.859375 29808.603516 30615.187500 27840.072266 24624.207031 23927.607422 24387.265625 23999.257812 25574.632812 26295.988281 25283.029297 26838.421875 27121.421875 26437.384766 30241.199219 29185.615234 31338.443359 27241.339844 26611.474609 30112.992188 29148.578125 26213.177734 27833.884766 24772.091797 24311.685547 19136.199219 4784.732422 25192.058594 21185.671875 30168.431641 25962.052734 7368.865723 23084.437500 27538.052734 24696.996094 24818.449219 25203.941406 24541.218750 25027.050781
157 25915.966797 27772.197266 3086.776123 5732.961914 12038.557617 30161.666016 28495.964844 29761.068359 25325.080078 28010.058594 31190.718750 28987.232422 25879.453125 29447.736328 26465.894531 29822.546875 26821.068359 16199.369141 11213.494141 24788.548828 30951.189453 30656.390625 0.0 0.0 10126.496094 19584.003906 2588.632324 27503.894531 28484.972656 28588.531250 27704.468750 27096.238281 28639.773438 31201.896484 28098.080078 29899.841797 27480.779297 27387.386719 28605.781250 30000.613281 ... 28108.074219 27498.236328 29913.542969 30751.283203 27855.685547 24624.216797 23924.388672 24392.361328 23993.906250 25469.775391 26241.753906 25325.904297 26941.107422 27223.771484 26387.917969 30205.466797 29250.882812 31271.476562 27295.564453 26634.705078 30138.939453 29375.806641 26385.718750 27796.410156 24788.955078 24172.296875 19402.722656 4873.079102 25265.447266 21225.175781 30196.437500 26010.123047 7368.393066 23107.437500 27520.833984 24755.792969 24901.333984 25193.718750 24521.193359 24980.968750
158 25997.472656 27814.732422 3142.386963 5715.778320 12036.626953 30136.578125 28356.189453 29660.904297 25221.423828 27851.757812 31021.201172 29052.800781 25872.398438 29305.351562 26487.609375 29896.480469 26927.576172 16142.972656 11240.160156 24789.369141 31021.337891 30741.548828 0.0 0.0 10012.382812 19657.214844 2599.997803 27537.648438 28524.416016 28610.195312 27562.595703 27034.347656 28582.841797 31250.626953 28090.869141 29941.386719 27510.587891 27358.312500 28546.906250 30098.078125 ... 28065.673828 27364.175781 29941.289062 30607.398438 27870.166016 24683.177734 23865.558594 24311.517578 24002.115234 25498.900391 26290.968750 25313.769531 26803.404297 27227.152344 26516.814453 30094.351562 29178.681641 31276.689453 27334.330078 26760.214844 30039.787109 29420.892578 26377.451172 27886.371094 24689.644531 23950.601562 19170.132812 4849.909668 25281.681641 21205.583984 30256.187500 26092.277344 7363.273438 23075.074219 27569.755859 24872.980469 24876.578125 25213.275391 24322.408203 24909.263672
159 25942.492188 27757.652344 3069.707520 5640.885742 11994.945312 30070.208984 28208.683594 29561.804688 25302.945312 27723.548828 30838.152344 28986.302734 25963.314453 29518.044922 26498.179688 29773.320312 26866.880859 16212.102539 11268.201172 24927.000000 30964.681641 30619.748047 0.0 0.0 9844.720703 19548.945312 2574.759033 27529.929688 28547.380859 28532.861328 27626.972656 27043.929688 28385.904297 31355.429688 28103.435547 30067.242188 27543.464844 27471.593750 28714.214844 29991.451172 ... 28080.933594 27557.417969 29922.025391 30677.085938 27874.945312 24713.841797 23902.769531 24362.167969 24067.179688 25505.380859 26319.765625 25326.316406 27152.617188 27462.580078 26611.925781 30228.794922 29161.675781 31226.632812 27232.585938 26717.212891 30154.085938 29421.794922 26410.224609 27853.207031 24801.701172 24184.136719 19320.148438 4805.711426 25251.720703 21207.660156 30297.617188 25999.980469 7388.618164 23024.746094 27626.582031 24841.585938 24962.951172 25272.925781 24467.716797 24834.777344

160 rows × 292 columns



colorize` method can be used on surface maps as well. In which case, the output is a nilearn.surface.SurfaceImage for compatibility with nilearn.plotting

surf_im = julichbrain_fs5.colorize(signals.std(), surface_variant=fs_variant)
plotting.view_surf(
    surf_map=surf_im,
    hemi="both",
    symmetric_cmap=False,
    cmap="magma",
)
[SurfaceLabelsMasker.fit] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.fit] Finished fit
[SurfaceLabelsMasker.inverse_transform] Computing image from signals


config_output_folder = "./custom-configurations"


def create_config(subject, task):
    folder = f"derivatives/fmriprep/{subject}/func/"
    file_prefix = f"{subject}_task-{task}_acq-seq_space-fsaverage5"
    url_template = dataset_base_url + folder + file_prefix + "_hemi-{}.func.gii"
    conf = {
        "@type": "siibra/feature/voi/v0.1",
        "name": f"{subject} - fMRI - ds002790",
        "modality": f"fMRI - {task}",
        "space": {"name": "freesurfer fsaverage5"},
        "providers": {
            "gii-timeseries": {h: url_template.format(h[0]) for h in ["Left", "Right"]}
        },
        "time": {"start": 0, "stop": 10, "num": 160},
    }
    # discard unavailable data
    for url in conf["providers"]["gii-timeseries"].values():
        req = requests.get(url, stream=True)
        if not req.ok:
            return

    # create json config for future reuse
    filepath = f"{config_output_folder}/features/images/vois/fmri/{file_prefix}.json"
    pathlib.Path(filepath).parent.mkdir(parents=True, exist_ok=True)
    with open(filepath, "wt") as fp:
        json.dump(conf, fp=fp, indent="\t")


num_of_subjects = 10
tasks = ["restingstate", "workingmemory", "stopsignal"]
for task in tasks:
    for subject in range(num_of_subjects):
        create_config(f"sub-{subject + 1:04d}", task)
29
regional_signal_averages = {}
top_regions = pd.Index([])
for task in tasks:
    regional_signal_averages[task] = pd.concat(
        (
            julichbrain_fs5.extract_signals_with_nilearn(
                fmri_vol,
                strategy="mean",  # mean signal value per region per timepoint
                surface_variant=fs_variant,
            ).std()  # std over time per region
            for fmri_vol in fmri_vols
            if task in fmri_vol.name
        ),
        axis=1,
    )
    # compute the average of all subjects
    regional_signal_averages[task]["mean"] = regional_signal_averages[task].mean(axis=1)

    # find top 25 regions
    task_top_regions = regional_signal_averages[task].sort_values("mean", ascending=False).index[:25]
    top_regions = top_regions.union(task_top_regions)
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 240)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 160)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 228)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 223)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 221)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 220)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 231)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 225)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 217)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 224)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 223)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
[SurfaceLabelsMasker.wrapped] Loading data from <SurfaceImage (20484, 216)>
[SurfaceLabelsMasker.wrapped] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.wrapped] Finished fit
/actions-runner/_work/siibra-python/siibra-python/siibra/volumes/parcellationmap.py:1713: FutureWarning: boolean values for 'standardize' will be deprecated in nilearn 0.15.0.
Use 'zscore_sample' instead of 'True' or use 'None' instead of 'False'.
  masker.fit_transform(source, confounds=confounds, sample_mask=sample_mask)
[SurfaceLabelsMasker.wrapped] Extracting region signals
[SurfaceLabelsMasker.wrapped] Cleaning extracted signals
top_regions_sorted = (
    regional_signal_averages["stopsignal"]
    .loc[top_regions, :]
    .sort_values("mean", ascending=False)
    .index
)
fig, ax = plt.subplots(figsize=(12, 10))
colors = ["r", "g", "b"]
for i, task in enumerate(tasks):
    regional_signal_averages[task].drop(columns="mean", inplace=True)
    regional_signal_averages[task].loc[top_regions_sorted, :].T.boxplot(
        ax=ax, rot=90, label=task, color=colors[i],
        flierprops={"marker": ".", "markersize": 1},
    )
ax.legend()
ax.set_title("Comparison of top regions between tasks across subjects")
fig.tight_layout()
Comparison of top regions between tasks across subjects
fs_variant = "pial"
vmin = min([regional_signal_averages[task].min().min() for task in tasks])
vmax = max([regional_signal_averages[task].max().max() for task in tasks])
for task in tasks:
    surf_im = julichbrain_fs5.colorize(
        regional_signal_averages[task].mean(axis=1),
        surface_variant=fs_variant
    )
    plotting.plot_surf(
        surf_map=surf_im,
        hemi="both",
        cmap="magma",
        title=task,
        vmin=vmin,
        vmax=vmax,
    )
  • restingstate
  • workingmemory
  • stopsignal
[SurfaceLabelsMasker.fit] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.fit] Finished fit
[SurfaceLabelsMasker.inverse_transform] Computing image from signals
/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/venv/lib/python3.11/site-packages/numpy/lib/_function_base_impl.py:2599: RuntimeWarning: invalid value encountered in <lambda> (vectorized)
  outputs = ufunc(*args, out=...)
[SurfaceLabelsMasker.fit] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.fit] Finished fit
[SurfaceLabelsMasker.inverse_transform] Computing image from signals
/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/venv/lib/python3.11/site-packages/numpy/lib/_function_base_impl.py:2599: RuntimeWarning: invalid value encountered in <lambda> (vectorized)
  outputs = ufunc(*args, out=...)
[SurfaceLabelsMasker.fit] Loading regions from <SurfaceImage (20484,)>
[SurfaceLabelsMasker.fit] Finished fit
[SurfaceLabelsMasker.inverse_transform] Computing image from signals
/actions-runner/_work/siibra-python/siibra-python/.ci-docs-37911713724-3-notebooks/venv/lib/python3.11/site-packages/numpy/lib/_function_base_impl.py:2599: RuntimeWarning: invalid value encountered in <lambda> (vectorized)
  outputs = ufunc(*args, out=...)

Total running time of the script: (20 minutes 22.715 seconds)

Estimated memory usage: 101 MB

Gallery generated by Sphinx-Gallery