本分享為腦機學習者Rose整理發表於公眾號:腦機接口社區(微信號:Brain_Computer).QQ交流群:903290195
簡介
將CanICA應用於靜息狀態數據的示例。此示例將其應用於ADHD200數據集的30個主題。
然后,它繪制一個地圖,所有的組件一起和軸向切割的每個組件分開。
CanICA是一種用於fMRI數據組級分析的ICA方法。與其他策略相比,它帶來了一個良好控制的組模型,以及一個閾值算法控制特異性和敏感性的顯式模型的信號。
案例
1.加載ADHD200數據
from nilearn import datasets
adhd_dataset = datasets.fetch_adhd(n_subjects=30)
func_filenames = adhd_dataset.func # list of 4D nifti files for each subject
# 數據集基本信息
print('First functional nifti image (4D) is at: %s' %
func_filenames[0]) # 4D data
2.將CanICA應用在核磁共振圖像
from nilearn.decomposition import CanICA
canica = CanICA(n_components=20, smoothing_fwhm=6.,
memory="nilearn_cache", memory_level=2,
threshold=3., verbose=10, random_state=0)
canica.fit(func_filenames)
# 檢索大腦空間中的獨立成分。可通過屬性components_img_直接訪問。
components_img = canica.components_img_
#components_img是一個Nifti Image對象,可以使用以下行保存到文件中:
components_img.to_filename('canica_resting_state.nii.gz')
3.可視化
3.1將所有的組件都放在同一組圖片上
from nilearn.plotting import plot_prob_atlas
import warnings
warnings.filterwarnings("ignore")
# Plot all ICA components together
plot_prob_atlas(components_img, title='All ICA components')
3.2將所有的ICA組件單獨繪制
from nilearn.image import iter_img
from nilearn.plotting import plot_stat_map, show
import warnings
warnings.filterwarnings("ignore")
for i, cur_img in enumerate(iter_img(components_img)):
plot_stat_map(cur_img, display_mode="z", title="IC %d" % i,
cut_coords=1, colorbar=False)
show()
文獻參考:
G. Varoquaux et al. "ICA-based sparse features recovery from fMRI datasets", IEEE ISBI 2010, p. 1177
G. Varoquaux et al. "A group model for stable multi-subject ICA on fMRI datasets", NeuroImage Vol 51 (2010), p. 288-299
腦機學習者Rose筆記分享,QQ交流群:903290195
更多分享,請關注公眾號