Skip to content

Commit

Permalink
test more plots
Browse files Browse the repository at this point in the history
  • Loading branch information
ncullen93 committed Mar 12, 2024
1 parent d038bf9 commit 5ba5116
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/test_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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()
run_tests()

0 comments on commit 5ba5116

Please sign in to comment.