def test_ui_image_container_2d(interactive=False): fetch_viz_icons() image_test = ui.ImageContainer2D(img_path=read_viz_icons( fname='home3.png')) image_test.center = (300, 300) npt.assert_equal(image_test.size, (100, 100)) image_test.scale((2, 2)) npt.assert_equal(image_test.size, (200, 200)) current_size = (600, 600) show_manager = window.ShowManager(size=current_size, title="DIPY Button") show_manager.ren.add(image_test) if interactive: show_manager.start()
size=(250, 160), multiselection=True) def _print_nb_selected_elements(): msg = "{}/{} elements are now selected." print(msg.format(len(listbox.selected), len(listbox.values))) listbox.on_change = _print_nb_selected_elements """ Image Container ====== """ img = ui.ImageContainer2D(img_path=read_viz_icons(fname='home3.png')) """ Adding Elements to the ShowManager ================================== Once all elements have been initialised, they have to be added to the show manager in the following manner. """ current_size = (600, 600) show_manager = window.ShowManager(size=current_size, title="DIPY UI Example") show_manager.ren.add(cube_actor_1) show_manager.ren.add(cube_actor_2) show_manager.ren.add(panel) show_manager.ren.add(text)
center=(500, 300), color=(0, 1, 1)) """ Image ===== Now let's display an image. First we need to fetch some icons that are included in DIPY. """ fetch_viz_icons() """ Now we can create an image container. """ img = ui.ImageContainer2D(img_path=read_viz_icons(fname='home3.png'), position=(450, 350)) """ Panel with buttons and text =========================== Let's create some buttons and text and put them in a panel. First we'll make the panel. """ panel = ui.Panel2D(size=(300, 150), color=(1, 1, 1), align="right") panel.center = (500, 400) """ Then we'll make two text labels and place them on the panel. Note that we specifiy the position with integer numbers of pixels. """