Nilearn教程系列(4)-腦部地圖集繪制


本分享為腦機學習者Rose整理發表於公眾號:腦機接口社區(微信號:Brain_Computer).QQ交流群:903290195

腦部地圖集繪制

數據集來源:Harvard-Oxford 腦部地圖集

第一步:下載數據集

數據集文件格式為:

HarvardOxford-cort-maxprob-thr25-2mm.nii.gz

from nilearn import datasets
import warnings
warnings.filterwarnings("ignore")
"""
構建數據集
如果本地有該數據,則直接使用,
否則,從網絡中下載數據
"""
dataset = datasets.fetch_atlas_harvard_oxford('cort-maxprob-thr25-2mm')
atlas_filename = dataset.maps

print('Atlas ROIs are located at: %s' % atlas_filename)

第二步:可視化Harvard-Oxford 腦部地圖集

from nilearn import plotting

plotting.plot_roi(atlas_filename, title="Harvard Oxford atlas")
plotting.show()

玻璃腦圖(Glass brain)繪制

"""
構建數據

如果本地有該數據,則直接使用,
否則,從網絡中下載數據
"""
from nilearn import datasets
import warnings
warnings.filterwarnings("ignore")
motor_images = datasets.fetch_neurovault_motor_task()
stat_img = motor_images.images[0]

玻璃腦圖(Glass brain)繪制:全腦失狀切面

from nilearn import plotting
"""
全腦失狀切面
"""
plotting.plot_glass_brain(stat_img, threshold=3)

玻璃腦圖(Glass brain)繪制:黑色背景


"""
黑色背景設置:black_gb=True
顯示模式:僅顯示x和z視圖 display_mode='xz'
"""
plotting.plot_glass_brain(
    stat_img, title='plot_glass_brain',
    black_bg=True, display_mode='xz', threshold=3)

玻璃腦圖(Glass brain)繪制:半球矢狀切面


plotting.plot_glass_brain(stat_img,
                          title='plot_glass_brain with display_mode="lyrz"',
                          display_mode='lyrz', threshold=3)

plotting.show()

腦機學習者Rose筆記分享,QQ交流群:903290195
更多分享,請關注公眾號


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM