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

A lightweight UI for medical visualizations #5: 2D Circular Slider #1222

Merged
merged 8 commits into from Apr 25, 2017
Binary file added dipy/data/files/test_ui_disk_slider_2d.log.gz
Binary file not shown.
Binary file added dipy/data/files/test_ui_disk_slider_2d.pkl
Binary file not shown.
34 changes: 34 additions & 0 deletions dipy/viz/tests/test_ui.py
Expand Up @@ -282,6 +282,37 @@ def test_ui_line_slider_2d(recording=False):
event_counter.check_counts(expected)


@npt.dec.skipif(not have_vtk or skip_it)
@xvfb_it
def test_ui_disk_slider_2d(recording=False):
filename = "test_ui_disk_slider_2d"
recording_filename = pjoin(DATA_DIR, filename + ".log.gz")
expected_events_counts_filename = pjoin(DATA_DIR, filename + ".pkl")

disk_slider_2d_test = ui.DiskSlider2D()
disk_slider_2d_test.set_center((300, 300))

# Assign the counter callback to every possible event.
event_counter = EventCounter()
event_counter.monitor(disk_slider_2d_test)

current_size = (600, 600)
show_manager = window.ShowManager(size=current_size,
title="DIPY Disk Slider")

show_manager.ren.add(disk_slider_2d_test)

if recording:
show_manager.record_events_to_file(recording_filename)
print(list(event_counter.events_counts.items()))
event_counter.save(expected_events_counts_filename)

else:
show_manager.play_events_from_file(recording_filename)
expected = EventCounter.load(expected_events_counts_filename)
event_counter.check_counts(expected)


if __name__ == "__main__":
if len(sys.argv) <= 1 or sys.argv[1] == "test_ui_button_panel":
test_ui_button_panel(recording=True)
Expand All @@ -291,3 +322,6 @@ def test_ui_line_slider_2d(recording=False):

if len(sys.argv) <= 1 or sys.argv[1] == "test_ui_line_slider_2d":
test_ui_line_slider_2d(recording=True)

if len(sys.argv) <= 1 or sys.argv[1] == "test_ui_disk_slider_2d":
test_ui_disk_slider_2d(recording=True)