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)
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)
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)
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)
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)
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)
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)
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)
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)
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()
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()
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)
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)
def test_plot_with_axes_or_figure(testdata_3d): img = testdata_3d['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()
def test_plot_img_with_auto_cut_coords(testdata_3d): 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()
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()
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)
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"])
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'])
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")
def test_display_methods(testdata_3d): img = testdata_3d['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'])
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)
def test_plot_img_with_resampling(): import pylab as pl pl.switch_backend('template') data = MNI152TEMPLATE.get_data()[:5, :5, :5] 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)
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)
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)
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'])
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')
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'])
def test_plot_img_empty(): # 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 pylab as pl pl.switch_backend('template') data = np.zeros((20, 20, 20)) img = nibabel.Nifti1Image(data, mni_affine) plot_anat(img) slicer = plot_img(img, display_mode='y', threshold=1) slicer.close() pl.close('all')
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()
def test_plot_img_with_resampling(testdata_3d): data = get_data(testdata_3d['img']) 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()
def test_plotting_functions_with_display_mode_tiled(testdata_3d): img = testdata_3d['img'] plot_stat_map(img, display_mode='tiled') plot_anat(display_mode='tiled') plot_img(img, display_mode='tiled') plt.close()
def test_plotting_functions_with_display_mode_tiled(): img = _generate_img() plot_stat_map(img, display_mode='tiled') plot_anat(display_mode='tiled') plot_img(img, display_mode='tiled') plt.close()