• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python img_plotting.plot_glass_brain函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nilearn.plotting.img_plotting.plot_glass_brain函数的典型用法代码示例。如果您正苦于以下问题:Python plot_glass_brain函数的具体用法?Python plot_glass_brain怎么用?Python plot_glass_brain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了plot_glass_brain函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_plot_glass_brain_colorbar_having_nans

def test_plot_glass_brain_colorbar_having_nans():
    img = _generate_img()
    data = img.get_data()

    data[6, 5, 2] = np.inf
    img = nibabel.Nifti1Image(data, np.eye(4))
    plot_glass_brain(img, colorbar=True)
    plt.close()
开发者ID:jeromedockes,项目名称:nilearn,代码行数:8,代码来源:test_img_plotting.py


示例2: test_plot_glass_brain

def test_plot_glass_brain():
    img = _generate_img()

    # test plot_glass_brain with colorbar
    plot_glass_brain(img, colorbar=True)

    # test plot_glass_brain with negative values
    plot_glass_brain(img, colorbar=True, plot_abs=False)
开发者ID:GaelVaroquaux,项目名称:nilearn,代码行数:8,代码来源:test_img_plotting.py


示例3: test_plot_glass_brain

def test_plot_glass_brain():
    mp.use('template', warn=False)
    import matplotlib.pyplot as plt
    plt.switch_backend('template')
    img = _generate_img()

    # test plot_glass_brain with colorbar
    plot_glass_brain(img, colorbar=True)
开发者ID:fabianp,项目名称:nilearn,代码行数:8,代码来源:test_img_plotting.py


示例4: test_plot_glass_brain

def test_plot_glass_brain():
    img = _generate_img()

    # test plot_glass_brain with colorbar
    plot_glass_brain(img, colorbar=True)

    # test plot_glass_brain with negative values
    plot_glass_brain(img, colorbar=True, plot_abs=False)

    # Save execution time and memory
    plt.close()
开发者ID:MartinPerez,项目名称:nilearn,代码行数:11,代码来源:test_img_plotting.py


示例5: test_plotting_functions_with_cmaps

def test_plotting_functions_with_cmaps():
    img = load_mni152_template()
    cmaps = ['Paired', 'Set1', 'Set2', 'Set3']
    for cmap in cmaps:
        plot_roi(img, cmap=cmap, colorbar=True)
        plot_stat_map(img, cmap=cmap, colorbar=True)
        plot_glass_brain(img, cmap=cmap, colorbar=True)

    if LooseVersion(matplotlib.__version__) >= LooseVersion('2.0.0'):
        plot_stat_map(img, cmap='viridis', colorbar=True)

    plt.close()
开发者ID:jeromedockes,项目名称:nilearn,代码行数:12,代码来源:test_img_plotting.py


示例6: test_plot_stat_map_with_nans

def test_plot_stat_map_with_nans():
    img = _generate_img()
    data = img.get_data()

    data[6, 5, 1] = np.nan
    data[1, 5, 2] = np.nan
    data[1, 3, 2] = np.nan
    data[6, 5, 2] = np.inf

    img = nibabel.Nifti1Image(data, mni_affine)
    plot_epi(img)
    plot_stat_map(img)
    plot_glass_brain(img)
开发者ID:jeromedockes,项目名称:nilearn,代码行数:13,代码来源:test_img_plotting.py


示例7: test_plot_noncurrent_axes

def test_plot_noncurrent_axes():
    """Regression test for Issue #450"""

    maps_img = nibabel.Nifti1Image(np.random.random((10, 10, 10)), np.eye(4))
    fh1 = plt.figure()
    fh2 = plt.figure()
    ax1 = fh1.add_subplot(1, 1, 1)

    assert_equal(plt.gcf(), fh2, "fh2  was the last plot created.")

    # Since we gave ax1, the figure should be plotted in fh1.
    # Before #451, it was plotted in fh2.
    slicer = plot_glass_brain(maps_img, axes=ax1, title='test')
    for ax_name, niax in slicer.axes.items():
        ax_fh = niax.ax.get_figure()
        assert_equal(ax_fh, fh1, 'New axis %s should be in fh1.' % ax_name)
开发者ID:amadeuskanaan,项目名称:nilearn,代码行数:16,代码来源:test_img_plotting.py


示例8: test_plot_glass_brain_threshold_for_uint8

def test_plot_glass_brain_threshold_for_uint8():
    # mask was applied in [-threshold, threshold] which is problematic
    # for uint8 data. See https://github.com/nilearn/nilearn/issues/611
    # for more details
    data = 10 * np.ones((10, 10, 10), dtype="uint8")
    # Having a zero minimum value is important to reproduce
    # https://github.com/nilearn/nilearn/issues/762
    data[0, 0] = 0
    affine = np.eye(4)
    img = nibabel.Nifti1Image(data, affine)
    threshold = np.array(5, dtype="uint8")
    display = plot_glass_brain(img, threshold=threshold, display_mode="z", colorbar=True)
    # Next two lines retrieve the numpy array from the plot
    ax = list(display.axes.values())[0].ax
    plotted_array = ax.images[0].get_array()
    # Make sure that there is one value masked
    assert_equal(plotted_array.mask.sum(), 1)
    # Make sure that the value masked is in the corner. Note that the
    # axis orientation seem to be flipped, hence (0, 0) -> (-1, 0)
    assert_true(plotted_array.mask[-1, 0])
开发者ID:KentChun33333,项目名称:nilearn,代码行数:20,代码来源:test_img_plotting.py


示例9: test_plot_glass_brain

def test_plot_glass_brain():
    img = _generate_img()

    # test plot_glass_brain with colorbar
    plot_glass_brain(img, colorbar=True)

    # test plot_glass_brain with negative values
    plot_glass_brain(img, colorbar=True, plot_abs=False)

    # Save execution time and memory
    plt.close()
    # smoke-test for hemispheric glass brain
    filename = tempfile.mktemp(suffix='.png')
    plot_glass_brain(img, output_file=filename, display_mode='lzry')
    plt.close()
开发者ID:AlexandreAbraham,项目名称:nilearn,代码行数:15,代码来源:test_img_plotting.py


示例10: test_add_markers_using_plot_glass_brain

def test_add_markers_using_plot_glass_brain():
    fig = plot_glass_brain(None)
    coords = [(-34, -39, -9)]
    fig.add_markers(coords)
    fig.close()
开发者ID:jeromedockes,项目名称:nilearn,代码行数:5,代码来源:test_img_plotting.py


示例11: add_brain_schematics

"""The goal of this script is to align the glass brain SVGs on top of the
anatomy. This is only useful for internal purposes especially when the
SVG is modified.
"""

from nilearn import plotting
from nilearn.plotting import img_plotting, glass_brain, show


# plotting anat for coarse alignment
bg_img, _, _, _ = img_plotting._load_anat()
display = img_plotting.plot_glass_brain(bg_img, threshold=0, black_bg=True,
                                        title='anat', alpha=1)
display = img_plotting.plot_glass_brain(bg_img, threshold=0,
                                        title='anat', alpha=1)


# plotting slices for finer alignment
# e.g. parieto-occipital sulcus

def add_brain_schematics(display):
    for axes in display.axes.values():
        kwargs = {'alpha': 0.5, 'linewidth': 1, 'edgecolor': 'orange'}
        object_bounds = glass_brain.plot_brain_schematics(axes.ax,
                                                          axes.direction,
                                                          **kwargs)
        axes.add_object_bounds(object_bounds)


# side
display = plotting.plot_anat(display_mode='x', cut_coords=[-2])
开发者ID:GaelVaroquaux,项目名称:nilearn,代码行数:31,代码来源:plot_align_svg.py


示例12: test_plot_glass_brain

def test_plot_glass_brain():
    img = _generate_img()

    # test plot_glass_brain with colorbar
    plot_glass_brain(img, colorbar=True)
开发者ID:amadeuskanaan,项目名称:nilearn,代码行数:5,代码来源:test_img_plotting.py


示例13: add_brain_schematics

#!/usr/bin/env python
"""The goal of this script is to align the glass brain SVGs on top of the
anatomy. This is only useful for internal purposes especially when the
SVG is modified.
"""

from nilearn import plotting
from nilearn.plotting import img_plotting, glass_brain, show

if __name__ == '__main__':
    # plotting anat for coarse alignment
    bg_img, _, _, _ = img_plotting._load_anat()
    display = img_plotting.plot_glass_brain(bg_img, threshold=0, black_bg=True,
                                            title='anat', alpha=1)
    display = img_plotting.plot_glass_brain(bg_img, threshold=0, black_bg=True,
                                            title='anat', alpha=1,
                                            display_mode='ortho')
    display = img_plotting.plot_glass_brain(bg_img, threshold=0,
                                            title='anat', alpha=1)

    # checking hemispheres plotting
    display = img_plotting.plot_glass_brain(bg_img, threshold=0, black_bg=True,
                                            title='anat', alpha=1,
                                            display_mode='lyrz')

    # plotting slices for finer alignment
    # e.g. parieto-occipital sulcus


    def add_brain_schematics(display):
        for axes in display.axes.values():
开发者ID:TheChymera,项目名称:nilearn,代码行数:31,代码来源:plot_align_svg.py



注:本文中的nilearn.plotting.img_plotting.plot_glass_brain函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python img_plotting.plot_img函数代码示例发布时间:2022-05-27
下一篇:
Python plotting.show函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap