Created
May 26, 2016 06:21
-
-
Save com3345/87d66c957308af99271cb0758494746f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nilearn import datasets | |
from nilearn.input_data import NiftiLabelsMasker as NLM | |
# your rawdata filename | |
filename = './tfMRI_EMOTION_RL.nii.gz' | |
# download the atlas, which has two attributes: dataset.maps, dataset.labels | |
dataset = datasets.fetch_atlas_destrieux_2009() | |
# create a label masker object | |
masker = NLM(labels_img=dataset.maps, verbose=1) | |
# extract rois signals by its fit_transform method | |
# shape of the rois_signals is (timepoints, rois) so we use .T to obtain (rois, timepoints) | |
rois_signals = masker.fit_transform(filename).T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment