Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try testing viz again #550

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand Down
59 changes: 3 additions & 56 deletions tests/test_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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):
Expand All @@ -97,15 +45,14 @@ 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')
p = ants.create_tiled_mosaic(img, output=outfile)

# 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()
Loading