diff --git a/tests/test_viz.py b/tests/test_viz.py index 5f945651..154cb6b0 100644 --- a/tests/test_viz.py +++ b/tests/test_viz.py @@ -11,6 +11,11 @@ from common import run_tests from tempfile import mktemp +# Prevent displaying figures +import matplotlib as mpl +backend_ = mpl.get_backend() +mpl.use("Agg") + import numpy as np import numpy.testing as nptest @@ -30,6 +35,7 @@ def tearDown(self): def test_plot_example(self): filename = mktemp(suffix='.png') for img in self.imgs: + ants.plot(img) ants.plot(img, filename=filename) class TestModule_plot_ortho(unittest.TestCase): @@ -44,6 +50,7 @@ def tearDown(self): def test_plot_example(self): filename = mktemp(suffix='.png') for img in self.imgs: + ants.plot_ortho(img) ants.plot_ortho(img, filename=filename) class TestModule_plot_ortho_stack(unittest.TestCase): @@ -56,7 +63,23 @@ def tearDown(self): def test_plot_example(self): filename = mktemp(suffix='.png') + ants.plot_ortho_stack([self.img, self.img]) ants.plot_ortho_stack([self.img, self.img], filename=filename) +class TestModule_plot_hist(unittest.TestCase): + + def setUp(self): + img2d = ants.image_read(ants.get_ants_data('r16')) + img3d = ants.image_read(ants.get_ants_data('mni')) + self.imgs = [img2d, img3d] + + def tearDown(self): + pass + + def test_plot_example(self): + filename = mktemp(suffix='.png') + for img in self.imgs: + ants.plot_hist(img) + if __name__ == '__main__': - run_tests() \ No newline at end of file + run_tests()