本文整理汇总了Python中nilearn.plotting.img_plotting.plot_img函数的典型用法代码示例。如果您正苦于以下问题:Python plot_img函数的具体用法?Python plot_img怎么用?Python plot_img使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plot_img函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_plot_with_axes_or_figure
def test_plot_with_axes_or_figure():
img = _generate_img()
figure = plt.figure()
plot_img(img, figure=figure)
ax = plt.subplot(111)
plot_img(img, axes=ax)
示例2: test_plot_empty_slice
def test_plot_empty_slice():
# Test that things don't crash when we give a map with nothing above
# threshold
# This is only a smoke test
data = np.zeros((20, 20, 20))
img = nibabel.Nifti1Image(data, mni_affine)
plot_img(img, display_mode='y', threshold=1)
示例3: test_plot_img_with_auto_cut_coords
def test_plot_img_with_auto_cut_coords():
data = np.zeros((20, 20, 20))
data[3:-3, 3:-3, 3:-3] = 1
img = nibabel.Nifti1Image(data, np.eye(4))
for display_mode in "xyz":
plot_img(img, cut_coords=None, display_mode=display_mode, black_bg=True)
示例4: test_plot_with_axes_or_figure
def test_plot_with_axes_or_figure():
img = _generate_img()
figure = plt.figure()
plot_img(img, figure=figure)
ax = plt.subplot(111)
plot_img(img, axes=ax)
# Save execution time and memory
plt.close()
示例5: test_plot_img_with_auto_cut_coords
def test_plot_img_with_auto_cut_coords():
import matplotlib.pyplot as plt
plt.switch_backend('template')
data = np.zeros((20, 20, 20))
data[3:-3, 3:-3, 3:-3] = 1
img = nibabel.Nifti1Image(data, np.eye(4))
for display_mode in 'xyz':
plot_img(img, cut_coords=None, display_mode=display_mode,
black_bg=True)
示例6: test_plot_empty_slice
def test_plot_empty_slice():
# Test that things don't crash when we give a map with nothing above
# threshold
# This is only a smoke test
mp.use('template', warn=False)
import matplotlib.pyplot as plt
plt.switch_backend('template')
data = np.zeros((20, 20, 20))
img = nibabel.Nifti1Image(data, mni_affine)
plot_img(img, display_mode='y', threshold=1)
示例7: test_plot_with_axes_or_figure
def test_plot_with_axes_or_figure():
mp.use('template', warn=False)
import matplotlib.pyplot as plt
plt.switch_backend('template')
img = _generate_img()
figure = plt.figure()
plot_img(img, figure=figure)
ax = plt.subplot(111)
plot_img(img, axes=ax)
示例8: test_plot_img_with_auto_cut_coords
def test_plot_img_with_auto_cut_coords():
data = np.zeros((20, 20, 20))
data[3:-3, 3:-3, 3:-3] = 1
img = nibabel.Nifti1Image(data, np.eye(4))
for display_mode in 'xyz':
plot_img(img, cut_coords=None, display_mode=display_mode,
black_bg=True)
# Save execution time and memory
plt.close()
示例9: test_display_methods_with_display_mode_tiled
def test_display_methods_with_display_mode_tiled():
img = _generate_img()
display = plot_img(img, display_mode='tiled')
display.add_overlay(img, threshold=0)
display.add_edges(img, color='c')
display.add_contours(img, contours=2, linewidth=4,
colors=['limegreen', 'yellow'])
示例10: test_display_methods
def test_display_methods():
img = _generate_img()
display = plot_img(img)
display.add_overlay(img, threshold=0)
display.add_edges(img, color="c")
display.add_contours(img, contours=2, linewidth=4, colors=["limegreen", "yellow"])
示例11: test_plot_img_with_resampling
def test_plot_img_with_resampling():
data = _generate_img().get_data()
affine = np.array([[1.0, -1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])
img = nibabel.Nifti1Image(data, affine)
display = plot_img(img)
display.add_overlay(img)
display.add_contours(img, contours=2, linewidth=4, colors=["limegreen", "yellow"])
display.add_edges(img, color="c")
示例12: test_plot_img_with_resampling
def test_plot_img_with_resampling():
data = _generate_img().get_data()
affine = np.array([[1., -1., 0., 0.],
[1., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
img = nibabel.Nifti1Image(data, affine)
display = plot_img(img)
display.add_overlay(img)
示例13: test_plot_img_with_resampling
def test_plot_img_with_resampling():
import matplotlib.pyplot as plt
plt.switch_backend('template')
data = _generate_img().get_data()
affine = np.array([[1., -1., 0., 0.],
[1., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
img = nibabel.Nifti1Image(data, affine)
display = plot_img(img)
display.add_overlay(img)
示例14: test_display_methods
def test_display_methods():
mp.use('template', warn=False)
import matplotlib.pyplot as plt
plt.switch_backend('template')
img = _generate_img()
display = plot_img(img)
display.add_overlay(img, threshold=0)
display.add_edges(img, color='c')
display.add_contours(img, contours=2, linewidth=4,
colors=['limegreen', 'yellow'])
示例15: test_plot_img_with_resampling
def test_plot_img_with_resampling():
data = _generate_img().get_data()
affine = np.array([[1., -1., 0., 0.],
[1., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
img = nibabel.Nifti1Image(data, affine)
display = plot_img(img)
display.add_overlay(img)
display.add_contours(img, contours=2, linewidth=4,
colors=['limegreen', 'yellow'])
display.add_edges(img, color='c')
# Save execution time and memory
plt.close()