From 0a0af9f0d38551264bcacc14b1b686762065da17 Mon Sep 17 00:00:00 2001 From: ncullen93 Date: Tue, 20 Feb 2024 20:49:46 +0100 Subject: [PATCH] try testing viz again --- tests/run_tests.sh | 2 +- tests/test_viz.py | 59 +++------------------------------------------- 2 files changed, 4 insertions(+), 57 deletions(-) diff --git a/tests/run_tests.sh b/tests/run_tests.sh index fa6c947c..abed4dc2 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -40,7 +40,7 @@ echo "Running utils tests" $PYCMD test_utils.py $@ # echo "Running viz tests" -# $PYCMD test_viz.py $@ +$PYCMD test_viz.py $@ echo "Running bug tests" $PYCMD test_bugs.py $@ diff --git a/tests/test_viz.py b/tests/test_viz.py index 6a2fe1a9..6e6c909c 100644 --- a/tests/test_viz.py +++ b/tests/test_viz.py @@ -16,59 +16,6 @@ import ants -class TestModule_surface(unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def test_surf_example(self): - ch2i = ants.image_read( ants.get_ants_data("ch2") ) - ch2seg = ants.threshold_image( ch2i, "Otsu", 3 ) - wm = ants.threshold_image( ch2seg, 3, 3 ) - wm2 = wm.smooth_image( 1 ).threshold_image( 0.5, 1e15 ) - kimg = ants.weingarten_image_curvature( ch2i, 1.5 ).smooth_image( 1 ) - wmz = wm2.iMath("MD",3) - rp = [(90,180,90), (90,180,270), (90,180,180)] - filename = mktemp(suffix='.png') - ants.surf( x=wm2, y=[kimg], z=[wmz], - inflation_factor=255, overlay_limits=(-0.3,0.3), verbose = True, - rotation_params = rp, filename=filename) - -class TestModule_volume(unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def test_vol_example(self): - ch2i = ants.image_read( ants.get_ants_data("mni") ) - ch2seg = ants.threshold_image( ch2i, "Otsu", 3 ) - wm = ants.threshold_image( ch2seg, 3, 3 ) - kimg = ants.weingarten_image_curvature( ch2i, 1.5 ).smooth_image( 1 ) - rp = [(90,180,90), (90,180,270), (90,180,180)] - filename = mktemp(suffix='.png') - result = ants.vol( wm, [kimg], quantlimits=(0.01,0.99), filename=filename) - - -class TestModule_render_surface_function(unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def test_render_surface_function_example(self): - mni = ants.image_read(ants.get_ants_data('mni')) - mnia = ants.image_read(ants.get_ants_data('mnia')) - filename = mktemp(suffix='.html') - ants.render_surface_function(mni, mnia, alphasurf=0.1, auto_open=False, filename=filename) - class TestModule_plot(unittest.TestCase): @@ -81,8 +28,9 @@ def tearDown(self): pass def test_plot_example(self): + filename = mktemp(suffix='.png') for img in self.imgs: - ants.plot(img) + ants.plot(img, filename=filename) class TestModule_create_tiled_mosaic(unittest.TestCase): @@ -97,7 +45,6 @@ def tearDown(self): def test_example(self): img = ants.image_read(ants.get_ants_data('ch2')).resample_image((3,3,3)) - p = ants.create_tiled_mosaic(img) # test with output outfile = mktemp(suffix='.png') @@ -105,7 +52,7 @@ def test_example(self): # rgb is not none rgb = img.clone() - p = ants.create_tiled_mosaic(img, rgb=rgb) + p = ants.create_tiled_mosaic(img, rgb=rgb, output=outfile) if __name__ == '__main__': run_tests() \ No newline at end of file