diff --git a/dev/.buildinfo b/dev/.buildinfo index 908f97a1d..0cd6423fd 100644 --- a/dev/.buildinfo +++ b/dev/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: cfd65b1d280e55551f713981b5dd439e +config: 50cea39258fbb1a48cef95136fa5b861 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_earth_animation.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_earth_animation.doctree index 9a304422c..645afa824 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_earth_animation.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_earth_animation.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_earth_coordinates.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_earth_coordinates.doctree index 113c3be20..574f09b9f 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_earth_coordinates.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_earth_coordinates.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_gltf.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_gltf.doctree index 2a1333346..04ba2d96b 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_gltf.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_gltf.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_gltf_animated.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_gltf_animated.doctree index d94ac569c..496069c45 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_gltf_animated.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_gltf_animated.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_gltf_export.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_gltf_export.doctree index 2abc1d421..6812b158b 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_gltf_export.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_gltf_export.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_morphing.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_morphing.doctree index 132f84449..eca0be640 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_morphing.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_morphing.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_multithread.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_multithread.doctree index a1ca11522..22988212b 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_multithread.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_multithread.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_picking.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_picking.doctree index 74442e173..1a894b8ad 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_picking.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_picking.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_selection.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_selection.doctree index ab5eddf79..3115e1331 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_selection.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_selection.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_skinning.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_skinning.doctree index 42028daaa..917a61e2d 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_skinning.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_skinning.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_slice.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_slice.doctree index fc7b9f842..d405cfc3e 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_slice.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_slice.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_solar_system.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_solar_system.doctree index 1ee044dd6..2b62177d5 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_solar_system.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_solar_system.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_sphere.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_sphere.doctree index f34c1f68f..15efdfd6d 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_sphere.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_sphere.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_spiky.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_spiky.doctree index 8516be9dc..4b5cd3bfe 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_spiky.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_spiky.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_surfaces.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_surfaces.doctree index e5db74ac8..bba7bbe29 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_surfaces.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_surfaces.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_texture.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_texture.doctree index 0f25aefa7..08f8d6c99 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_texture.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_texture.doctree differ diff --git a/dev/.doctrees/auto_examples/01_introductory/viz_timers.doctree b/dev/.doctrees/auto_examples/01_introductory/viz_timers.doctree index e60d90a05..1224c30e3 100644 Binary files a/dev/.doctrees/auto_examples/01_introductory/viz_timers.doctree and b/dev/.doctrees/auto_examples/01_introductory/viz_timers.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_dt_ellipsoids.doctree b/dev/.doctrees/auto_examples/04_demos/viz_dt_ellipsoids.doctree index d9e79d264..d76998bca 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_dt_ellipsoids.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_dt_ellipsoids.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_emwave_animation.doctree b/dev/.doctrees/auto_examples/04_demos/viz_emwave_animation.doctree index 025994e01..1cf8ce74e 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_emwave_animation.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_emwave_animation.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_fiber_odf.doctree b/dev/.doctrees/auto_examples/04_demos/viz_fiber_odf.doctree index 51806dda4..3ea3bbb74 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_fiber_odf.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_fiber_odf.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_fine_tuning_gl_context.doctree b/dev/.doctrees/auto_examples/04_demos/viz_fine_tuning_gl_context.doctree index c552269bb..451f2a1d5 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_fine_tuning_gl_context.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_fine_tuning_gl_context.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_fractals.doctree b/dev/.doctrees/auto_examples/04_demos/viz_fractals.doctree index 6a7af4699..5b75b146a 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_fractals.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_fractals.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_helical_motion.doctree b/dev/.doctrees/auto_examples/04_demos/viz_helical_motion.doctree index f09b4e930..eacbef0b6 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_helical_motion.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_helical_motion.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_markers.doctree b/dev/.doctrees/auto_examples/04_demos/viz_markers.doctree index 4fe955a9f..8d68eb043 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_markers.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_markers.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_network.doctree b/dev/.doctrees/auto_examples/04_demos/viz_network.doctree index ab1c83630..7908fef31 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_network.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_network.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_network_animated.doctree b/dev/.doctrees/auto_examples/04_demos/viz_network_animated.doctree index 1c79ecc62..b39be27f4 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_network_animated.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_network_animated.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_pbr_interactive.doctree b/dev/.doctrees/auto_examples/04_demos/viz_pbr_interactive.doctree index 9ab14c15c..074b4efc1 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_pbr_interactive.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_pbr_interactive.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_play_video.doctree b/dev/.doctrees/auto_examples/04_demos/viz_play_video.doctree index b2c631258..1b8ff9611 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_play_video.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_play_video.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_roi_contour.doctree b/dev/.doctrees/auto_examples/04_demos/viz_roi_contour.doctree index 7a55427f4..d414f0640 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_roi_contour.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_roi_contour.doctree differ diff --git a/dev/.doctrees/auto_examples/04_demos/viz_tesseract.doctree b/dev/.doctrees/auto_examples/04_demos/viz_tesseract.doctree index e5e5bd4f4..abf45b48b 100644 Binary files a/dev/.doctrees/auto_examples/04_demos/viz_tesseract.doctree and b/dev/.doctrees/auto_examples/04_demos/viz_tesseract.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/index.doctree b/dev/.doctrees/auto_examples/07_ui/index.doctree index 10efa28df..10086df68 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/index.doctree and b/dev/.doctrees/auto_examples/07_ui/index.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_drawpanel.doctree b/dev/.doctrees/auto_examples/07_ui/viz_drawpanel.doctree index 31cb2e0a5..f14d1a1f2 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_drawpanel.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_drawpanel.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_layout.doctree b/dev/.doctrees/auto_examples/07_ui/viz_layout.doctree index 6b9bc76b1..52a3f1500 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_layout.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_layout.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_radio_buttons.doctree b/dev/.doctrees/auto_examples/07_ui/viz_radio_buttons.doctree index ccf73e1eb..f9da5b1ff 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_radio_buttons.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_radio_buttons.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_shapes.doctree b/dev/.doctrees/auto_examples/07_ui/viz_shapes.doctree index 8c1a5aa9f..005662a05 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_shapes.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_shapes.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_spinbox.doctree b/dev/.doctrees/auto_examples/07_ui/viz_spinbox.doctree index 88a708272..d08b918ad 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_spinbox.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_spinbox.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_tab.doctree b/dev/.doctrees/auto_examples/07_ui/viz_tab.doctree index 30c4bc4f9..eb760c918 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_tab.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_tab.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_ui.doctree b/dev/.doctrees/auto_examples/07_ui/viz_ui.doctree index 9d7d8cc48..fe09955c9 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_ui.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_ui.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_ui_listbox.doctree b/dev/.doctrees/auto_examples/07_ui/viz_ui_listbox.doctree index f433d624e..fb9d7af29 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_ui_listbox.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_ui_listbox.doctree differ diff --git a/dev/.doctrees/auto_examples/07_ui/viz_ui_slider.doctree b/dev/.doctrees/auto_examples/07_ui/viz_ui_slider.doctree index f49a27c1f..b9141f9cf 100644 Binary files a/dev/.doctrees/auto_examples/07_ui/viz_ui_slider.doctree and b/dev/.doctrees/auto_examples/07_ui/viz_ui_slider.doctree differ diff --git a/dev/.doctrees/auto_examples/10_animation/viz_hierarchical_animation.doctree b/dev/.doctrees/auto_examples/10_animation/viz_hierarchical_animation.doctree index ed327ecec..69394772c 100644 Binary files a/dev/.doctrees/auto_examples/10_animation/viz_hierarchical_animation.doctree and b/dev/.doctrees/auto_examples/10_animation/viz_hierarchical_animation.doctree differ diff --git a/dev/.doctrees/auto_examples/10_animation/viz_introduction.doctree b/dev/.doctrees/auto_examples/10_animation/viz_introduction.doctree index 507682ae0..3b8f51d8a 100644 Binary files a/dev/.doctrees/auto_examples/10_animation/viz_introduction.doctree and b/dev/.doctrees/auto_examples/10_animation/viz_introduction.doctree differ diff --git a/dev/.doctrees/auto_examples/10_animation/viz_robot_arm_animation.doctree b/dev/.doctrees/auto_examples/10_animation/viz_robot_arm_animation.doctree index 0dcf3f687..e107ad8f0 100644 Binary files a/dev/.doctrees/auto_examples/10_animation/viz_robot_arm_animation.doctree and b/dev/.doctrees/auto_examples/10_animation/viz_robot_arm_animation.doctree differ diff --git a/dev/.doctrees/auto_examples/10_animation/viz_spline_interpolator.doctree b/dev/.doctrees/auto_examples/10_animation/viz_spline_interpolator.doctree index 5a9ca0060..7bf5c8dde 100644 Binary files a/dev/.doctrees/auto_examples/10_animation/viz_spline_interpolator.doctree and b/dev/.doctrees/auto_examples/10_animation/viz_spline_interpolator.doctree differ diff --git a/dev/.doctrees/auto_examples/10_animation/viz_timeline.doctree b/dev/.doctrees/auto_examples/10_animation/viz_timeline.doctree index f6bcc6821..c8622c9ba 100644 Binary files a/dev/.doctrees/auto_examples/10_animation/viz_timeline.doctree and b/dev/.doctrees/auto_examples/10_animation/viz_timeline.doctree differ diff --git a/dev/.doctrees/auto_examples/10_animation/viz_using_time_equations.doctree b/dev/.doctrees/auto_examples/10_animation/viz_using_time_equations.doctree index 6c5d61927..addb83e54 100644 Binary files a/dev/.doctrees/auto_examples/10_animation/viz_using_time_equations.doctree and b/dev/.doctrees/auto_examples/10_animation/viz_using_time_equations.doctree differ diff --git a/dev/.doctrees/auto_examples/13_shaders/index.doctree b/dev/.doctrees/auto_examples/13_shaders/index.doctree index 0dd6c728b..41abc1299 100644 Binary files a/dev/.doctrees/auto_examples/13_shaders/index.doctree and b/dev/.doctrees/auto_examples/13_shaders/index.doctree differ diff --git a/dev/.doctrees/auto_examples/13_shaders/viz_pbr_spheres.doctree b/dev/.doctrees/auto_examples/13_shaders/viz_pbr_spheres.doctree index c7e3a279b..01f8336e4 100644 Binary files a/dev/.doctrees/auto_examples/13_shaders/viz_pbr_spheres.doctree and b/dev/.doctrees/auto_examples/13_shaders/viz_pbr_spheres.doctree differ diff --git a/dev/.doctrees/auto_examples/13_shaders/viz_principled_spheres.doctree b/dev/.doctrees/auto_examples/13_shaders/viz_principled_spheres.doctree index f7256fd99..d512fcaa6 100644 Binary files a/dev/.doctrees/auto_examples/13_shaders/viz_principled_spheres.doctree and b/dev/.doctrees/auto_examples/13_shaders/viz_principled_spheres.doctree differ diff --git a/dev/.doctrees/auto_examples/13_shaders/viz_sdf_cylinder.doctree b/dev/.doctrees/auto_examples/13_shaders/viz_sdf_cylinder.doctree index 8ffbd1031..8ca8e9f6d 100644 Binary files a/dev/.doctrees/auto_examples/13_shaders/viz_sdf_cylinder.doctree and b/dev/.doctrees/auto_examples/13_shaders/viz_sdf_cylinder.doctree differ diff --git a/dev/.doctrees/auto_examples/13_shaders/viz_sdfactor.doctree b/dev/.doctrees/auto_examples/13_shaders/viz_sdfactor.doctree index 213a51668..c6a063908 100644 Binary files a/dev/.doctrees/auto_examples/13_shaders/viz_sdfactor.doctree and b/dev/.doctrees/auto_examples/13_shaders/viz_sdfactor.doctree differ diff --git a/dev/.doctrees/auto_examples/13_shaders/viz_shader.doctree b/dev/.doctrees/auto_examples/13_shaders/viz_shader.doctree index f4d0c9f8a..f1a1894fa 100644 Binary files a/dev/.doctrees/auto_examples/13_shaders/viz_shader.doctree and b/dev/.doctrees/auto_examples/13_shaders/viz_shader.doctree differ diff --git a/dev/.doctrees/auto_examples/17_pybullet/viz_domino.doctree b/dev/.doctrees/auto_examples/17_pybullet/viz_domino.doctree index bc413fda8..51d6db7ab 100644 Binary files a/dev/.doctrees/auto_examples/17_pybullet/viz_domino.doctree and b/dev/.doctrees/auto_examples/17_pybullet/viz_domino.doctree differ diff --git a/dev/.doctrees/auto_examples/17_pybullet/viz_wrecking_ball.doctree b/dev/.doctrees/auto_examples/17_pybullet/viz_wrecking_ball.doctree index 8092e3a81..b7947abd6 100644 Binary files a/dev/.doctrees/auto_examples/17_pybullet/viz_wrecking_ball.doctree and b/dev/.doctrees/auto_examples/17_pybullet/viz_wrecking_ball.doctree differ diff --git a/dev/.doctrees/auto_examples/20_stream/viz_interaction.doctree b/dev/.doctrees/auto_examples/20_stream/viz_interaction.doctree index e2d0bebb1..943813c1b 100644 Binary files a/dev/.doctrees/auto_examples/20_stream/viz_interaction.doctree and b/dev/.doctrees/auto_examples/20_stream/viz_interaction.doctree differ diff --git a/dev/.doctrees/auto_examples/20_stream/viz_no_interaction.doctree b/dev/.doctrees/auto_examples/20_stream/viz_no_interaction.doctree index 89e4b09e6..b1f5aa592 100644 Binary files a/dev/.doctrees/auto_examples/20_stream/viz_no_interaction.doctree and b/dev/.doctrees/auto_examples/20_stream/viz_no_interaction.doctree differ diff --git a/dev/.doctrees/auto_examples/20_stream/viz_widget.doctree b/dev/.doctrees/auto_examples/20_stream/viz_widget.doctree index ad19a2c12..1f2415450 100644 Binary files a/dev/.doctrees/auto_examples/20_stream/viz_widget.doctree and b/dev/.doctrees/auto_examples/20_stream/viz_widget.doctree differ diff --git a/dev/.doctrees/auto_examples/index.doctree b/dev/.doctrees/auto_examples/index.doctree index 6f31fe8d1..1807a1bf7 100644 Binary files a/dev/.doctrees/auto_examples/index.doctree and b/dev/.doctrees/auto_examples/index.doctree differ diff --git a/dev/.doctrees/environment.pickle b/dev/.doctrees/environment.pickle index 70662dd18..2222e5536 100644 Binary files a/dev/.doctrees/environment.pickle and b/dev/.doctrees/environment.pickle differ diff --git a/dev/.doctrees/reference/fury.deprecator.doctree b/dev/.doctrees/reference/fury.deprecator.doctree index 93f32fca2..2d814a2ab 100644 Binary files a/dev/.doctrees/reference/fury.deprecator.doctree and b/dev/.doctrees/reference/fury.deprecator.doctree differ diff --git a/dev/_downloads/01a61c52b120cae9cf460d7b394bfdeb/viz_spline_interpolator.zip b/dev/_downloads/01a61c52b120cae9cf460d7b394bfdeb/viz_spline_interpolator.zip index cfadb2f12..a38aa99d0 100644 Binary files a/dev/_downloads/01a61c52b120cae9cf460d7b394bfdeb/viz_spline_interpolator.zip and b/dev/_downloads/01a61c52b120cae9cf460d7b394bfdeb/viz_spline_interpolator.zip differ diff --git a/dev/_downloads/02506d9d0821045a7f391bb7d1e4dd02/viz_spline_interpolator.ipynb b/dev/_downloads/02506d9d0821045a7f391bb7d1e4dd02/viz_spline_interpolator.ipynb index fa165b833..372ac46df 100644 --- a/dev/_downloads/02506d9d0821045a7f391bb7d1e4dd02/viz_spline_interpolator.ipynb +++ b/dev/_downloads/02506d9d0821045a7f391bb7d1e4dd02/viz_spline_interpolator.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\nfrom fury.animation import Animation, Timeline\nfrom fury.animation.interpolator import spline_interpolator\n\nscene = window.Scene()\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" + "import numpy as np\n\nimport fury\n\nscene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "pos_dots = actor.dot(np.array(list(position_keyframes.values())))" + "pos_dots = fury.actor.dot(np.array(list(position_keyframes.values())))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "sphere_linear = actor.sphere(np.array([[0, 0, 0]]), (1, 0.5, 0.2), 0.5)\n\nlinear_anim = Animation()\nlinear_anim.add_actor(sphere_linear)\n\nlinear_anim.set_position_keyframes(position_keyframes)" + "sphere_linear = fury.actor.sphere(np.array([[0, 0, 0]]), (1, 0.5, 0.2), 0.5)\n\nlinear_anim = fury.animation.Animation()\nlinear_anim.add_actor(sphere_linear)\n\nlinear_anim.set_position_keyframes(position_keyframes)" ] }, { @@ -94,7 +94,7 @@ }, "outputs": [], "source": [ - "sphere_spline = actor.sphere(np.array([[0, 0, 0]]), (0.3, 0.9, 0.6), 1)\nspline_anim = Animation(sphere_spline)\nspline_anim.set_position_keyframes(position_keyframes)" + "sphere_spline = fury.actor.sphere(np.array([[0, 0, 0]]), (0.3, 0.9, 0.6), 1)\nspline_anim = fury.animation.Animation(sphere_spline)\nspline_anim.set_position_keyframes(position_keyframes)" ] }, { @@ -112,7 +112,7 @@ }, "outputs": [], "source": [ - "spline_anim.set_position_interpolator(spline_interpolator, degree=5)" + "spline_anim.set_position_interpolator(fury.animation.spline_interpolator, degree=5)" ] }, { @@ -137,7 +137,7 @@ }, "outputs": [], "source": [ - "timeline = Timeline(playback_panel=True)" + "timeline = fury.animation.Timeline(playback_panel=True)" ] }, { @@ -209,7 +209,7 @@ }, "outputs": [], "source": [ - "interactive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_keyframe_animation_spline.png\", size=(900, 768))" + "interactive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_keyframe_animation_spline.png\", size=(900, 768))" ] } ], diff --git a/dev/_downloads/047960bb41f51d256e795f60be8e1969/viz_timers.py b/dev/_downloads/047960bb41f51d256e795f60be8e1969/viz_timers.py index 4618cee44..e0217a7a5 100644 --- a/dev/_downloads/047960bb41f51d256e795f60be8e1969/viz_timers.py +++ b/dev/_downloads/047960bb41f51d256e795f60be8e1969/viz_timers.py @@ -17,24 +17,24 @@ import numpy as np -from fury import actor, ui, window +import fury xyz = 10 * np.random.rand(100, 3) colors = np.random.rand(100, 4) radii = np.random.rand(100) + 0.5 -scene = window.Scene() +scene = fury.window.Scene() -sphere_actor = actor.sphere(centers=xyz, colors=colors, radii=radii) +sphere_actor = fury.actor.sphere(centers=xyz, colors=colors, radii=radii) scene.add(sphere_actor) -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) -tb = ui.TextBlock2D(bold=True) +tb = fury.ui.TextBlock2D(bold=True) # use itertools to avoid global variables counter = itertools.count() @@ -66,4 +66,4 @@ def timer_callback(_obj, _event): showm.start() -window.record(showm.scene, size=(900, 768), out_path="viz_timer.png") +fury.window.record(showm.scene, size=(900, 768), out_path="viz_timer.png") diff --git a/dev/_downloads/0495e6a00e4c37b628df83c952f39155/viz_picking.ipynb b/dev/_downloads/0495e6a00e4c37b628df83c952f39155/viz_picking.ipynb index 2b59b8ecc..8bda22ec4 100644 --- a/dev/_downloads/0495e6a00e4c37b628df83c952f39155/viz_picking.ipynb +++ b/dev/_downloads/0495e6a00e4c37b628df83c952f39155/viz_picking.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, pick, ui, utils, window\n\ncenters = 0.5 * np.array([[0, 0, 0], [100, 0, 0], [200, 0, 0.0]])\ncolors = np.array([[0.8, 0, 0], [0, 0.8, 0], [0, 0, 0.8]])\nradii = 0.1 * np.array([50, 100, 150.0])\n\nselected = np.zeros(3, dtype=bool)" + "import numpy as np\n\nimport fury\n\ncenters = 0.5 * np.array([[0, 0, 0], [100, 0, 0], [200, 0, 0.0]])\ncolors = np.array([[0.8, 0, 0], [0, 0.8, 0], [0, 0, 0.8]])\nradii = 0.1 * np.array([50, 100, 150.0])\n\nselected = np.zeros(3, dtype=bool)" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "panel = ui.Panel2D(size=(400, 200), color=(1, 0.5, 0.0), align=\"right\")\npanel.center = (150, 200)\n\ntext_block = ui.TextBlock2D(text=\"Left click on object \\n\")\npanel.add_element(text_block, (0.3, 0.3))" + "panel = fury.ui.Panel2D(size=(400, 200), color=(1, 0.5, 0.0), align=\"right\")\npanel.center = (150, 200)\n\ntext_block = fury.ui.TextBlock2D(text=\"Left click on object \\n\")\npanel.add_element(text_block, (0.3, 0.3))" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nlabel_actor = actor.vector_text(text=\"Test\")" + "scene = fury.window.Scene()\n\nlabel_actor = fury.actor.vector_text(text=\"Test\")" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "directions = np.array(\n [\n [np.sqrt(2) / 2, 0, np.sqrt(2) / 2],\n [np.sqrt(2) / 2, np.sqrt(2) / 2, 0],\n [0, np.sqrt(2) / 2, np.sqrt(2) / 2],\n ]\n)\nfury_actor = actor.cube(centers, directions, colors, scales=radii)" + "directions = np.array(\n [\n [np.sqrt(2) / 2, 0, np.sqrt(2) / 2],\n [np.sqrt(2) / 2, np.sqrt(2) / 2, 0],\n [0, np.sqrt(2) / 2, np.sqrt(2) / 2],\n ]\n)\nfury_actor = fury.actor.cube(centers, directions, colors, scales=radii)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "vertices = utils.vertices_from_actor(fury_actor)\nnum_vertices = vertices.shape[0]\nnum_objects = centers.shape[0]" + "vertices = fury.utils.vertices_from_actor(fury_actor)\nnum_vertices = vertices.shape[0]\nnum_objects = centers.shape[0]" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "vcolors = utils.colors_from_actor(fury_actor, \"colors\")" + "vcolors = fury.utils.colors_from_actor(fury_actor, \"colors\")" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "ax = actor.axes(scale=(10, 10, 10))\n\nscene.add(fury_actor)\nscene.add(label_actor)\nscene.add(ax)\nscene.reset_camera()" + "ax = fury.actor.axes(scale=(10, 10, 10))\n\nscene.add(fury_actor)\nscene.add(label_actor)\nscene.add(ax)\nscene.reset_camera()" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "pickm = pick.PickingManager()" + "pickm = fury.pick.PickingManager()" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "def left_click_callback(obj, event):\n # Get the event position on display and pick\n\n event_pos = pickm.event_position(showm.iren)\n picked_info = pickm.pick(event_pos, showm.scene)\n\n vertex_index = picked_info[\"vertex\"]\n\n # Calculate the objects index\n\n object_index = int(np.floor((vertex_index / num_vertices) * num_objects))\n\n # Find how many vertices correspond to each object\n sec = int(num_vertices / num_objects)\n\n if not selected[object_index]:\n scale = 6 / 5\n color_add = np.array([30, 30, 30], dtype=\"uint8\")\n selected[object_index] = True\n else:\n scale = 5 / 6\n color_add = np.array([-30, -30, -30], dtype=\"uint8\")\n selected[object_index] = False\n\n # Update vertices positions\n vertices[object_index * sec : object_index * sec + sec] = (\n scale\n * (\n vertices[object_index * sec : object_index * sec + sec]\n - centers[object_index]\n )\n + centers[object_index]\n )\n\n # Update colors\n vcolors[object_index * sec : object_index * sec + sec] += color_add\n\n # Tell actor that memory is modified\n utils.update_actor(fury_actor)\n\n face_index = picked_info[\"face\"]\n\n # Show some info\n text = \"Object \" + str(object_index) + \"\\n\"\n text += \"Vertex ID \" + str(vertex_index) + \"\\n\"\n text += \"Face ID \" + str(face_index) + \"\\n\"\n text += \"World pos \" + str(np.round(picked_info[\"xyz\"], 2)) + \"\\n\"\n text += \"Actor ID \" + str(id(picked_info[\"actor\"]))\n text_block.message = text\n showm.render()" + "def left_click_callback(obj, event):\n # Get the event position on display and pick\n\n event_pos = pickm.event_position(showm.iren)\n picked_info = pickm.pick(event_pos, showm.scene)\n\n vertex_index = picked_info[\"vertex\"]\n\n # Calculate the objects index\n\n object_index = int(np.floor((vertex_index / num_vertices) * num_objects))\n\n # Find how many vertices correspond to each object\n sec = int(num_vertices / num_objects)\n\n if not selected[object_index]:\n scale = 6 / 5\n color_add = np.array([30, 30, 30], dtype=\"uint8\")\n selected[object_index] = True\n else:\n scale = 5 / 6\n color_add = np.array([-30, -30, -30], dtype=\"uint8\")\n selected[object_index] = False\n\n # Update vertices positions\n vertices[object_index * sec : object_index * sec + sec] = (\n scale\n * (\n vertices[object_index * sec : object_index * sec + sec]\n - centers[object_index]\n )\n + centers[object_index]\n )\n\n # Update colors\n vcolors[object_index * sec : object_index * sec + sec] += color_add\n\n # Tell actor that memory is modified\n fury.utils.update_actor(fury_actor)\n\n face_index = picked_info[\"face\"]\n\n # Show some info\n text = \"Object \" + str(object_index) + \"\\n\"\n text += \"Vertex ID \" + str(vertex_index) + \"\\n\"\n text += \"Face ID \" + str(face_index) + \"\\n\"\n text += \"World pos \" + str(np.round(picked_info[\"xyz\"], 2)) + \"\\n\"\n text += \"Actor ID \" + str(id(picked_info[\"actor\"]))\n text_block.message = text\n showm.render()" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(scene, size=(1024, 768), order_transparent=True)\n\nscene.add(panel)" + "showm = fury.window.ShowManager(scene, size=(1024, 768), order_transparent=True)\n\nscene.add(panel)" ] }, { @@ -231,7 +231,7 @@ }, "outputs": [], "source": [ - "window.record(showm.scene, size=(1024, 768), out_path=\"viz_picking.png\")" + "fury.window.record(showm.scene, size=(1024, 768), out_path=\"viz_picking.png\")" ] } ], diff --git a/dev/_downloads/04e8eda84bdca47952939ad54850e938/viz_layout.py b/dev/_downloads/04e8eda84bdca47952939ad54850e938/viz_layout.py index c7fd19e92..1859caf96 100644 --- a/dev/_downloads/04e8eda84bdca47952939ad54850e938/viz_layout.py +++ b/dev/_downloads/04e8eda84bdca47952939ad54850e938/viz_layout.py @@ -6,40 +6,41 @@ This example shows how to place different UI elements in different Layouts. The Layouts used here is GridLayout (with different cell shapes). -First, some imports. +First, let's import fury. """ -from fury import ui, window -from fury.layout import GridLayout +import fury ############################################################################### # We create some panels and then we arrange them in a grid fashion # # First, we create some panels with different sizes/positions -panel_1 = ui.Panel2D(size=(200, 200), color=(0.4, 0.6, 0.3), position=(100, 100)) +panel_1 = fury.ui.Panel2D(size=(200, 200), color=(0.4, 0.6, 0.3), position=(100, 100)) -panel_2 = ui.Panel2D(size=(250, 250), color=(0.8, 0.3, 0.5), position=(150, 150)) +panel_2 = fury.ui.Panel2D(size=(250, 250), color=(0.8, 0.3, 0.5), position=(150, 150)) ############################################################################### # Now we create two listboxes -listbox_1 = ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"]) +listbox_1 = fury.ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"]) -listbox_2 = ui.ListBox2D(size=(250, 250), values=["First", "Second", "Third"]) +listbox_2 = fury.ui.ListBox2D(size=(250, 250), values=["First", "Second", "Third"]) ############################################################################### # Now we create two different UI i.e. a slider and a listbox -slider = ui.LineSlider2D(length=150) -listbox = ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"]) +slider = fury.ui.LineSlider2D(length=150) +listbox = fury.ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"]) ############################################################################### # Now, we create grids with different shapes -rect_grid = GridLayout(position_offset=(0, 0, 0)) -square_grid = GridLayout(cell_shape="square", position_offset=(0, 300, 0)) -diagonal_grid = GridLayout(cell_shape="diagonal", position_offset=(0, 600, 0)) +rect_grid = fury.layout.GridLayout(position_offset=(0, 0, 0)) +square_grid = fury.layout.GridLayout(cell_shape="square", position_offset=(0, 300, 0)) +diagonal_grid = fury.layout.GridLayout( + cell_shape="diagonal", position_offset=(0, 600, 0) +) ############################################################################### @@ -50,7 +51,7 @@ diagonal_grid.apply([slider, listbox]) current_size = (1500, 1500) -show_manager = window.ShowManager(size=current_size, title="FURY UI Layout") +show_manager = fury.window.ShowManager(size=current_size, title="FURY UI Layout") show_manager.scene.add(panel_1, panel_2, listbox_1, listbox_2, slider, listbox) @@ -60,4 +61,4 @@ if interactive: show_manager.start() -window.record(show_manager.scene, out_path="ui_layout.png", size=(400, 400)) +fury.window.record(show_manager.scene, out_path="ui_layout.png", size=(400, 400)) diff --git a/dev/_downloads/05fd9f63e6e71b89f69af9820567b262/viz_timeline.py b/dev/_downloads/05fd9f63e6e71b89f69af9820567b262/viz_timeline.py index 45218aacc..4e579e57f 100644 --- a/dev/_downloads/05fd9f63e6e71b89f69af9820567b262/viz_timeline.py +++ b/dev/_downloads/05fd9f63e6e71b89f69af9820567b262/viz_timeline.py @@ -18,14 +18,13 @@ import numpy as np -from fury import actor, window -from fury.animation import Animation, Timeline +import fury ############################################################################### # We create our ``Scene`` and ``ShowManager`` as usual. -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager(scene, size=(900, 768)) +showm = fury.window.ShowManager(scene, size=(900, 768)) showm.initialize() ############################################################################### @@ -37,12 +36,12 @@ ############################################################################### # Creating a ``Timeline`` with a PlaybackPanel. -timeline = Timeline(playback_panel=True) +timeline = fury.animation.Timeline(playback_panel=True) ############################################################################### # Creating a Fury Animation as usual -anim = Animation() -sphere = actor.sphere(np.zeros([1, 3]), np.ones([1, 3])) +anim = fury.animation.Animation() +sphere = fury.actor.sphere(np.zeros([1, 3]), np.ones([1, 3])) anim.add_actor(sphere) # Now that the actor is add to the ``Animation``, setting keyframes to the # Animation will animate the actor accordingly. @@ -88,4 +87,6 @@ if interactive: showm.start() -window.record(scene, out_path="viz_keyframe_animation_timeline.png", size=(900, 768)) +fury.window.record( + scene, out_path="viz_keyframe_animation_timeline.png", size=(900, 768) +) diff --git a/dev/_downloads/061559c729409529da6e1dc02a16f347/viz_principled_spheres.py b/dev/_downloads/061559c729409529da6e1dc02a16f347/viz_principled_spheres.py index 018672433..82ded4337 100644 --- a/dev/_downloads/061559c729409529da6e1dc02a16f347/viz_principled_spheres.py +++ b/dev/_downloads/061559c729409529da6e1dc02a16f347/viz_principled_spheres.py @@ -21,12 +21,12 @@ import numpy as np -from fury import actor, material, window +import fury ############################################################################### # Now set up a new scene. -scene = window.Scene() +scene = fury.window.Scene() scene.background((0.9, 0.9, 0.9)) ############################################################################### @@ -56,12 +56,12 @@ center = np.array([[0, -5 * i, 0]]) for j in range(11): center[0][0] = -25 + 5 * j - sphere = actor.sphere( + sphere = fury.actor.sphere( center, colors=material_params[i][0], radii=2, theta=32, phi=32 ) keys = list(material_params[i][1]) material_params[i][1][keys[0]] = np.round(0.1 * j, decimals=1) - material.manifest_principled(sphere, **material_params[i][1]) + fury.material.manifest_principled(sphere, **material_params[i][1]) scene.add(sphere) ############################################################################### @@ -82,14 +82,14 @@ for i in range(10): pos = [-40, -5 * i, 0] - label = actor.vector_text( + label = fury.actor.vector_text( labels[i], pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0) ) scene.add(label) for j in range(11): pos = [-26 + 5 * j, 5, 0] - label = actor.vector_text( + label = fury.actor.vector_text( str(np.round(j * 0.1, decimals=1)), pos=pos, scale=(0.8, 0.8, 0.8), @@ -102,6 +102,6 @@ interactive = False if interactive: - window.show(scene) + fury.window.show(scene) -window.record(scene, size=(600, 600), out_path="viz_principled_spheres.png") +fury.window.record(scene, size=(600, 600), out_path="viz_principled_spheres.png") diff --git a/dev/_downloads/061f48d176589917ba8e083972b47b29/viz_card_sprite_sheet.zip b/dev/_downloads/061f48d176589917ba8e083972b47b29/viz_card_sprite_sheet.zip index b20d4abe6..aefc7507c 100644 Binary files a/dev/_downloads/061f48d176589917ba8e083972b47b29/viz_card_sprite_sheet.zip and b/dev/_downloads/061f48d176589917ba8e083972b47b29/viz_card_sprite_sheet.zip differ diff --git a/dev/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/dev/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip index b2b91cab0..6c4045570 100644 Binary files a/dev/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip and b/dev/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip differ diff --git a/dev/_downloads/0815a10a49849e7a50936c253c3ffffc/viz_fractals.py b/dev/_downloads/0815a10a49849e7a50936c253c3ffffc/viz_fractals.py index acbd3061e..a1573c194 100644 --- a/dev/_downloads/0815a10a49849e7a50936c253c3ffffc/viz_fractals.py +++ b/dev/_downloads/0815a10a49849e7a50936c253c3ffffc/viz_fractals.py @@ -21,7 +21,7 @@ import numpy as np -from fury import primitive, ui, utils, window +import fury ############################################################################### # Before we create our first fractal, let's set some ground rules for us to @@ -64,7 +64,7 @@ def tetrix(N): offset = (4**N - 1) // 3 + 1 # just need the vertices - U, _ = primitive.prim_tetrahedron() + U, _ = fury.primitive.prim_tetrahedron() def gen_centers(depth, pos, center, dist): if depth == N: @@ -78,7 +78,7 @@ def gen_centers(depth, pos, center, dist): # the division by sqrt(6) is to ensure correct scale gen_centers(0, 1, np.zeros(3), 2 / (6**0.5)) - vertices, faces = primitive.prim_tetrahedron() + vertices, faces = fury.primitive.prim_tetrahedron() # primitive is scaled down depending on level vertices /= 2 ** (N - 1) @@ -87,10 +87,10 @@ def gen_centers(depth, pos, center, dist): bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0) colors = (centers - bounds_min) / (bounds_max - bounds_min) - vertices, triangles, colors, _ = primitive.repeat_primitive( + vertices, triangles, colors, _ = fury.primitive.repeat_primitive( centers=centers, colors=colors, vertices=vertices, faces=faces ) - return utils.get_actor_from_primitive(vertices, triangles, colors) + return fury.utils.get_actor_from_primitive(vertices, triangles, colors) ############################################################################### @@ -149,16 +149,16 @@ def gen_centers(depth, pos, center, dist): gen_centers(0, 1, np.zeros(3), 1 / 3) - vertices, faces = primitive.prim_box() + vertices, faces = fury.primitive.prim_box() vertices /= 3**N bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0) colors = (centers - bounds_min) / (bounds_max - bounds_min) - vertices, triangles, colors, _ = primitive.repeat_primitive( + vertices, triangles, colors, _ = fury.primitive.repeat_primitive( centers=centers, colors=colors, vertices=vertices, faces=faces ) - return utils.get_actor_from_primitive(vertices, triangles, colors) + return fury.utils.get_actor_from_primitive(vertices, triangles, colors) ############################################################################### @@ -204,24 +204,24 @@ def gen_centers(depth, pos, center, side): gen_centers(0, 1, np.zeros(3), 1 / 3) - vertices, faces = primitive.prim_box() + vertices, faces = fury.primitive.prim_box() vertices /= 3**N bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0) colors = (centers - bounds_min) / (bounds_max - bounds_min) - vertices, triangles, colors, _ = primitive.repeat_primitive( + vertices, triangles, colors, _ = fury.primitive.repeat_primitive( centers=centers, colors=colors, vertices=vertices, faces=faces ) - return utils.get_actor_from_primitive(vertices, triangles, colors) + return fury.utils.get_actor_from_primitive(vertices, triangles, colors) ############################################################################### # Now that we have the functions to generate fractals, we can start setting up # the Scene and ShowManager. -scene = window.Scene() -showmgr = window.ShowManager(scene, "Fractals", (800, 800), reset_camera=True) +scene = fury.window.Scene() +showmgr = fury.window.ShowManager(scene, "Fractals", (800, 800), reset_camera=True) ############################################################################### # These values are what work nicely on my machine without lagging. If you have @@ -240,7 +240,7 @@ def gen_centers(depth, pos, center, side): "Snowflake": 2, } -shape_chooser = ui.RadioButton( +shape_chooser = fury.ui.RadioButton( options.keys(), padding=10, font_size=16, @@ -289,4 +289,4 @@ def timer_callback(_obj, _event): if interactive: showmgr.start() else: - window.record(showmgr.scene, out_path="fractals.png", size=(800, 800)) + fury.window.record(showmgr.scene, out_path="fractals.png", size=(800, 800)) diff --git a/dev/_downloads/0876d276baec8afe5efd02e1c78e1d73/viz_wrecking_ball.ipynb b/dev/_downloads/0876d276baec8afe5efd02e1c78e1d73/viz_wrecking_ball.ipynb index 321784cee..8a5c43013 100644 --- a/dev/_downloads/0876d276baec8afe5efd02e1c78e1d73/viz_wrecking_ball.ipynb +++ b/dev/_downloads/0876d276baec8afe5efd02e1c78e1d73/viz_wrecking_ball.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\nimport pybullet as p\n\nfrom fury import actor, ui, utils, window" + "import itertools\n\nimport numpy as np\nimport pybullet as p\n\nimport fury" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "# Base\nbase_actor = actor.box(\n centers=np.array([[0, 0, 0]]),\n directions=[0, 0, 0],\n scales=(5, 5, 0.2),\n colors=(1, 1, 1),\n)\nbase_coll = p.createCollisionShape(p.GEOM_BOX, halfExtents=[2.5, 2.5, 0.1])\nbase = p.createMultiBody(\n baseCollisionShapeIndex=base_coll,\n basePosition=[0, 0, -0.1],\n baseOrientation=[0, 0, 0, 1],\n)\np.changeDynamics(base, -1, lateralFriction=0.3, restitution=0.5)" + "# Base\nbase_actor = fury.actor.box(\n centers=np.array([[0, 0, 0]]),\n directions=[0, 0, 0],\n scales=(5, 5, 0.2),\n colors=(1, 1, 1),\n)\nbase_coll = p.createCollisionShape(p.GEOM_BOX, halfExtents=[2.5, 2.5, 0.1])\nbase = p.createMultiBody(\n baseCollisionShapeIndex=base_coll,\n basePosition=[0, 0, -0.1],\n baseOrientation=[0, 0, 0, 1],\n)\np.changeDynamics(base, -1, lateralFriction=0.3, restitution=0.5)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "idx = 0\n# Setting up wall\nfor i in range(wall_length):\n for k in range(wall_height):\n for j in range(wall_breadth):\n center_pos = np.array([(i * 0.2) - 1.8, (j * 0.4) - 0.9, (0.2 * k) + 0.1])\n brick_centers[idx] = center_pos\n brick_orns[idx] = np.array([0, 0, 0, 1])\n bricks[idx] = p.createMultiBody(\n baseMass=0.5,\n baseCollisionShapeIndex=brick_coll,\n basePosition=center_pos,\n baseOrientation=brick_orns[i],\n )\n p.changeDynamics(bricks[idx], -1, lateralFriction=0.1, restitution=0.1)\n idx += 1\n\nbrick_actor = actor.box(\n centers=brick_centers,\n directions=brick_directions,\n scales=brick_sizes,\n colors=brick_colors,\n)" + "idx = 0\n# Setting up wall\nfor i in range(wall_length):\n for k in range(wall_height):\n for j in range(wall_breadth):\n center_pos = np.array([(i * 0.2) - 1.8, (j * 0.4) - 0.9, (0.2 * k) + 0.1])\n brick_centers[idx] = center_pos\n brick_orns[idx] = np.array([0, 0, 0, 1])\n bricks[idx] = p.createMultiBody(\n baseMass=0.5,\n baseCollisionShapeIndex=brick_coll,\n basePosition=center_pos,\n baseOrientation=brick_orns[i],\n )\n p.changeDynamics(bricks[idx], -1, lateralFriction=0.1, restitution=0.1)\n idx += 1\n\nbrick_actor = fury.actor.box(\n centers=brick_centers,\n directions=brick_directions,\n scales=brick_sizes,\n colors=brick_colors,\n)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "# Generate wrecking ball\nlink_shape = p.createCollisionShape(\n p.GEOM_CYLINDER,\n radius=radii,\n height=dx_link,\n collisionFramePosition=[0, 0, -dx_link / 2],\n)\n\nbase_shape = p.createCollisionShape(p.GEOM_BOX, halfExtents=[0.01, 0.01, 0.01])\nball_shape = p.createCollisionShape(p.GEOM_SPHERE, radius=ball_radius)\n\nvisualShapeId = -1\n\nlink_Masses = np.zeros(n_links)\nlink_Masses[:] = link_mass\nlink_Masses[-1] = 5\nlinkCollisionShapeIndices = np.zeros(n_links)\nlinkCollisionShapeIndices[:] = np.array(link_shape)\nlinkCollisionShapeIndices[-1] = ball_shape\nlinkVisualShapeIndices = -1 * np.ones(n_links)\nlinkPositions = np.zeros((n_links, 3))\nlinkPositions[:] = np.array([0, 0, -dx_link])\nlinkOrientations = np.zeros((n_links, 4))\nlinkOrientations[:] = np.array([0, 0, 0, 1])\nlinkInertialFramePositions = np.zeros((n_links, 3))\nlinkInertialFrameOrns = np.zeros((n_links, 4))\nlinkInertialFrameOrns[:] = np.array([0, 0, 0, 1])\nindices = np.arange(n_links)\njointTypes = np.zeros(n_links)\njointTypes[:] = np.array(p.JOINT_SPHERICAL)\naxis = np.zeros((n_links, 3))\naxis[:] = np.array([1, 0, 0])\n\nlinkDirections = np.zeros((n_links, 3))\nlinkDirections[:] = np.array([1, 1, 1])\n\nlink_radii = np.zeros(n_links)\nlink_radii[:] = radii\n\nlink_heights = np.zeros(n_links)\nlink_heights[:] = dx_link\n\nrope_actor = actor.cylinder(\n centers=linkPositions,\n directions=linkDirections,\n colors=np.random.rand(n_links, 3),\n radius=radii,\n heights=link_heights,\n capped=True,\n)\n\nbasePosition = [0, 0, 2]\nbaseOrientation = [0, 0, 0, 1]\nrope = p.createMultiBody(\n base_mass,\n base_shape,\n visualShapeId,\n basePosition,\n baseOrientation,\n linkMasses=link_Masses,\n linkCollisionShapeIndices=linkCollisionShapeIndices.astype(int),\n linkVisualShapeIndices=linkVisualShapeIndices.astype(int),\n linkPositions=linkPositions.astype(int),\n linkOrientations=linkOrientations.astype(int),\n linkInertialFramePositions=linkInertialFramePositions.astype(int),\n linkInertialFrameOrientations=linkInertialFrameOrns.astype(int),\n linkParentIndices=indices.astype(int),\n linkJointTypes=jointTypes.astype(int),\n linkJointAxis=axis.astype(int),\n)" + "# Generate wrecking ball\nlink_shape = p.createCollisionShape(\n p.GEOM_CYLINDER,\n radius=radii,\n height=dx_link,\n collisionFramePosition=[0, 0, -dx_link / 2],\n)\n\nbase_shape = p.createCollisionShape(p.GEOM_BOX, halfExtents=[0.01, 0.01, 0.01])\nball_shape = p.createCollisionShape(p.GEOM_SPHERE, radius=ball_radius)\n\nvisualShapeId = -1\n\nlink_Masses = np.zeros(n_links)\nlink_Masses[:] = link_mass\nlink_Masses[-1] = 5\nlinkCollisionShapeIndices = np.zeros(n_links)\nlinkCollisionShapeIndices[:] = np.array(link_shape)\nlinkCollisionShapeIndices[-1] = ball_shape\nlinkVisualShapeIndices = -1 * np.ones(n_links)\nlinkPositions = np.zeros((n_links, 3))\nlinkPositions[:] = np.array([0, 0, -dx_link])\nlinkOrientations = np.zeros((n_links, 4))\nlinkOrientations[:] = np.array([0, 0, 0, 1])\nlinkInertialFramePositions = np.zeros((n_links, 3))\nlinkInertialFrameOrns = np.zeros((n_links, 4))\nlinkInertialFrameOrns[:] = np.array([0, 0, 0, 1])\nindices = np.arange(n_links)\njointTypes = np.zeros(n_links)\njointTypes[:] = np.array(p.JOINT_SPHERICAL)\naxis = np.zeros((n_links, 3))\naxis[:] = np.array([1, 0, 0])\n\nlinkDirections = np.zeros((n_links, 3))\nlinkDirections[:] = np.array([1, 1, 1])\n\nlink_radii = np.zeros(n_links)\nlink_radii[:] = radii\n\nlink_heights = np.zeros(n_links)\nlink_heights[:] = dx_link\n\nrope_actor = fury.actor.cylinder(\n centers=linkPositions,\n directions=linkDirections,\n colors=np.random.rand(n_links, 3),\n radius=radii,\n heights=link_heights,\n capped=True,\n)\n\nbasePosition = [0, 0, 2]\nbaseOrientation = [0, 0, 0, 1]\nrope = p.createMultiBody(\n base_mass,\n base_shape,\n visualShapeId,\n basePosition,\n baseOrientation,\n linkMasses=link_Masses,\n linkCollisionShapeIndices=linkCollisionShapeIndices.astype(int),\n linkVisualShapeIndices=linkVisualShapeIndices.astype(int),\n linkPositions=linkPositions.astype(int),\n linkOrientations=linkOrientations.astype(int),\n linkInertialFramePositions=linkInertialFramePositions.astype(int),\n linkInertialFrameOrientations=linkInertialFrameOrns.astype(int),\n linkParentIndices=indices.astype(int),\n linkJointTypes=jointTypes.astype(int),\n linkJointAxis=axis.astype(int),\n)" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "root_robe_c = p.createConstraint(\n rope, -1, -1, -1, p.JOINT_FIXED, [0, 0, 0], [0, 0, 0], [0, 0, 2]\n)\n\nbox_actor = actor.box(\n centers=np.array([[0, 0, 0]]),\n directions=np.array([[0, 0, 0]]),\n scales=(0.02, 0.02, 0.02),\n colors=np.array([[1, 0, 0]]),\n)\n\nball_actor = actor.sphere(\n centers=np.array([[0, 0, 0]]), radii=ball_radius, colors=np.array([1, 0, 1])\n)" + "root_robe_c = p.createConstraint(\n rope, -1, -1, -1, p.JOINT_FIXED, [0, 0, 0], [0, 0, 0], [0, 0, 2]\n)\n\nbox_actor = fury.actor.box(\n centers=np.array([[0, 0, 0]]),\n directions=np.array([[0, 0, 0]]),\n scales=(0.02, 0.02, 0.02),\n colors=np.array([[1, 0, 0]]),\n)\n\nball_actor = fury.actor.sphere(\n centers=np.array([[0, 0, 0]]), radii=ball_radius, colors=np.array([1, 0, 1])\n)" ] }, { @@ -177,7 +177,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.set_camera((10.28, -7.10, 6.39), (0.0, 0.0, 0.4), (-0.35, 0.26, 1.0))\nscene.add(actor.axes(scale=(0.5, 0.5, 0.5)), base_actor, brick_actor)\nscene.add(rope_actor, box_actor, ball_actor)\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" + "scene = fury.window.Scene()\nscene.set_camera((10.28, -7.10, 6.39), (0.0, 0.0, 0.4), (-0.35, 0.26, 1.0))\nscene.add(fury.actor.axes(scale=(0.5, 0.5, 0.5)), base_actor, brick_actor)\nscene.add(rope_actor, box_actor, ball_actor)\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "brick_vertices = utils.vertices_from_actor(brick_actor)\nnum_vertices = brick_vertices.shape[0]\nnum_objects = brick_centers.shape[0]\nbrick_sec = int(num_vertices / num_objects)" + "brick_vertices = fury.utils.vertices_from_actor(brick_actor)\nnum_vertices = brick_vertices.shape[0]\nnum_objects = brick_centers.shape[0]\nbrick_sec = int(num_vertices / num_objects)" ] }, { @@ -231,7 +231,7 @@ }, "outputs": [], "source": [ - "chain_vertices = utils.vertices_from_actor(rope_actor)\nnum_vertices = chain_vertices.shape[0]\nnum_objects = brick_centers.shape[0]\nchain_sec = int(num_vertices / num_objects)" + "chain_vertices = fury.utils.vertices_from_actor(rope_actor)\nnum_vertices = chain_vertices.shape[0]\nnum_objects = brick_centers.shape[0]\nchain_sec = int(num_vertices / num_objects)" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "counter = itertools.count()\nfpss = np.array([])\ntb = ui.TextBlock2D(\n position=(0, 680), font_size=30, color=(1, 0.5, 0), text=\"Avg. FPS: \\nSim Steps: \"\n)\nscene.add(tb)" + "counter = itertools.count()\nfpss = np.array([])\ntb = fury.ui.TextBlock2D(\n position=(0, 680), font_size=30, color=(1, 0.5, 0), text=\"Avg. FPS: \\nSim Steps: \"\n)\nscene.add(tb)" ] }, { @@ -285,7 +285,7 @@ }, "outputs": [], "source": [ - "apply_force = True\n\n\n# Create timer callback which will execute at each step of simulation.\ndef timer_callback(_obj, _event):\n global apply_force, fpss\n cnt = next(counter)\n showm.render()\n\n if cnt % 1 == 0:\n fps = showm.frame_rate\n fpss = np.append(fpss, fps)\n tb.message = (\n \"Avg. FPS: \" + str(np.round(np.mean(fpss), 0)) + \"\\nSim Steps: \" + str(cnt)\n )\n\n # Updating the position and orientation of each individual brick.\n for idx, brick in enumerate(bricks):\n sync_brick(idx, brick)\n\n pos, _ = p.getBasePositionAndOrientation(rope)\n\n if apply_force:\n p.applyExternalForce(\n rope, -1, forceObj=[-500, 0, 0], posObj=pos, flags=p.WORLD_FRAME\n )\n apply_force = False\n\n pos = p.getLinkState(rope, p.getNumJoints(rope) - 1)[4]\n ball_actor.SetPosition(*pos)\n sync_chain(rope_actor, rope)\n utils.update_actor(brick_actor)\n utils.update_actor(rope_actor)\n\n # Simulate a step.\n p.stepSimulation()\n\n if cnt == 130:\n showm.exit()\n\n\n# Add the timer callback to showmanager.\n# Increasing the duration value will slow down the simulation.\nshowm.add_timer_callback(True, 1, timer_callback)\n\ninteractive = False\n\n# start simulation\nif interactive:\n showm.start()\n\nwindow.record(scene, size=(900, 768), out_path=\"viz_wrecking_ball.png\")" + "apply_force = True\n\n\n# Create timer callback which will execute at each step of simulation.\ndef timer_callback(_obj, _event):\n global apply_force, fpss\n cnt = next(counter)\n showm.render()\n\n if cnt % 1 == 0:\n fps = showm.frame_rate\n fpss = np.append(fpss, fps)\n tb.message = (\n \"Avg. FPS: \" + str(np.round(np.mean(fpss), 0)) + \"\\nSim Steps: \" + str(cnt)\n )\n\n # Updating the position and orientation of each individual brick.\n for idx, brick in enumerate(bricks):\n sync_brick(idx, brick)\n\n pos, _ = p.getBasePositionAndOrientation(rope)\n\n if apply_force:\n p.applyExternalForce(\n rope, -1, forceObj=[-500, 0, 0], posObj=pos, flags=p.WORLD_FRAME\n )\n apply_force = False\n\n pos = p.getLinkState(rope, p.getNumJoints(rope) - 1)[4]\n ball_actor.SetPosition(*pos)\n sync_chain(rope_actor, rope)\n fury.utils.update_actor(brick_actor)\n fury.utils.update_actor(rope_actor)\n\n # Simulate a step.\n p.stepSimulation()\n\n if cnt == 130:\n showm.exit()\n\n\n# Add the timer callback to showmanager.\n# Increasing the duration value will slow down the simulation.\nshowm.add_timer_callback(True, 1, timer_callback)\n\ninteractive = False\n\n# start simulation\nif interactive:\n showm.start()\n\nfury.window.record(scene, size=(900, 768), out_path=\"viz_wrecking_ball.png\")" ] } ], diff --git a/dev/_downloads/0a1e78fb4edd12691b261219a7c8130a/viz_gltf_export.py b/dev/_downloads/0a1e78fb4edd12691b261219a7c8130a/viz_gltf_export.py index 9d54a2f8a..bc74bd2a1 100644 --- a/dev/_downloads/0a1e78fb4edd12691b261219a7c8130a/viz_gltf_export.py +++ b/dev/_downloads/0a1e78fb4edd12691b261219a7c8130a/viz_gltf_export.py @@ -7,8 +7,7 @@ import numpy as np -from fury import actor, gltf, window -from fury.data import fetch_gltf, read_viz_gltf +import fury ############################################################################ # Specifying centers and colors for actors. We will use these parameters @@ -20,20 +19,20 @@ ############################################################################## # Create a scene. -scene = window.Scene() +scene = fury.window.Scene() ############################################################################## # Creating actors and adding to scene. -cube = actor.cube(np.add(centers, np.array([2, 0, 0])), colors=colors / 2) +cube = fury.actor.cube(np.add(centers, np.array([2, 0, 0])), colors=colors / 2) scene.add(cube) -sphere = actor.sphere(np.add(centers, np.array([0, 2, 0])), colors=colors) +sphere = fury.actor.sphere(np.add(centers, np.array([0, 2, 0])), colors=colors) scene.add(sphere) -fetch_gltf("BoxTextured", "glTF") -filename = read_viz_gltf("BoxTextured") -gltf_obj = gltf.glTF(filename) +fury.data.fetch_gltf("BoxTextured", "glTF") +filename = fury.data.read_viz_gltf("BoxTextured") +gltf_obj = fury.gltf.glTF(filename) box_actor = gltf_obj.actors() scene.add(box_actor[0]) @@ -47,12 +46,12 @@ ############################################################################## # Exporting scene as a glTF file -gltf.export_scene(scene, filename="viz_gltf_export.gltf") +fury.gltf.export_scene(scene, filename="viz_gltf_export.gltf") ############################################################################## # Reading the newly created glTF file and get actors. -gltf_obj = gltf.glTF("viz_gltf_export.gltf") +gltf_obj = fury.gltf.glTF("viz_gltf_export.gltf") actors = gltf_obj.actors() ############################################################################## @@ -63,6 +62,6 @@ interactive = False if interactive: - window.show(scene, size=(1280, 720)) + fury.window.show(scene, size=(1280, 720)) -window.record(scene, out_path="viz_gltf_export.png", size=(1280, 720)) +fury.window.record(scene, out_path="viz_gltf_export.png", size=(1280, 720)) diff --git a/dev/_downloads/0ca34b75f2c64753ef693f93bf31e662/viz_spiky.zip b/dev/_downloads/0ca34b75f2c64753ef693f93bf31e662/viz_spiky.zip index e1f416b1d..45351c92f 100644 Binary files a/dev/_downloads/0ca34b75f2c64753ef693f93bf31e662/viz_spiky.zip and b/dev/_downloads/0ca34b75f2c64753ef693f93bf31e662/viz_spiky.zip differ diff --git a/dev/_downloads/0ca5dcd7c180e7a9a1580239a6ab71b5/viz_fine_tuning_gl_context.zip b/dev/_downloads/0ca5dcd7c180e7a9a1580239a6ab71b5/viz_fine_tuning_gl_context.zip index af5626d13..9120e6547 100644 Binary files a/dev/_downloads/0ca5dcd7c180e7a9a1580239a6ab71b5/viz_fine_tuning_gl_context.zip and b/dev/_downloads/0ca5dcd7c180e7a9a1580239a6ab71b5/viz_fine_tuning_gl_context.zip differ diff --git a/dev/_downloads/0e3f27ad64a68bb8e27f50447dcf2c40/viz_timeline.ipynb b/dev/_downloads/0e3f27ad64a68bb8e27f50447dcf2c40/viz_timeline.ipynb index 9e01238eb..6e80dbded 100644 --- a/dev/_downloads/0e3f27ad64a68bb8e27f50447dcf2c40/viz_timeline.ipynb +++ b/dev/_downloads/0e3f27ad64a68bb8e27f50447dcf2c40/viz_timeline.ipynb @@ -22,7 +22,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\nfrom fury.animation import Animation, Timeline" + "import numpy as np\n\nimport fury" ] }, { @@ -40,7 +40,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nshowm = window.ShowManager(scene, size=(900, 768))\nshowm.initialize()" + "scene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(scene, size=(900, 768))\nshowm.initialize()" ] }, { @@ -65,7 +65,7 @@ }, "outputs": [], "source": [ - "timeline = Timeline(playback_panel=True)" + "timeline = fury.animation.Timeline(playback_panel=True)" ] }, { @@ -83,7 +83,7 @@ }, "outputs": [], "source": [ - "anim = Animation()\nsphere = actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))\nanim.add_actor(sphere)\n# Now that the actor is add to the ``Animation``, setting keyframes to the\n# Animation will animate the actor accordingly." + "anim = fury.animation.Animation()\nsphere = fury.actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))\nanim.add_actor(sphere)\n# Now that the actor is add to the ``Animation``, setting keyframes to the\n# Animation will animate the actor accordingly." ] }, { @@ -162,7 +162,7 @@ }, "outputs": [], "source": [ - "showm.add_animation(timeline)\n\nscene.set_camera(position=(0, 0, -10))\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_keyframe_animation_timeline.png\", size=(900, 768))" + "showm.add_animation(timeline)\n\nscene.set_camera(position=(0, 0, -10))\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(\n scene, out_path=\"viz_keyframe_animation_timeline.png\", size=(900, 768)\n)" ] } ], diff --git a/dev/_downloads/0eebaf3c387fd05da33d70f6977ed2cd/viz_slice.zip b/dev/_downloads/0eebaf3c387fd05da33d70f6977ed2cd/viz_slice.zip index 59bedc14b..de24ab270 100644 Binary files a/dev/_downloads/0eebaf3c387fd05da33d70f6977ed2cd/viz_slice.zip and b/dev/_downloads/0eebaf3c387fd05da33d70f6977ed2cd/viz_slice.zip differ diff --git a/dev/_downloads/105752fae9774603c611cabb86a2b430/viz_introduction.zip b/dev/_downloads/105752fae9774603c611cabb86a2b430/viz_introduction.zip index b50ff1856..a42085aff 100644 Binary files a/dev/_downloads/105752fae9774603c611cabb86a2b430/viz_introduction.zip and b/dev/_downloads/105752fae9774603c611cabb86a2b430/viz_introduction.zip differ diff --git a/dev/_downloads/1159dab220778ac5e3d8ffe6030f5272/viz_multithread.py b/dev/_downloads/1159dab220778ac5e3d8ffe6030f5272/viz_multithread.py index 33060f75f..2d491eefe 100644 --- a/dev/_downloads/1159dab220778ac5e3d8ffe6030f5272/viz_multithread.py +++ b/dev/_downloads/1159dab220778ac5e3d8ffe6030f5272/viz_multithread.py @@ -15,29 +15,29 @@ import numpy as np -from fury import actor, ui, window +import fury # Preparing to draw some spheres xyz = 10 * (np.random.random((100, 3)) - 0.5) colors = np.random.random((100, 4)) radii = np.random.random(100) + 0.5 -scene = window.Scene() -sphere_actor = actor.sphere( +scene = fury.window.Scene() +sphere_actor = fury.actor.sphere( centers=xyz, colors=colors, radii=radii, use_primitive=False ) scene.add(sphere_actor) # Preparing the show manager as usual -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) # showm.initialize() # Creating a text block to show a message and reset the camera -tb = ui.TextBlock2D(bold=True) +tb = fury.ui.TextBlock2D(bold=True) scene.add(tb) scene.ResetCamera() @@ -77,7 +77,7 @@ def add_remove_axes(): for i in range(100): if showm.lock_current(): if current_axes is None: - current_axes = actor.axes(scale=(0.20 * i, 0.20 * i, 0.20 * i)) + current_axes = fury.actor.axes(scale=(0.20 * i, 0.20 * i, 0.20 * i)) scene.add(current_axes) pass else: diff --git a/dev/_downloads/119ebd974546c339566e74a84baba9b3/viz_timeline.zip b/dev/_downloads/119ebd974546c339566e74a84baba9b3/viz_timeline.zip index 708ce2668..50d802327 100644 Binary files a/dev/_downloads/119ebd974546c339566e74a84baba9b3/viz_timeline.zip and b/dev/_downloads/119ebd974546c339566e74a84baba9b3/viz_timeline.zip differ diff --git a/dev/_downloads/148b936e54c9b9ef503924842fc5f2ae/viz_layout.zip b/dev/_downloads/148b936e54c9b9ef503924842fc5f2ae/viz_layout.zip index f0173201f..e98f6652c 100644 Binary files a/dev/_downloads/148b936e54c9b9ef503924842fc5f2ae/viz_layout.zip and b/dev/_downloads/148b936e54c9b9ef503924842fc5f2ae/viz_layout.zip differ diff --git a/dev/_downloads/15ac013b7a87b60bc067a78f156ac21f/viz_texture.ipynb b/dev/_downloads/15ac013b7a87b60bc067a78f156ac21f/viz_texture.ipynb index 318a3d106..af510e891 100644 --- a/dev/_downloads/15ac013b7a87b60bc067a78f156ac21f/viz_texture.ipynb +++ b/dev/_downloads/15ac013b7a87b60bc067a78f156ac21f/viz_texture.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import actor, io, window\nfrom fury.data import fetch_viz_textures, read_viz_textures" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()" + "scene = fury.window.Scene()" ] }, { @@ -51,14 +51,14 @@ }, "outputs": [], "source": [ - "fetch_viz_textures()\nfilename = read_viz_textures(\"1_earth_8k.jpg\")\nimage = io.load_image(filename)" + "fury.data.fetch_viz_textures()\nfilename = fury.data.read_viz_textures(\"1_earth_8k.jpg\")\nimage = fury.io.load_image(filename)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Next, use ``actor.texture_on_sphere`` to add a sphere with the texture from\nyour loaded image to the already existing scene.\nTo add a texture to your scene as visualized on a plane, use\n``actor.texture`` instead.\n\n" + "Next, use ``fury.actor.texture_on_sphere`` to add a sphere with the texture from\nyour loaded image to the already existing scene.\nTo add a texture to your scene as visualized on a plane, use\n``fury.actor.texture`` instead.\n\n" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "scene.add(actor.texture_on_sphere(image))" + "scene.add(fury.actor.texture_on_sphere(image))" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "interactive = False\nif interactive:\n window.show(scene, size=(600, 600), reset_camera=False)\nwindow.record(scene, size=(900, 768), out_path=\"viz_texture.png\")" + "interactive = False\nif interactive:\n fury.window.show(scene, size=(600, 600), reset_camera=False)\nfury.window.record(scene, size=(900, 768), out_path=\"viz_texture.png\")" ] } ], diff --git a/dev/_downloads/16be6a14d02d2f4211e44f5bd4014bc3/viz_earth_coordinates.ipynb b/dev/_downloads/16be6a14d02d2f4211e44f5bd4014bc3/viz_earth_coordinates.ipynb index a53cf51a8..1527de055 100644 --- a/dev/_downloads/16be6a14d02d2f4211e44f5bd4014bc3/viz_earth_coordinates.ipynb +++ b/dev/_downloads/16be6a14d02d2f4211e44f5bd4014bc3/viz_earth_coordinates.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\nimport math\n\nimport numpy as np\n\nfrom fury import actor, io, utils, window\nfrom fury.data import fetch_viz_textures, read_viz_textures" + "import itertools\nimport math\n\nimport numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nfetch_viz_textures()\nearth_file = read_viz_textures(\"1_earth_16k.jpg\")\nearth_image = io.load_image(earth_file)\nearth_actor = actor.texture_on_sphere(earth_image)\nscene.add(earth_actor)" + "scene = fury.window.Scene()\n\nfury.data.fetch_viz_textures()\nearth_file = fury.data.read_viz_textures(\"1_earth_16k.jpg\")\nearth_image = fury.io.load_image(earth_file)\nearth_actor = fury.actor.texture_on_sphere(earth_image)\nscene.add(earth_actor)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "utils.rotate(earth_actor, (-90, 1, 0, 0))\nutils.rotate(earth_actor, (180, 0, 1, 0))\nearth_actor.SetScale(2, 2, 2)" + "fury.utils.rotate(earth_actor, (-90, 1, 0, 0))\nfury.utils.rotate(earth_actor, (180, 0, 1, 0))\nearth_actor.SetScale(2, 2, 2)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "centers = np.array([[*locationone], [*locationtwo], [*locationthree]])\ncolors = np.random.rand(3, 3)\nradii = np.array([0.005, 0.005, 0.005])\nsphere_actor = actor.sphere(centers, colors, radii)\nscene.add(sphere_actor)" + "centers = np.array([[*locationone], [*locationtwo], [*locationthree]])\ncolors = np.random.rand(3, 3)\nradii = np.array([0.005, 0.005, 0.005])\nsphere_actor = fury.actor.sphere(centers, colors, radii)\nscene.add(sphere_actor)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "nyc_actor = actor.text_3d(\n \"New York City, New York\\n40.7128\u00b0 N, 74.0060\u00b0 W\",\n (locationone[0] - 0.04, locationone[1], locationone[2] + 0.07),\n window.colors.white,\n 0.01,\n)\nparis_actor = actor.text_3d(\n \"Paris, France\\n48.8566\u00b0 N, 2.3522\u00b0 E\",\n (locationthree[0] - 0.04, locationthree[1], locationthree[2] - 0.07),\n window.colors.white,\n 0.01,\n)\nbeijing_actor = actor.text_3d(\n \"Beijing, China\\n39.9042\u00b0 N, 116.4074\u00b0 E\",\n (locationtwo[0] - 0.06, locationtwo[1], locationtwo[2] - 0.07),\n window.colors.white,\n 0.01,\n)\nutils.rotate(paris_actor, (85, 0, 1, 0))\nutils.rotate(beijing_actor, (180, 0, 1, 0))\nutils.rotate(nyc_actor, (5, 1, 0, 0))" + "nyc_actor = fury.actor.text_3d(\n \"New York City, New York\\n40.7128\u00b0 N, 74.0060\u00b0 W\",\n (locationone[0] - 0.04, locationone[1], locationone[2] + 0.07),\n fury.window.colors.white,\n 0.01,\n)\nparis_actor = fury.actor.text_3d(\n \"Paris, France\\n48.8566\u00b0 N, 2.3522\u00b0 E\",\n (locationthree[0] - 0.04, locationthree[1], locationthree[2] - 0.07),\n fury.window.colors.white,\n 0.01,\n)\nbeijing_actor = fury.actor.text_3d(\n \"Beijing, China\\n39.9042\u00b0 N, 116.4074\u00b0 E\",\n (locationtwo[0] - 0.06, locationtwo[1], locationtwo[2] - 0.07),\n fury.window.colors.white,\n 0.01,\n)\nfury.utils.rotate(paris_actor, (85, 0, 1, 0))\nfury.utils.rotate(beijing_actor, (180, 0, 1, 0))\nfury.utils.rotate(nyc_actor, (5, 1, 0, 0))" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" + "showm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" ] }, { @@ -177,7 +177,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 25, timer_callback)\nshowm.start()\n\nwindow.record(showm.scene, size=(900, 768), out_path=\"viz_earth_coordinates.png\")" + "showm.add_timer_callback(True, 25, timer_callback)\nshowm.start()\n\nfury.window.record(showm.scene, size=(900, 768), out_path=\"viz_earth_coordinates.png\")" ] } ], diff --git a/dev/_downloads/18abde366d53ac67affaf44a0d2cc267/viz_fiber_odf.ipynb b/dev/_downloads/18abde366d53ac67affaf44a0d2cc267/viz_fiber_odf.ipynb index d9e835601..58513630f 100644 --- a/dev/_downloads/18abde366d53ac67affaf44a0d2cc267/viz_fiber_odf.ipynb +++ b/dev/_downloads/18abde366d53ac67affaf44a0d2cc267/viz_fiber_odf.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from dipy.data import get_sphere\nfrom dipy.reconst.shm import sh_to_sf_matrix\nimport nibabel as nib\n\n# First, we import some useful modules and methods.\nimport numpy as np\n\nfrom fury import actor, ui, window\nfrom fury.data import fetch_viz_dmri, fetch_viz_icons, read_viz_dmri\nfrom fury.utils import fix_winding_order" + "from dipy.data import get_sphere\nfrom dipy.reconst.shm import sh_to_sf_matrix\nimport nibabel as nib\n\n# First, we import some useful modules and methods.\nimport numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_dmri()\nfetch_viz_icons()\n\nfodf_img = nib.load(read_viz_dmri(\"fodf.nii.gz\"))\nsh = fodf_img.get_fdata()\naffine = fodf_img.affine\ngrid_shape = sh.shape[:-1]" + "fury.data.fetch_viz_dmri()\nfury.data.fetch_viz_icons()\n\nfodf_img = nib.load(fury.data.read_viz_dmri(\"fodf.nii.gz\"))\nsh = fodf_img.get_fdata()\naffine = fodf_img.affine\ngrid_shape = sh.shape[:-1]" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "# Change these values to test various parameters combinations.\nscale = 0.5\nnorm = False\ncolormap = None\nradial_scale = True\nopacity = 1.0\nglobal_cm = False\n\n# ODF slicer for axial slice\nodf_actor_z = actor.odf_slicer(\n sh,\n affine=affine,\n sphere=sphere_low,\n scale=scale,\n norm=norm,\n radial_scale=radial_scale,\n opacity=opacity,\n colormap=colormap,\n global_cm=global_cm,\n B_matrix=B_low,\n)\n\n# ODF slicer for coronal slice\nodf_actor_y = actor.odf_slicer(\n sh,\n affine=affine,\n sphere=sphere_low,\n scale=scale,\n norm=norm,\n radial_scale=radial_scale,\n opacity=opacity,\n colormap=colormap,\n global_cm=global_cm,\n B_matrix=B_low,\n)\nodf_actor_y.display_extent(\n 0, grid_shape[0] - 1, grid_shape[1] // 2, grid_shape[1] // 2, 0, grid_shape[2] - 1\n)\n\n# ODF slicer for sagittal slice\nodf_actor_x = actor.odf_slicer(\n sh,\n affine=affine,\n sphere=sphere_low,\n scale=scale,\n norm=norm,\n radial_scale=radial_scale,\n opacity=opacity,\n colormap=colormap,\n global_cm=global_cm,\n B_matrix=B_low,\n)\nodf_actor_x.display_extent(\n grid_shape[0] // 2, grid_shape[0] // 2, 0, grid_shape[1] - 1, 0, grid_shape[2] - 1\n)\n\nscene = window.Scene()\nscene.add(odf_actor_z)\nscene.add(odf_actor_y)\nscene.add(odf_actor_x)\n\nshow_m = window.ShowManager(scene, reset_camera=True, size=(1200, 900))" + "# Change these values to test various parameters combinations.\nscale = 0.5\nnorm = False\ncolormap = None\nradial_scale = True\nopacity = 1.0\nglobal_cm = False\n\n# ODF slicer for axial slice\nodf_actor_z = fury.actor.odf_slicer(\n sh,\n affine=affine,\n sphere=sphere_low,\n scale=scale,\n norm=norm,\n radial_scale=radial_scale,\n opacity=opacity,\n colormap=colormap,\n global_cm=global_cm,\n B_matrix=B_low,\n)\n\n# ODF slicer for coronal slice\nodf_actor_y = fury.actor.odf_slicer(\n sh,\n affine=affine,\n sphere=sphere_low,\n scale=scale,\n norm=norm,\n radial_scale=radial_scale,\n opacity=opacity,\n colormap=colormap,\n global_cm=global_cm,\n B_matrix=B_low,\n)\nodf_actor_y.display_extent(\n 0, grid_shape[0] - 1, grid_shape[1] // 2, grid_shape[1] // 2, 0, grid_shape[2] - 1\n)\n\n# ODF slicer for sagittal slice\nodf_actor_x = fury.actor.odf_slicer(\n sh,\n affine=affine,\n sphere=sphere_low,\n scale=scale,\n norm=norm,\n radial_scale=radial_scale,\n opacity=opacity,\n colormap=colormap,\n global_cm=global_cm,\n B_matrix=B_low,\n)\nodf_actor_x.display_extent(\n grid_shape[0] // 2, grid_shape[0] // 2, 0, grid_shape[1] - 1, 0, grid_shape[2] - 1\n)\n\nscene = fury.window.Scene()\nscene.add(odf_actor_z)\nscene.add(odf_actor_y)\nscene.add(odf_actor_x)\n\nshow_m = fury.window.ShowManager(scene, reset_camera=True, size=(1200, 900))" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "line_slider_z = ui.LineSlider2D(\n min_value=0,\n max_value=grid_shape[2] - 1,\n initial_value=grid_shape[2] / 2,\n text_template=\"{value:.0f}\",\n length=140,\n)\n\nline_slider_y = ui.LineSlider2D(\n min_value=0,\n max_value=grid_shape[1] - 1,\n initial_value=grid_shape[1] / 2,\n text_template=\"{value:.0f}\",\n length=140,\n)\n\nline_slider_x = ui.LineSlider2D(\n min_value=0,\n max_value=grid_shape[0] - 1,\n initial_value=grid_shape[0] / 2,\n text_template=\"{value:.0f}\",\n length=140,\n)" + "line_slider_z = fury.ui.LineSlider2D(\n min_value=0,\n max_value=grid_shape[2] - 1,\n initial_value=grid_shape[2] / 2,\n text_template=\"{value:.0f}\",\n length=140,\n)\n\nline_slider_y = fury.ui.LineSlider2D(\n min_value=0,\n max_value=grid_shape[1] - 1,\n initial_value=grid_shape[1] / 2,\n text_template=\"{value:.0f}\",\n length=140,\n)\n\nline_slider_x = fury.ui.LineSlider2D(\n min_value=0,\n max_value=grid_shape[0] - 1,\n initial_value=grid_shape[0] / 2,\n text_template=\"{value:.0f}\",\n length=140,\n)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "sphere_high = get_sphere(\"symmetric362\")\n\n# We fix the order of the faces' three vertices to a clockwise winding. This\n# ensures all faces have a normal going away from the center of the sphere.\nsphere_high.faces = fix_winding_order(sphere_high.vertices, sphere_high.faces, True)\nB_high = sh_to_sf_matrix(sphere_high, 8, return_inv=False)" + "sphere_high = get_sphere(\"symmetric362\")\n\n# We fix the order of the faces' three vertices to a clockwise winding. This\n# ensures all faces have a normal going away from the center of the sphere.\nsphere_high.faces = fury.utils.fix_winding_order(\n sphere_high.vertices, sphere_high.faces, True\n)\nB_high = sh_to_sf_matrix(sphere_high, 8, return_inv=False)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "sphere_dict = {\n \"Low resolution\": (sphere_low, B_low),\n \"High resolution\": (sphere_high, B_high),\n}\ncombobox = ui.ComboBox2D(items=list(sphere_dict))\nscene.add(combobox)" + "sphere_dict = {\n \"Low resolution\": (sphere_low, B_low),\n \"High resolution\": (sphere_high, B_high),\n}\ncombobox = fury.ui.ComboBox2D(items=list(sphere_dict))\nscene.add(combobox)" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "def build_label(text):\n label = ui.TextBlock2D()\n label.message = text\n label.font_size = 18\n label.font_family = \"Arial\"\n label.justification = \"left\"\n label.bold = False\n label.italic = False\n label.shadow = False\n label.background_color = (0, 0, 0)\n label.color = (1, 1, 1)\n\n return label\n\n\nline_slider_label_z = build_label(text=\"Z Slice\")\nline_slider_label_y = build_label(text=\"Y Slice\")\nline_slider_label_x = build_label(text=\"X Slice\")\n\npanel = ui.Panel2D(size=(300, 200), color=(1, 1, 1), opacity=0.1, align=\"right\")\npanel.center = (1030, 120)\n\npanel.add_element(line_slider_label_x, (0.1, 0.75))\npanel.add_element(line_slider_x, (0.38, 0.75))\npanel.add_element(line_slider_label_y, (0.1, 0.55))\npanel.add_element(line_slider_y, (0.38, 0.55))\npanel.add_element(line_slider_label_z, (0.1, 0.35))\npanel.add_element(line_slider_z, (0.38, 0.35))\n\nshow_m.scene.add(panel)" + "def build_label(text):\n label = fury.ui.TextBlock2D()\n label.message = text\n label.font_size = 18\n label.font_family = \"Arial\"\n label.justification = \"left\"\n label.bold = False\n label.italic = False\n label.shadow = False\n label.background_color = (0, 0, 0)\n label.color = (1, 1, 1)\n\n return label\n\n\nline_slider_label_z = build_label(text=\"Z Slice\")\nline_slider_label_y = build_label(text=\"Y Slice\")\nline_slider_label_x = build_label(text=\"X Slice\")\n\npanel = fury.ui.Panel2D(size=(300, 200), color=(1, 1, 1), opacity=0.1, align=\"right\")\npanel.center = (1030, 120)\n\npanel.add_element(line_slider_label_x, (0.1, 0.75))\npanel.add_element(line_slider_x, (0.38, 0.75))\npanel.add_element(line_slider_label_y, (0.1, 0.55))\npanel.add_element(line_slider_y, (0.38, 0.55))\npanel.add_element(line_slider_label_z, (0.1, 0.35))\npanel.add_element(line_slider_z, (0.38, 0.35))\n\nshow_m.scene.add(panel)" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "interactive = False\n\nif interactive:\n show_m.add_window_callback(win_callback)\n show_m.render()\n show_m.start()\nelse:\n window.record(\n scene, out_path=\"odf_slicer_3D.png\", size=(1200, 900), reset_camera=False\n )\n\ndel show_m" + "interactive = False\n\nif interactive:\n show_m.add_window_callback(win_callback)\n show_m.render()\n show_m.start()\nelse:\n fury.window.record(\n scene, out_path=\"odf_slicer_3D.png\", size=(1200, 900), reset_camera=False\n )\n\ndel show_m" ] } ], diff --git a/dev/_downloads/18bb885e92ba2fc7d0d1e20de9181a31/viz_gltf_animated.zip b/dev/_downloads/18bb885e92ba2fc7d0d1e20de9181a31/viz_gltf_animated.zip index 83f585565..664b6266a 100644 Binary files a/dev/_downloads/18bb885e92ba2fc7d0d1e20de9181a31/viz_gltf_animated.zip and b/dev/_downloads/18bb885e92ba2fc7d0d1e20de9181a31/viz_gltf_animated.zip differ diff --git a/dev/_downloads/18f7c71044fd9fd6355153b36a44c393/viz_ui_slider.ipynb b/dev/_downloads/18f7c71044fd9fd6355153b36a44c393/viz_ui_slider.ipynb index 887c8b1da..771572ebe 100644 --- a/dev/_downloads/18f7c71044fd9fd6355153b36a44c393/viz_ui_slider.ipynb +++ b/dev/_downloads/18f7c71044fd9fd6355153b36a44c393/viz_ui_slider.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, ui, window\nfrom fury.data import fetch_viz_icons" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "cube = actor.cube(\n centers=np.array([[15, 0, 0]]),\n colors=np.array([[0, 0, 1]]),\n scales=np.array([[20, 20, 20]]),\n directions=np.array([[0, 0, 1]]),\n)" + "cube = fury.actor.cube(\n centers=np.array([[15, 0, 0]]),\n colors=np.array([[0, 0, 1]]),\n scales=np.array([[20, 20, 20]]),\n directions=np.array([[0, 0, 1]]),\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "ring_slider = ui.RingSlider2D(\n center=(630, 400), initial_value=0, text_template=\"{angle:5.1f}\u00b0\"\n)\n\nhor_line_slider_text_top = ui.LineSlider2D(\n center=(400, 230),\n initial_value=0,\n orientation=\"horizontal\",\n min_value=-10,\n max_value=10,\n text_alignment=\"top\",\n)\n\nhor_line_slider_text_bottom = ui.LineSlider2D(\n center=(400, 200),\n initial_value=0,\n orientation=\"horizontal\",\n min_value=-10,\n max_value=10,\n text_alignment=\"bottom\",\n)\n\nver_line_slider_text_left = ui.LineSlider2D(\n center=(100, 400),\n initial_value=0,\n orientation=\"vertical\",\n min_value=-10,\n max_value=10,\n text_alignment=\"left\",\n)\n\nver_line_slider_text_right = ui.LineSlider2D(\n center=(150, 400),\n initial_value=0,\n orientation=\"vertical\",\n min_value=-10,\n max_value=10,\n text_alignment=\"right\",\n)" + "ring_slider = fury.ui.RingSlider2D(\n center=(630, 400), initial_value=0, text_template=\"{angle:5.1f}\u00b0\"\n)\n\nhor_line_slider_text_top = fury.ui.LineSlider2D(\n center=(400, 230),\n initial_value=0,\n orientation=\"horizontal\",\n min_value=-10,\n max_value=10,\n text_alignment=\"top\",\n)\n\nhor_line_slider_text_bottom = fury.ui.LineSlider2D(\n center=(400, 200),\n initial_value=0,\n orientation=\"horizontal\",\n min_value=-10,\n max_value=10,\n text_alignment=\"bottom\",\n)\n\nver_line_slider_text_left = fury.ui.LineSlider2D(\n center=(100, 400),\n initial_value=0,\n orientation=\"vertical\",\n min_value=-10,\n max_value=10,\n text_alignment=\"left\",\n)\n\nver_line_slider_text_right = fury.ui.LineSlider2D(\n center=(150, 400),\n initial_value=0,\n orientation=\"vertical\",\n min_value=-10,\n max_value=10,\n text_alignment=\"right\",\n)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "current_size = (800, 800)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY Cube Example\")\n\nshow_manager.scene.add(cube)\nshow_manager.scene.add(ring_slider)\nshow_manager.scene.add(hor_line_slider_text_top)\nshow_manager.scene.add(hor_line_slider_text_bottom)\nshow_manager.scene.add(ver_line_slider_text_left)\nshow_manager.scene.add(ver_line_slider_text_right)" + "current_size = (800, 800)\nshow_manager = fury.window.ShowManager(size=current_size, title=\"FURY Cube Example\")\n\nshow_manager.scene.add(cube)\nshow_manager.scene.add(ring_slider)\nshow_manager.scene.add(hor_line_slider_text_top)\nshow_manager.scene.add(hor_line_slider_text_bottom)\nshow_manager.scene.add(ver_line_slider_text_left)\nshow_manager.scene.add(ver_line_slider_text_right)" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "show_manager.scene.reset_camera()\nshow_manager.scene.set_camera(position=(0, 0, 150))\nshow_manager.scene.reset_clipping_range()\nshow_manager.scene.azimuth(30)\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, size=current_size, out_path=\"viz_slider.png\")" + "show_manager.scene.reset_camera()\nshow_manager.scene.set_camera(position=(0, 0, 150))\nshow_manager.scene.reset_clipping_range()\nshow_manager.scene.azimuth(30)\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(show_manager.scene, size=current_size, out_path=\"viz_slider.png\")" ] } ], diff --git a/dev/_downloads/199a7841405237aa8309ad1740e8f753/viz_picking.zip b/dev/_downloads/199a7841405237aa8309ad1740e8f753/viz_picking.zip index 39806867e..87108486d 100644 Binary files a/dev/_downloads/199a7841405237aa8309ad1740e8f753/viz_picking.zip and b/dev/_downloads/199a7841405237aa8309ad1740e8f753/viz_picking.zip differ diff --git a/dev/_downloads/1aed981eaa1875aa30849f0d22d80711/viz_gltf_animated.ipynb b/dev/_downloads/1aed981eaa1875aa30849f0d22d80711/viz_gltf_animated.ipynb index 9d26d1d9f..dc661a7f5 100644 --- a/dev/_downloads/1aed981eaa1875aa30849f0d22d80711/viz_gltf_animated.ipynb +++ b/dev/_downloads/1aed981eaa1875aa30849f0d22d80711/viz_gltf_animated.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import window\nfrom fury.data import fetch_gltf, read_viz_gltf\nfrom fury.gltf import glTF" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nshowm.initialize()" + "scene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nshowm.initialize()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "fetch_gltf(\"InterpolationTest\", \"glTF\")\nfilename = read_viz_gltf(\"InterpolationTest\")" + "fury.data.fetch_gltf(\"InterpolationTest\", \"glTF\")\nfilename = fury.data.read_viz_gltf(\"InterpolationTest\")" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "gltf_obj = glTF(filename)\ntimeline = gltf_obj.main_animation()" + "gltf_obj = fury.gltf.glTF(filename)\ntimeline = gltf_obj.main_animation()" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "interactive = False\n\n\ndef timer_callback(_obj, _event):\n timeline.update_animation()\n showm.render()\n\n\nshowm.add_timer_callback(True, 10, timer_callback)\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_gltf_animated.png\", size=(900, 768))" + "interactive = False\n\n\ndef timer_callback(_obj, _event):\n timeline.update_animation()\n showm.render()\n\n\nshowm.add_timer_callback(True, 10, timer_callback)\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_gltf_animated.png\", size=(900, 768))" ] } ], diff --git a/dev/_downloads/1cfb31ae484ad326090029fa173b7e6d/viz_gltf.zip b/dev/_downloads/1cfb31ae484ad326090029fa173b7e6d/viz_gltf.zip index dc134da9c..cd345ce58 100644 Binary files a/dev/_downloads/1cfb31ae484ad326090029fa173b7e6d/viz_gltf.zip and b/dev/_downloads/1cfb31ae484ad326090029fa173b7e6d/viz_gltf.zip differ diff --git a/dev/_downloads/1d951c714c2deed5aafc8e2ac04a3a76/viz_emwave_animation.py b/dev/_downloads/1d951c714c2deed5aafc8e2ac04a3a76/viz_emwave_animation.py index f50632a33..3968f5c24 100644 --- a/dev/_downloads/1d951c714c2deed5aafc8e2ac04a3a76/viz_emwave_animation.py +++ b/dev/_downloads/1d951c714c2deed5aafc8e2ac04a3a76/viz_emwave_animation.py @@ -19,7 +19,7 @@ import numpy as np -from fury import actor, ui, utils, window +import fury ############################################################################### # function that updates and returns the coordinates of the waves which are @@ -66,11 +66,11 @@ def update_coordinates(wavenumber, ang_frq, time, phase_angle): ############################################################################### # Creating a scene object and configuring the camera's position -scene = window.Scene() +scene = fury.window.Scene() scene.set_camera( position=(-6, 5, -10), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0) ) -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(800, 600), reset_camera=True, order_transparent=True ) @@ -82,10 +82,10 @@ def update_coordinates(wavenumber, ang_frq, time, phase_angle): centers = np.array([[3, 0, 0]]) directions = np.array([[-1, 0, 0]]) heights = np.array([6.4]) -arrow_actor = actor.arrow( +arrow_actor = fury.actor.arrow( centers, directions, - window.colors.yellow, + fury.window.colors.yellow, heights, resolution=20, tip_length=0.06, @@ -104,12 +104,12 @@ def update_coordinates(wavenumber, ang_frq, time, phase_angle): pts = np.array(list(zip(x, y, z))) pts = [pts] -colors = window.colors.red -wave_actor1 = actor.line(pts, colors, linewidth=3) +colors = fury.window.colors.red +wave_actor1 = fury.actor.line(pts, colors, linewidth=3) scene.add(wave_actor1) -vertices = utils.vertices_from_actor(wave_actor1) -vcolors = utils.colors_from_actor(wave_actor1, "colors") +vertices = fury.utils.vertices_from_actor(wave_actor1) +vcolors = fury.utils.colors_from_actor(wave_actor1, "colors") no_vertices_per_point = len(vertices) / npoints initial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0) @@ -123,12 +123,12 @@ def update_coordinates(wavenumber, ang_frq, time, phase_angle): pts2 = np.array(list(zip(xx, yy, zz))) pts2 = [pts2] -colors2 = window.colors.blue -wave_actor2 = actor.line(pts2, colors2, linewidth=3) +colors2 = fury.window.colors.blue +wave_actor2 = fury.actor.line(pts2, colors2, linewidth=3) scene.add(wave_actor2) -vertices2 = utils.vertices_from_actor(wave_actor2) -vcolors2 = utils.colors_from_actor(wave_actor2, "colors") +vertices2 = fury.utils.vertices_from_actor(wave_actor2) +vcolors2 = fury.utils.colors_from_actor(wave_actor2, "colors") no_vertices_per_point2 = len(vertices2) / npoints initial_vertices2 = vertices2.copy() - np.repeat(pts2, no_vertices_per_point2, axis=0) @@ -136,7 +136,7 @@ def update_coordinates(wavenumber, ang_frq, time, phase_angle): ############################################################################### # Initializing text box to display the title of the animation -tb = ui.TextBlock2D(bold=True, position=(160, 90)) +tb = fury.ui.TextBlock2D(bold=True, position=(160, 90)) tb.message = "Electromagnetic Wave" scene.add(tb) @@ -164,12 +164,12 @@ def timer_callback(_obj, _event): x, y, z = update_coordinates(wavenumber, angular_frq, phase_angle, time) pts = np.array(list(zip(x, y, z))) vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0) - utils.update_actor(wave_actor1) + fury.utils.update_actor(wave_actor1) xx, zz, yy = update_coordinates(wavenumber, angular_frq, phase_angle, time) pts2 = np.array(list(zip(xx, yy, zz))) vertices2[:] = initial_vertices2 + np.repeat(pts2, no_vertices_per_point2, axis=0) - utils.update_actor(wave_actor2) + fury.utils.update_actor(wave_actor2) showm.render() @@ -186,4 +186,4 @@ def timer_callback(_obj, _event): interactive = False if interactive: showm.start() -window.record(showm.scene, size=(800, 600), out_path="viz_emwave.png") +fury.window.record(showm.scene, size=(800, 600), out_path="viz_emwave.png") diff --git a/dev/_downloads/1df8e277ac4cffc66aae9d565b9aa134/viz_multithread.ipynb b/dev/_downloads/1df8e277ac4cffc66aae9d565b9aa134/viz_multithread.ipynb index 2cb94ec85..7d91ec7f6 100644 --- a/dev/_downloads/1df8e277ac4cffc66aae9d565b9aa134/viz_multithread.ipynb +++ b/dev/_downloads/1df8e277ac4cffc66aae9d565b9aa134/viz_multithread.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from threading import Thread\nimport time\n\nimport numpy as np\n\nfrom fury import actor, ui, window\n\n# Preparing to draw some spheres\nxyz = 10 * (np.random.random((100, 3)) - 0.5)\ncolors = np.random.random((100, 4))\nradii = np.random.random(100) + 0.5\n\nscene = window.Scene()\nsphere_actor = actor.sphere(\n centers=xyz, colors=colors, radii=radii, use_primitive=False\n)\nscene.add(sphere_actor)\n\n\n# Preparing the show manager as usual\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n# showm.initialize()\n\n# Creating a text block to show a message and reset the camera\ntb = ui.TextBlock2D(bold=True)\nscene.add(tb)\nscene.ResetCamera()\n\n\n# Create a function to print a counter to the console\ndef print_counter():\n print(\"\")\n for i in range(100):\n print(\"\\rCounter: %d\" % i, end=\"\")\n message = \"Let's count up to 100 and exit :\" + str(i + 1)\n tb.message = message\n time.sleep(0.05)\n if showm.is_done():\n break\n showm.exit()\n print(\"\")\n\n\n# Create a function to rotate the camera\n\n\ndef rotate_camera():\n for i in range(100):\n if showm.lock_current():\n scene.azimuth(0.01 * i)\n showm.release_current()\n time.sleep(0.05)\n else:\n break\n\n\n# Create a function to add or remove the axes and increase its scale\n\n\ndef add_remove_axes():\n current_axes = None\n for i in range(100):\n if showm.lock_current():\n if current_axes is None:\n current_axes = actor.axes(scale=(0.20 * i, 0.20 * i, 0.20 * i))\n scene.add(current_axes)\n pass\n else:\n scene.rm(current_axes)\n current_axes = None\n pass\n showm.release_current()\n time.sleep(0.1)\n else:\n break\n\n\n# Start the threads\n# Multiple threads can be started here\n# First, one to rotate the camera\nthread_a = Thread(target=rotate_camera)\nthread_a.start()\n\n# Now let's start a thread that will print a counter\nthread_b = Thread(target=print_counter)\nthread_b.start()\n\n# Now let's start a thread that will add or remove axes\nthread_c = Thread(target=add_remove_axes)\nthread_c.start()\n\n# Let's start the show manager loop with multithreading option\nshowm.start(multithreaded=True)\n\n# Wait for the threads to finish\nthread_a.join()\nthread_b.join()\nthread_c.join()" + "from threading import Thread\nimport time\n\nimport numpy as np\n\nimport fury\n\n# Preparing to draw some spheres\nxyz = 10 * (np.random.random((100, 3)) - 0.5)\ncolors = np.random.random((100, 4))\nradii = np.random.random(100) + 0.5\n\nscene = fury.window.Scene()\nsphere_actor = fury.actor.sphere(\n centers=xyz, colors=colors, radii=radii, use_primitive=False\n)\nscene.add(sphere_actor)\n\n\n# Preparing the show manager as usual\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n# showm.initialize()\n\n# Creating a text block to show a message and reset the camera\ntb = fury.ui.TextBlock2D(bold=True)\nscene.add(tb)\nscene.ResetCamera()\n\n\n# Create a function to print a counter to the console\ndef print_counter():\n print(\"\")\n for i in range(100):\n print(\"\\rCounter: %d\" % i, end=\"\")\n message = \"Let's count up to 100 and exit :\" + str(i + 1)\n tb.message = message\n time.sleep(0.05)\n if showm.is_done():\n break\n showm.exit()\n print(\"\")\n\n\n# Create a function to rotate the camera\n\n\ndef rotate_camera():\n for i in range(100):\n if showm.lock_current():\n scene.azimuth(0.01 * i)\n showm.release_current()\n time.sleep(0.05)\n else:\n break\n\n\n# Create a function to add or remove the axes and increase its scale\n\n\ndef add_remove_axes():\n current_axes = None\n for i in range(100):\n if showm.lock_current():\n if current_axes is None:\n current_axes = fury.actor.axes(scale=(0.20 * i, 0.20 * i, 0.20 * i))\n scene.add(current_axes)\n pass\n else:\n scene.rm(current_axes)\n current_axes = None\n pass\n showm.release_current()\n time.sleep(0.1)\n else:\n break\n\n\n# Start the threads\n# Multiple threads can be started here\n# First, one to rotate the camera\nthread_a = Thread(target=rotate_camera)\nthread_a.start()\n\n# Now let's start a thread that will print a counter\nthread_b = Thread(target=print_counter)\nthread_b.start()\n\n# Now let's start a thread that will add or remove axes\nthread_c = Thread(target=add_remove_axes)\nthread_c.start()\n\n# Let's start the show manager loop with multithreading option\nshowm.start(multithreaded=True)\n\n# Wait for the threads to finish\nthread_a.join()\nthread_b.join()\nthread_c.join()" ] } ], diff --git a/dev/_downloads/1f2a0133ff341c45a56267c519c83862/viz_network.zip b/dev/_downloads/1f2a0133ff341c45a56267c519c83862/viz_network.zip index fc37d54c1..85fbe5ddd 100644 Binary files a/dev/_downloads/1f2a0133ff341c45a56267c519c83862/viz_network.zip and b/dev/_downloads/1f2a0133ff341c45a56267c519c83862/viz_network.zip differ diff --git a/dev/_downloads/1fb737e1ab95496149474d61f7c61fef/viz_brick_wall.zip b/dev/_downloads/1fb737e1ab95496149474d61f7c61fef/viz_brick_wall.zip index e5444205f..587f5bfcc 100644 Binary files a/dev/_downloads/1fb737e1ab95496149474d61f7c61fef/viz_brick_wall.zip and b/dev/_downloads/1fb737e1ab95496149474d61f7c61fef/viz_brick_wall.zip differ diff --git a/dev/_downloads/2340ac441d0bbb69818b33bbf7e60075/viz_selection.ipynb b/dev/_downloads/2340ac441d0bbb69818b33bbf7e60075/viz_selection.ipynb index 443078bb2..3c1ace42f 100644 --- a/dev/_downloads/2340ac441d0bbb69818b33bbf7e60075/viz_selection.ipynb +++ b/dev/_downloads/2340ac441d0bbb69818b33bbf7e60075/viz_selection.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, pick, utils, window" + "import numpy as np\n\nimport fury" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()" + "scene = fury.window.Scene()" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "cube_actor = actor.cube(centers, directions=(1, 0, 0), colors=colors, scales=radii)" + "cube_actor = fury.actor.cube(centers, directions=(1, 0, 0), colors=colors, scales=radii)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "vertices = utils.vertices_from_actor(cube_actor)\nnum_vertices = vertices.shape[0]\nnum_objects = centers.shape[0]" + "vertices = fury.utils.vertices_from_actor(cube_actor)\nnum_vertices = vertices.shape[0]\nnum_objects = centers.shape[0]" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "vcolors = utils.colors_from_actor(cube_actor, \"colors\")" + "vcolors = fury.utils.colors_from_actor(cube_actor, \"colors\")" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "rgba = 255 * np.ones((100, 200, 4))\nrgba[1:-1, 1:-1] = np.zeros((98, 198, 4)) + 100\ntexa = actor.texture_2d(rgba.astype(np.uint8))\n\nscene.add(cube_actor)\nscene.add(texa)\nscene.reset_camera()\nscene.zoom(3.0)" + "rgba = 255 * np.ones((100, 200, 4))\nrgba[1:-1, 1:-1] = np.zeros((98, 198, 4)) + 100\ntexa = fury.actor.texture_2d(rgba.astype(np.uint8))\n\nscene.add(cube_actor)\nscene.add(texa)\nscene.reset_camera()\nscene.zoom(3.0)" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "selm = pick.SelectionManager(select=\"faces\")" + "selm = fury.pick.SelectionManager(select=\"faces\")" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "def hover_callback(_obj, _event):\n event_pos = selm.event_position(showm.iren)\n # updates rectangular box around mouse\n texa.SetPosition(event_pos[0] - 200 // 2, event_pos[1] - 100 // 2)\n\n # defines selection region and returns information from selected objects\n info = selm.select(event_pos, showm.scene, (200 // 2, 100 // 2))\n for node in info.keys():\n if info[node][\"face\"] is not None:\n if info[node][\"actor\"] is cube_actor:\n for face_index in info[node][\"face\"]:\n # generates an object_index to help with coloring\n # by dividing by the number of faces of each cube (6 * 2)\n object_index = face_index // 12\n sec = int(num_vertices / num_objects)\n color_change = np.array([150, 0, 0, 255], dtype=\"uint8\")\n vcolors[object_index * sec : object_index * sec + sec] = (\n color_change\n )\n utils.update_actor(cube_actor)\n showm.render()" + "def hover_callback(_obj, _event):\n event_pos = selm.event_position(showm.iren)\n # updates rectangular box around mouse\n texa.SetPosition(event_pos[0] - 200 // 2, event_pos[1] - 100 // 2)\n\n # defines selection region and returns information from selected objects\n info = selm.select(event_pos, showm.scene, (200 // 2, 100 // 2))\n for node in info.keys():\n if info[node][\"face\"] is not None:\n if info[node][\"actor\"] is cube_actor:\n for face_index in info[node][\"face\"]:\n # generates an object_index to help with coloring\n # by dividing by the number of faces of each cube (6 * 2)\n object_index = face_index // 12\n sec = int(num_vertices / num_objects)\n color_change = np.array([150, 0, 0, 255], dtype=\"uint8\")\n vcolors[object_index * sec : object_index * sec + sec] = (\n color_change\n )\n fury.utils.update_actor(cube_actor)\n showm.render()" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(\n scene, size=(1024, 768), order_transparent=True, reset_camera=False\n)" + "showm = fury.window.ShowManager(\n scene, size=(1024, 768), order_transparent=True, reset_camera=False\n)" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "window.record(showm.scene, size=(1024, 768), out_path=\"viz_selection.png\")" + "fury.window.record(showm.scene, size=(1024, 768), out_path=\"viz_selection.png\")" ] } ], diff --git a/dev/_downloads/243115b8109a8fe07f4e77ba5e473042/viz_gltf.py b/dev/_downloads/243115b8109a8fe07f4e77ba5e473042/viz_gltf.py index 8d1c50ca4..dbf668e82 100644 --- a/dev/_downloads/243115b8109a8fe07f4e77ba5e473042/viz_gltf.py +++ b/dev/_downloads/243115b8109a8fe07f4e77ba5e473042/viz_gltf.py @@ -5,20 +5,18 @@ In this tutorial, we will show how to display a glTF file in a scene. """ -from fury import window -from fury.data import fetch_gltf, read_viz_gltf -from fury.gltf import glTF +import fury ############################################################################## # Create a scene. -scene = window.Scene() +scene = fury.window.Scene() scene.SetBackground(0.1, 0.1, 0.4) ############################################################################## # Retrieving the gltf model. -fetch_gltf("Duck", "glTF") -filename = read_viz_gltf("Duck") +fury.data.fetch_gltf("Duck", "glTF") +filename = fury.data.read_viz_gltf("Duck") ############################################################################## # Initialize the glTF object and get actors using `actors` method. @@ -26,7 +24,7 @@ # or materials manually afterwards. # Experimental: For smooth mesh/actor you can set `apply_normals=True`. -gltf_obj = glTF(filename, apply_normals=False) +gltf_obj = fury.gltf.glTF(filename, apply_normals=False) actors = gltf_obj.actors() ############################################################################## @@ -44,6 +42,6 @@ interactive = False if interactive: - window.show(scene, size=(1280, 720)) + fury.window.show(scene, size=(1280, 720)) -window.record(scene, out_path="viz_gltf.png", size=(1280, 720)) +fury.window.record(scene, out_path="viz_gltf.png", size=(1280, 720)) diff --git a/dev/_downloads/245bd5cc0efc250ae0c363790023423e/viz_helical_motion.ipynb b/dev/_downloads/245bd5cc0efc250ae0c363790023423e/viz_helical_motion.ipynb index 19f68a306..993440217 100644 --- a/dev/_downloads/245bd5cc0efc250ae0c363790023423e/viz_helical_motion.ipynb +++ b/dev/_downloads/245bd5cc0efc250ae0c363790023423e/viz_helical_motion.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, ui, utils, window" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.zoom(1.2)\nscene.set_camera(\n position=(10, 12.5, 19), focal_point=(3.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n)\nshowm = window.ShowManager(\n scene, size=(800, 600), reset_camera=True, order_transparent=True\n)" + "scene = fury.window.Scene()\nscene.zoom(1.2)\nscene.set_camera(\n position=(10, 12.5, 19), focal_point=(3.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n)\nshowm = fury.window.ShowManager(\n scene, size=(800, 600), reset_camera=True, order_transparent=True\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "color_arrow = window.colors.blue # color of the arrow can be manipulated\ncenters = np.array([[0, 0, 0]])\ndirections = np.array([[1, 0, 0]])\nheights = np.array([8])\narrow_actor = actor.arrow(\n centers,\n directions,\n color_arrow,\n heights,\n resolution=20,\n tip_length=0.06,\n tip_radius=0.012,\n shaft_radius=0.005,\n)\nscene.add(arrow_actor)" + "color_arrow = fury.window.colors.blue # color of the arrow can be manipulated\ncenters = np.array([[0, 0, 0]])\ndirections = np.array([[1, 0, 0]])\nheights = np.array([8])\narrow_actor = fury.actor.arrow(\n centers,\n directions,\n color_arrow,\n heights,\n resolution=20,\n tip_length=0.06,\n tip_radius=0.012,\n shaft_radius=0.005,\n)\nscene.add(arrow_actor)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "color_particle = window.colors.red # color of particle can be manipulated\npts = np.array([[x, y, z]])\ncharge_actor = actor.point(pts, color_particle, point_radius=radius_particle)\nscene.add(charge_actor)\n\nvertices = utils.vertices_from_actor(charge_actor)\nvcolors = utils.colors_from_actor(charge_actor, \"colors\")\nno_vertices_per_point = len(vertices)\ninitial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0)" + "color_particle = fury.window.colors.red # color of particle can be manipulated\npts = np.array([[x, y, z]])\ncharge_actor = fury.actor.point(pts, color_particle, point_radius=radius_particle)\nscene.add(charge_actor)\n\nvertices = fury.utils.vertices_from_actor(charge_actor)\nvcolors = fury.utils.colors_from_actor(charge_actor, \"colors\")\nno_vertices_per_point = len(vertices)\ninitial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "tb = ui.TextBlock2D(bold=True, position=(100, 90))\nm1 = \"Motion of a charged particle in a \"\nm2 = \"combined electric and magnetic field\"\ntb.message = m1 + m2\nscene.add(tb)" + "tb = fury.ui.TextBlock2D(bold=True, position=(100, 90))\nm1 = \"Motion of a charged particle in a \"\nm2 = \"combined electric and magnetic field\"\ntb.message = m1 + m2\nscene.add(tb)" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "def timer_callback(_obj, _event):\n global pts, time, incre_time, coor_1\n time += incre_time\n cnt = next(counter)\n\n x = initial_velocity * time + 0.5 * acc * (time**2)\n y = np.sin(10 * angular_frq * time + phase_angle)\n z = np.cos(10 * angular_frq * time + phase_angle)\n pts = np.array([[x, y, z]])\n\n vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0)\n\n utils.update_actor(charge_actor)\n\n # Plotting the path followed by the particle\n coor_2 = np.array([x, y, z])\n coors = np.array([coor_1, coor_2])\n coors = [coors]\n line_actor = actor.line(coors, window.colors.cyan, linewidth=3)\n scene.add(line_actor)\n coor_1 = coor_2\n\n showm.render()\n\n # to end the animation\n if cnt == end:\n showm.exit()" + "def timer_callback(_obj, _event):\n global pts, time, incre_time, coor_1\n time += incre_time\n cnt = next(counter)\n\n x = initial_velocity * time + 0.5 * acc * (time**2)\n y = np.sin(10 * angular_frq * time + phase_angle)\n z = np.cos(10 * angular_frq * time + phase_angle)\n pts = np.array([[x, y, z]])\n\n vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0)\n\n fury.utils.update_actor(charge_actor)\n\n # Plotting the path followed by the particle\n coor_2 = np.array([x, y, z])\n coors = np.array([coor_1, coor_2])\n coors = [coors]\n line_actor = fury.actor.line(coors, fury.window.colors.cyan, linewidth=3)\n scene.add(line_actor)\n coor_1 = coor_2\n\n showm.render()\n\n # to end the animation\n if cnt == end:\n showm.exit()" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 15, timer_callback)\nshowm.start()\nwindow.record(showm.scene, size=(800, 600), out_path=\"viz_helical_motion.png\")" + "showm.add_timer_callback(True, 15, timer_callback)\nshowm.start()\nfury.window.record(showm.scene, size=(800, 600), out_path=\"viz_helical_motion.png\")" ] } ], diff --git a/dev/_downloads/2487956207605b03f0b4f341a38e0722/viz_fine_tuning_gl_context.ipynb b/dev/_downloads/2487956207605b03f0b4f341a38e0722/viz_fine_tuning_gl_context.ipynb index c0f7ff5eb..7fdc47b43 100644 --- a/dev/_downloads/2487956207605b03f0b4f341a38e0722/viz_fine_tuning_gl_context.ipynb +++ b/dev/_downloads/2487956207605b03f0b4f341a38e0722/viz_fine_tuning_gl_context.ipynb @@ -22,7 +22,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, window\nfrom fury.shaders import shader_apply_effects\nfrom fury.utils import remove_observer_from_actor" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -40,7 +40,7 @@ }, "outputs": [], "source": [ - "centers = np.array([[0, 0, 0], [-0.1, 0, 0], [0.1, 0, 0]])\ncolors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n\nactor_no_depth_test = actor.markers(\n centers,\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\nactor_normal_blending = actor.markers(\n centers - np.array([[0, -0.5, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\nactor_add_blending = actor.markers(\n centers - np.array([[0, -1, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\n\nactor_sub_blending = actor.markers(\n centers - np.array([[0, -1.5, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\nactor_mul_blending = actor.markers(\n centers - np.array([[0, -2, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\n\n\nscene = window.Scene()\n\n\nscene.background((0.5, 0.5, 0.5))\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=False\n)" + "centers = np.array([[0, 0, 0], [-0.1, 0, 0], [0.1, 0, 0]])\ncolors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n\nactor_no_depth_test = fury.actor.markers(\n centers,\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\nactor_normal_blending = fury.actor.markers(\n centers - np.array([[0, -0.5, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\nactor_add_blending = fury.actor.markers(\n centers - np.array([[0, -1, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\n\nactor_sub_blending = fury.actor.markers(\n centers - np.array([[0, -1.5, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\nactor_mul_blending = fury.actor.markers(\n centers - np.array([[0, -2, 0]]),\n marker=\"s\",\n colors=colors,\n marker_opacity=0.5,\n scales=0.2,\n)\n\n\nscene = fury.window.Scene()\n\n\nscene.background((0.5, 0.5, 0.5))\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=False\n)" ] }, { @@ -76,7 +76,7 @@ }, "outputs": [], "source": [ - "shader_apply_effects(\n showm.window, actor_normal_blending, effects=window.gl_set_normal_blending\n)\n\n# ###############################################################################\n# It's also possible use a list of effects. The final opengl state it'll\n# be the composition of each effect that each function has in the opengl state\n\nid_observer = shader_apply_effects(\n showm.window,\n actor_no_depth_test,\n effects=[window.gl_reset_blend, window.gl_disable_blend, window.gl_disable_depth],\n)\n\nshader_apply_effects(\n showm.window,\n actor_add_blending,\n effects=[\n window.gl_reset_blend,\n window.gl_enable_depth,\n window.gl_set_additive_blending,\n ],\n)\n\nshader_apply_effects(\n showm.window, actor_sub_blending, effects=window.gl_set_subtractive_blending\n)\n\nshader_apply_effects(\n showm.window, actor_mul_blending, effects=window.gl_set_multiplicative_blending\n)" + "fury.shaders.shader_apply_effects(\n showm.window, actor_normal_blending, effects=fury.window.gl_set_normal_blending\n)\n\n# ###############################################################################\n# It's also possible use a list of effects. The final opengl state it'll\n# be the composition of each effect that each function has in the opengl state\n\nid_observer = fury.shaders.shader_apply_effects(\n showm.window,\n actor_no_depth_test,\n effects=[\n fury.window.gl_reset_blend,\n fury.window.gl_disable_blend,\n fury.window.gl_disable_depth,\n ],\n)\n\nfury.shaders.shader_apply_effects(\n showm.window,\n actor_add_blending,\n effects=[\n fury.window.gl_reset_blend,\n fury.window.gl_enable_depth,\n fury.window.gl_set_additive_blending,\n ],\n)\n\nfury.shaders.shader_apply_effects(\n showm.window, actor_sub_blending, effects=fury.window.gl_set_subtractive_blending\n)\n\nfury.shaders.shader_apply_effects(\n showm.window, actor_mul_blending, effects=fury.window.gl_set_multiplicative_blending\n)" ] }, { @@ -94,7 +94,7 @@ }, "outputs": [], "source": [ - "counter = itertools.count()\n\n# After some steps we will remove the no_depth_test effect\n\n\ndef timer_callback(obj, event):\n cnt = next(counter)\n showm.render()\n # we will rotate the visualization just to help you to see\n # the results of each specific opengl-state\n showm.scene.azimuth(1)\n if cnt == 400:\n remove_observer_from_actor(actor_no_depth_test, id_observer)\n shader_apply_effects(\n showm.window, actor_no_depth_test, effects=window.gl_set_additive_blending\n )\n if cnt == 1000:\n showm.exit()\n\n\ninteractive = False\nshowm.add_timer_callback(interactive, 5, timer_callback)\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_fine_tuning_gl_context.png\", size=(600, 600))" + "counter = itertools.count()\n\n# After some steps we will remove the no_depth_test effect\n\n\ndef timer_callback(obj, event):\n cnt = next(counter)\n showm.render()\n # we will rotate the visualization just to help you to see\n # the results of each specific opengl-state\n showm.scene.azimuth(1)\n if cnt == 400:\n fury.utils.remove_observer_from_actor(actor_no_depth_test, id_observer)\n fury.shaders.shader_apply_effects(\n showm.window,\n actor_no_depth_test,\n effects=fury.window.gl_set_additive_blending,\n )\n if cnt == 1000:\n showm.exit()\n\n\ninteractive = False\nshowm.add_timer_callback(interactive, 5, timer_callback)\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_fine_tuning_gl_context.png\", size=(600, 600))" ] } ], diff --git a/dev/_downloads/29cddb7ad3c81ce7a762e6a514af5ebc/viz_skinning.py b/dev/_downloads/29cddb7ad3c81ce7a762e6a514af5ebc/viz_skinning.py index 0657e0b1d..010fbbf1b 100644 --- a/dev/_downloads/29cddb7ad3c81ce7a762e6a514af5ebc/viz_skinning.py +++ b/dev/_downloads/29cddb7ad3c81ce7a762e6a514af5ebc/viz_skinning.py @@ -6,22 +6,20 @@ glTF model in FURY. """ -from fury import window -from fury.data import fetch_gltf, read_viz_gltf -from fury.gltf import glTF +import fury ############################################################################## # Retrieving the model with skeletal animations. # We're choosing the `RiggedFigure` model here. -fetch_gltf("RiggedFigure", "glTF") -filename = read_viz_gltf("RiggedFigure") +fury.data.fetch_gltf("RiggedFigure", "glTF") +filename = fury.data.read_viz_gltf("RiggedFigure") ############################################################################## # Initializing the glTF object, You can additionally set `apply_normals=True`. # Note: Normals might not work well as intended with skinning animations. -gltf_obj = glTF(filename, apply_normals=False) +gltf_obj = fury.gltf.glTF(filename, apply_normals=False) ############################################################################## # Get the skinning timeline using `skin_timeline` method, Choose the animation @@ -43,8 +41,8 @@ # Initialize the show manager and add timeline to the scene (No need to add # actors to the scene separately). -scene = window.Scene() -showm = window.ShowManager( +scene = fury.window.Scene() +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=True, order_transparent=True ) showm.initialize() @@ -73,4 +71,4 @@ def timer_callback(_obj, _event): if interactive: showm.start() -window.record(scene, out_path="viz_skinning.png", size=(900, 768)) +fury.window.record(scene, out_path="viz_skinning.png", size=(900, 768)) diff --git a/dev/_downloads/2a3ba48d37afb1f863bee6f45c238d1c/viz_earth_coordinates.py b/dev/_downloads/2a3ba48d37afb1f863bee6f45c238d1c/viz_earth_coordinates.py index 3c3c10eec..6b5abd564 100644 --- a/dev/_downloads/2a3ba48d37afb1f863bee6f45c238d1c/viz_earth_coordinates.py +++ b/dev/_downloads/2a3ba48d37afb1f863bee6f45c238d1c/viz_earth_coordinates.py @@ -12,28 +12,27 @@ import numpy as np -from fury import actor, io, utils, window -from fury.data import fetch_viz_textures, read_viz_textures +import fury ############################################################################### # Create a new scene, and load in the image of the Earth using # ``fetch_viz_textures`` and ``read_viz_textures``. We will use a 16k # resolution texture for maximum detail. -scene = window.Scene() +scene = fury.window.Scene() -fetch_viz_textures() -earth_file = read_viz_textures("1_earth_16k.jpg") -earth_image = io.load_image(earth_file) -earth_actor = actor.texture_on_sphere(earth_image) +fury.data.fetch_viz_textures() +earth_file = fury.data.read_viz_textures("1_earth_16k.jpg") +earth_image = fury.io.load_image(earth_file) +earth_actor = fury.actor.texture_on_sphere(earth_image) scene.add(earth_actor) ############################################################################### # Rotate the Earth to make sure the texture is correctly oriented. Change it's # scale using ``actor.SetScale()``. -utils.rotate(earth_actor, (-90, 1, 0, 0)) -utils.rotate(earth_actor, (180, 0, 1, 0)) +fury.utils.rotate(earth_actor, (-90, 1, 0, 0)) +fury.utils.rotate(earth_actor, (180, 0, 1, 0)) earth_actor.SetScale(2, 2, 2) ############################################################################### @@ -73,40 +72,40 @@ def latlong_coordinates(lat, lon): centers = np.array([[*locationone], [*locationtwo], [*locationthree]]) colors = np.random.rand(3, 3) radii = np.array([0.005, 0.005, 0.005]) -sphere_actor = actor.sphere(centers, colors, radii) +sphere_actor = fury.actor.sphere(centers, colors, radii) scene.add(sphere_actor) ############################################################################### # Create some text actors to add to the scene indicating each location and its # geographical coordinates. -nyc_actor = actor.text_3d( +nyc_actor = fury.actor.text_3d( "New York City, New York\n40.7128° N, 74.0060° W", (locationone[0] - 0.04, locationone[1], locationone[2] + 0.07), - window.colors.white, + fury.window.colors.white, 0.01, ) -paris_actor = actor.text_3d( +paris_actor = fury.actor.text_3d( "Paris, France\n48.8566° N, 2.3522° E", (locationthree[0] - 0.04, locationthree[1], locationthree[2] - 0.07), - window.colors.white, + fury.window.colors.white, 0.01, ) -beijing_actor = actor.text_3d( +beijing_actor = fury.actor.text_3d( "Beijing, China\n39.9042° N, 116.4074° E", (locationtwo[0] - 0.06, locationtwo[1], locationtwo[2] - 0.07), - window.colors.white, + fury.window.colors.white, 0.01, ) -utils.rotate(paris_actor, (85, 0, 1, 0)) -utils.rotate(beijing_actor, (180, 0, 1, 0)) -utils.rotate(nyc_actor, (5, 1, 0, 0)) +fury.utils.rotate(paris_actor, (85, 0, 1, 0)) +fury.utils.rotate(beijing_actor, (180, 0, 1, 0)) +fury.utils.rotate(nyc_actor, (5, 1, 0, 0)) ############################################################################## # Create a ShowManager object, which acts as the interface between the scene, # the window and the interactor. -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) @@ -157,4 +156,4 @@ def timer_callback(_obj, _event): showm.add_timer_callback(True, 25, timer_callback) showm.start() -window.record(showm.scene, size=(900, 768), out_path="viz_earth_coordinates.png") +fury.window.record(showm.scene, size=(900, 768), out_path="viz_earth_coordinates.png") diff --git a/dev/_downloads/2a610242af9c8f9082b55166f2e1dfcb/viz_play_video.py b/dev/_downloads/2a610242af9c8f9082b55166f2e1dfcb/viz_play_video.py index 920d2b1a7..dde63d78d 100644 --- a/dev/_downloads/2a610242af9c8f9082b55166f2e1dfcb/viz_play_video.py +++ b/dev/_downloads/2a610242af9c8f9082b55166f2e1dfcb/viz_play_video.py @@ -12,7 +12,7 @@ import cv2 import numpy as np -from fury import actor, window +import fury # The VideoCapturer Class @@ -48,16 +48,16 @@ def __init__(self, video, time=10): # Initialize Scene self.initialize_scene() # Create a Show Manager and Initialize it - self.show_manager = window.ShowManager( + self.show_manager = fury.window.ShowManager( self.scene, size=(900, 768), reset_camera=False, order_transparent=True ) # Initialize the Scene with actors def initialize_scene(self): - self.scene = window.Scene() + self.scene = fury.window.Scene() # Initialize a Plane actor with the 1st video frame along with # the actor grid which is to be updated in each iteration - self.plane_actor = actor.texture(self.current_video_frame) + self.plane_actor = fury.actor.texture(self.current_video_frame) self.scene.add(self.plane_actor) # The timer_callback function getting called by the show manager @@ -66,7 +66,7 @@ def timer_callback(self, _obj, _event): if isinstance(self.current_video_frame, np.ndarray): # update texture of the actor with the current frame image # by updating the actor grid - actor.texture_update(self.plane_actor, self.current_video_frame) + fury.actor.texture_update(self.plane_actor, self.current_video_frame) self.show_manager.scene.azimuth(1.5) # to rotate the camera else: self.show_manager.exit() @@ -90,4 +90,6 @@ def run(self): ) vp = VideoPlayer(video_url) vp.run() -window.record(vp.show_manager.scene, out_path="viz_play_video.png", size=(600, 600)) +fury.window.record( + vp.show_manager.scene, out_path="viz_play_video.png", size=(600, 600) +) diff --git a/dev/_downloads/2a80c6f487fd97ce4ed51a3def47d5c5/viz_arrow.zip b/dev/_downloads/2a80c6f487fd97ce4ed51a3def47d5c5/viz_arrow.zip index 12c3d2b7c..355aeb662 100644 Binary files a/dev/_downloads/2a80c6f487fd97ce4ed51a3def47d5c5/viz_arrow.zip and b/dev/_downloads/2a80c6f487fd97ce4ed51a3def47d5c5/viz_arrow.zip differ diff --git a/dev/_downloads/2bd62c3dc173defac33d1574f7b7e85f/viz_principled_spheres.zip b/dev/_downloads/2bd62c3dc173defac33d1574f7b7e85f/viz_principled_spheres.zip index 0123f42fd..a82f14823 100644 Binary files a/dev/_downloads/2bd62c3dc173defac33d1574f7b7e85f/viz_principled_spheres.zip and b/dev/_downloads/2bd62c3dc173defac33d1574f7b7e85f/viz_principled_spheres.zip differ diff --git a/dev/_downloads/2ce5a3331efbae4a6fa22a8011311a6c/viz_ui_listbox.py b/dev/_downloads/2ce5a3331efbae4a6fa22a8011311a6c/viz_ui_listbox.py index c89335662..146d147b6 100644 --- a/dev/_downloads/2ce5a3331efbae4a6fa22a8011311a6c/viz_ui_listbox.py +++ b/dev/_downloads/2ce5a3331efbae4a6fa22a8011311a6c/viz_ui_listbox.py @@ -10,21 +10,20 @@ First, a bunch of imports. """ -from fury import ui, window -from fury.data import fetch_viz_icons +import fury ############################################################################## # First we need to fetch some icons that are included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ############################################################################### # Create some text blocks that will be shown when # list elements will be selected -welcome_text = ui.TextBlock2D(text="Welcome", font_size=30, position=(500, 400)) -bye_text = ui.TextBlock2D(text="Bye", font_size=30, position=(500, 400)) -fury_text = ui.TextBlock2D(text="Fury", font_size=30, position=(500, 400)) +welcome_text = fury.ui.TextBlock2D(text="Welcome", font_size=30, position=(500, 400)) +bye_text = fury.ui.TextBlock2D(text="Bye", font_size=30, position=(500, 400)) +fury_text = fury.ui.TextBlock2D(text="Fury", font_size=30, position=(500, 400)) example = [welcome_text, bye_text, fury_text] @@ -43,7 +42,7 @@ def hide_all_examples(): # Create ListBox with the values as parameter. values = ["Welcome", "Bye", "Fury"] -listbox = ui.ListBox2D( +listbox = fury.ui.ListBox2D( values=values, position=(10, 300), size=(200, 200), multiselection=False ) @@ -64,7 +63,9 @@ def display_element(): # manager. current_size = (800, 800) -show_manager = window.ShowManager(size=current_size, title="FURY UI ListBox_Example") +show_manager = fury.window.ShowManager( + size=current_size, title="FURY UI ListBox_Example" +) show_manager.scene.add(listbox) show_manager.scene.add(welcome_text) @@ -75,4 +76,4 @@ def display_element(): if interactive: show_manager.start() -window.record(show_manager.scene, size=current_size, out_path="viz_listbox.png") +fury.window.record(show_manager.scene, size=current_size, out_path="viz_listbox.png") diff --git a/dev/_downloads/2de0bed322a00b4125717dc163046a03/viz_radio_buttons.zip b/dev/_downloads/2de0bed322a00b4125717dc163046a03/viz_radio_buttons.zip index 3c759c72d..a372946a3 100644 Binary files a/dev/_downloads/2de0bed322a00b4125717dc163046a03/viz_radio_buttons.zip and b/dev/_downloads/2de0bed322a00b4125717dc163046a03/viz_radio_buttons.zip differ diff --git a/dev/_downloads/2decacedc22bce2e3bf5f9ae62b3687a/viz_interaction.zip b/dev/_downloads/2decacedc22bce2e3bf5f9ae62b3687a/viz_interaction.zip index 3bd915fb7..c8c993991 100644 Binary files a/dev/_downloads/2decacedc22bce2e3bf5f9ae62b3687a/viz_interaction.zip and b/dev/_downloads/2decacedc22bce2e3bf5f9ae62b3687a/viz_interaction.zip differ diff --git a/dev/_downloads/2ee6af1d676ac045ad09ea8ee0fe3271/viz_spline_interpolator.py b/dev/_downloads/2ee6af1d676ac045ad09ea8ee0fe3271/viz_spline_interpolator.py index c5ca86344..eff208200 100644 --- a/dev/_downloads/2ee6af1d676ac045ad09ea8ee0fe3271/viz_spline_interpolator.py +++ b/dev/_downloads/2ee6af1d676ac045ad09ea8ee0fe3271/viz_spline_interpolator.py @@ -8,13 +8,11 @@ import numpy as np -from fury import actor, window -from fury.animation import Animation, Timeline -from fury.animation.interpolator import spline_interpolator +import fury -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) @@ -33,15 +31,15 @@ ############################################################################### # creating FURY dots to visualize the position values. -pos_dots = actor.dot(np.array(list(position_keyframes.values()))) +pos_dots = fury.actor.dot(np.array(list(position_keyframes.values()))) ############################################################################### # creating two timelines (one uses linear and the other uses' spline # interpolator), each timeline controls a sphere actor -sphere_linear = actor.sphere(np.array([[0, 0, 0]]), (1, 0.5, 0.2), 0.5) +sphere_linear = fury.actor.sphere(np.array([[0, 0, 0]]), (1, 0.5, 0.2), 0.5) -linear_anim = Animation() +linear_anim = fury.animation.Animation() linear_anim.add_actor(sphere_linear) linear_anim.set_position_keyframes(position_keyframes) @@ -53,13 +51,13 @@ ############################################################################### # creating a second timeline that translates another larger sphere actor using # spline interpolator. -sphere_spline = actor.sphere(np.array([[0, 0, 0]]), (0.3, 0.9, 0.6), 1) -spline_anim = Animation(sphere_spline) +sphere_spline = fury.actor.sphere(np.array([[0, 0, 0]]), (0.3, 0.9, 0.6), 1) +spline_anim = fury.animation.Animation(sphere_spline) spline_anim.set_position_keyframes(position_keyframes) ############################################################################### # Setting 5th degree spline interpolator for position keyframes. -spline_anim.set_position_interpolator(spline_interpolator, degree=5) +spline_anim.set_position_interpolator(fury.animation.spline_interpolator, degree=5) ############################################################################### # Wrapping animations up! @@ -69,7 +67,7 @@ ############################################################################### # First we create a timeline with a playback panel: -timeline = Timeline(playback_panel=True) +timeline = fury.animation.Timeline(playback_panel=True) ############################################################################### # Add visualization dots actor to the scene. @@ -94,4 +92,4 @@ if interactive: showm.start() -window.record(scene, out_path="viz_keyframe_animation_spline.png", size=(900, 768)) +fury.window.record(scene, out_path="viz_keyframe_animation_spline.png", size=(900, 768)) diff --git a/dev/_downloads/2f01a9981d2aeddb0bc9cb04446c5657/viz_sdfactor.py b/dev/_downloads/2f01a9981d2aeddb0bc9cb04446c5657/viz_sdfactor.py index 1223d38aa..7d99356dc 100644 --- a/dev/_downloads/2f01a9981d2aeddb0bc9cb04446c5657/viz_sdfactor.py +++ b/dev/_downloads/2f01a9981d2aeddb0bc9cb04446c5657/viz_sdfactor.py @@ -16,7 +16,7 @@ import numpy as np -from fury import actor, window +import fury ############################################################################### # Lets define variables for the SDF Actor @@ -30,7 +30,7 @@ ############################################################################### # Create SDF Actor -sdfactor = actor.sdf( +sdfactor = fury.actor.sdf( centers=centers, directions=dirs, colors=colors, @@ -41,7 +41,7 @@ ############################################################################## # Create a scene -scene = window.Scene() +scene = fury.window.Scene() scene.background((1.0, 0.8, 0.8)) scene.add(sdfactor) @@ -53,11 +53,11 @@ # manager. current_size = (1024, 720) -showm = window.ShowManager(scene, size=current_size, title="Visualize SDF Actor") +showm = fury.window.ShowManager(scene, size=current_size, title="Visualize SDF Actor") interactive = False if interactive: showm.start() -window.record(scene, out_path="viz_sdfactor.png", size=current_size) +fury.window.record(scene, out_path="viz_sdfactor.png", size=current_size) diff --git a/dev/_downloads/2f0b4d5f9ae49c3616d82963fe11dee4/viz_network_animated.zip b/dev/_downloads/2f0b4d5f9ae49c3616d82963fe11dee4/viz_network_animated.zip index 07fc4b759..57bc3d823 100644 Binary files a/dev/_downloads/2f0b4d5f9ae49c3616d82963fe11dee4/viz_network_animated.zip and b/dev/_downloads/2f0b4d5f9ae49c3616d82963fe11dee4/viz_network_animated.zip differ diff --git a/dev/_downloads/2f7a32bb72bb445cb1935b7bddd2650e/viz_no_interaction.zip b/dev/_downloads/2f7a32bb72bb445cb1935b7bddd2650e/viz_no_interaction.zip index d197803f1..3f85859bb 100644 Binary files a/dev/_downloads/2f7a32bb72bb445cb1935b7bddd2650e/viz_no_interaction.zip and b/dev/_downloads/2f7a32bb72bb445cb1935b7bddd2650e/viz_no_interaction.zip differ diff --git a/dev/_downloads/3134cf19e2b114c2a6ed97b1bea2a925/viz_ui.ipynb b/dev/_downloads/3134cf19e2b114c2a6ed97b1bea2a925/viz_ui.ipynb index 37620ad71..8301ee84d 100644 --- a/dev/_downloads/3134cf19e2b114c2a6ed97b1bea2a925/viz_ui.ipynb +++ b/dev/_downloads/3134cf19e2b114c2a6ed97b1bea2a925/viz_ui.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, ui, window\nfrom fury.data import fetch_viz_icons, read_viz_icons" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "rect = ui.Rectangle2D(size=(200, 200), position=(400, 300), color=(1, 0, 1))" + "rect = fury.ui.Rectangle2D(size=(200, 200), position=(400, 300), color=(1, 0, 1))" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "disk = ui.Disk2D(outer_radius=50, center=(500, 500), color=(1, 1, 0))" + "disk = fury.ui.Disk2D(outer_radius=50, center=(500, 500), color=(1, 1, 0))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 300), color=(0, 1, 1))" + "ring = fury.ui.Disk2D(\n outer_radius=50, inner_radius=45, center=(500, 300), color=(0, 1, 1)\n)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "img = ui.ImageContainer2D(\n img_path=read_viz_icons(fname=\"home3.png\"), position=(450, 350)\n)" + "img = fury.ui.ImageContainer2D(\n img_path=fury.data.read_viz_icons(fname=\"home3.png\"), position=(450, 350)\n)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "panel = ui.Panel2D(size=(300, 150), color=(1, 1, 1), align=\"right\")\npanel.center = (500, 400)" + "panel = fury.ui.Panel2D(size=(300, 150), color=(1, 1, 1), align=\"right\")\npanel.center = (500, 400)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "text = ui.TextBlock2D(text=\"Click me\")\ntext2 = ui.TextBlock2D(text=\"Me too\")\npanel.add_element(text, (50, 100))\npanel.add_element(text2, (180, 100))" + "text = fury.ui.TextBlock2D(text=\"Click me\")\ntext2 = fury.ui.TextBlock2D(text=\"Me too\")\npanel.add_element(text, (50, 100))\npanel.add_element(text2, (180, 100))" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "button_example = ui.Button2D(\n icon_fnames=[(\"square\", read_viz_icons(fname=\"stop2.png\"))]\n)\n\nicon_files = []\nicon_files.append((\"down\", read_viz_icons(fname=\"circle-down.png\")))\nicon_files.append((\"left\", read_viz_icons(fname=\"circle-left.png\")))\nicon_files.append((\"up\", read_viz_icons(fname=\"circle-up.png\")))\nicon_files.append((\"right\", read_viz_icons(fname=\"circle-right.png\")))\n\nsecond_button_example = ui.Button2D(icon_fnames=icon_files)\n\npanel.add_element(button_example, (0.25, 0.33))\npanel.add_element(second_button_example, (0.66, 0.33))" + "button_example = fury.ui.Button2D(\n icon_fnames=[(\"square\", fury.data.read_viz_icons(fname=\"stop2.png\"))]\n)\n\nicon_files = []\nicon_files.append((\"down\", fury.data.read_viz_icons(fname=\"circle-down.png\")))\nicon_files.append((\"left\", fury.data.read_viz_icons(fname=\"circle-left.png\")))\nicon_files.append((\"up\", fury.data.read_viz_icons(fname=\"circle-up.png\")))\nicon_files.append((\"right\", fury.data.read_viz_icons(fname=\"circle-right.png\")))\n\nsecond_button_example = fury.ui.Button2D(icon_fnames=icon_files)\n\npanel.add_element(button_example, (0.25, 0.33))\npanel.add_element(second_button_example, (0.66, 0.33))" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "cube = actor.cube(\n centers=np.array([[15, 0, 0]]),\n colors=np.array([[0, 0, 1]]),\n scales=np.array([[20, 20, 20]]),\n directions=np.array([[0, 0, 1]]),\n)" + "cube = fury.actor.cube(\n centers=np.array([[15, 0, 0]]),\n colors=np.array([[0, 0, 1]]),\n scales=np.array([[20, 20, 20]]),\n directions=np.array([[0, 0, 1]]),\n)" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "ring_slider = ui.RingSlider2D(\n center=(740, 400), initial_value=0, text_template=\"{angle:5.1f}\u00b0\"\n)\n\nline_slider_x = ui.LineSlider2D(\n center=(500, 250),\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"horizontal\",\n)\n\nline_slider_y = ui.LineSlider2D(\n center=(650, 350),\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"vertical\",\n)" + "ring_slider = fury.ui.RingSlider2D(\n center=(740, 400), initial_value=0, text_template=\"{angle:5.1f}\u00b0\"\n)\n\nline_slider_x = fury.ui.LineSlider2D(\n center=(500, 250),\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"horizontal\",\n)\n\nline_slider_y = fury.ui.LineSlider2D(\n center=(650, 350),\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"vertical\",\n)" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "range_slider_x = ui.RangeSlider(\n line_width=8,\n handle_side=25,\n range_slider_center=(450, 450),\n value_slider_center=(450, 350),\n length=150,\n min_value=0,\n max_value=10,\n font_size=18,\n range_precision=2,\n value_precision=4,\n shape=\"square\",\n)\n\nrange_slider_y = ui.RangeSlider(\n line_width=8,\n handle_side=25,\n range_slider_center=(750, 400),\n value_slider_center=(650, 400),\n length=150,\n min_value=0,\n max_value=10,\n font_size=18,\n range_precision=2,\n value_precision=4,\n orientation=\"vertical\",\n shape=\"square\",\n)" + "range_slider_x = fury.ui.RangeSlider(\n line_width=8,\n handle_side=25,\n range_slider_center=(450, 450),\n value_slider_center=(450, 350),\n length=150,\n min_value=0,\n max_value=10,\n font_size=18,\n range_precision=2,\n value_precision=4,\n shape=\"square\",\n)\n\nrange_slider_y = fury.ui.RangeSlider(\n line_width=8,\n handle_side=25,\n range_slider_center=(750, 400),\n value_slider_center=(650, 400),\n length=150,\n min_value=0,\n max_value=10,\n font_size=18,\n range_precision=2,\n value_precision=4,\n orientation=\"vertical\",\n shape=\"square\",\n)" ] }, { @@ -339,7 +339,7 @@ }, "outputs": [], "source": [ - "listbox = ui.ListBox2D(\n values=values, position=(10, 300), size=(300, 200), multiselection=False\n)" + "listbox = fury.ui.ListBox2D(\n values=values, position=(10, 300), size=(300, 200), multiselection=False\n)" ] }, { @@ -375,7 +375,7 @@ }, "outputs": [], "source": [ - "current_size = (800, 800)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY UI Example\")\n\nshow_manager.scene.add(listbox)\nfor example in examples:\n for element in example:\n show_manager.scene.add(element)\nshow_manager.scene.add(cube)\nshow_manager.scene.reset_camera()\nshow_manager.scene.set_camera(position=(0, 0, 200))\nshow_manager.scene.reset_clipping_range()\nshow_manager.scene.azimuth(30)\n\n# To interact with the UI, set interactive = True\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, size=current_size, out_path=\"viz_ui.png\")" + "current_size = (800, 800)\nshow_manager = fury.window.ShowManager(size=current_size, title=\"FURY UI Example\")\n\nshow_manager.scene.add(listbox)\nfor example in examples:\n for element in example:\n show_manager.scene.add(element)\nshow_manager.scene.add(cube)\nshow_manager.scene.reset_camera()\nshow_manager.scene.set_camera(position=(0, 0, 200))\nshow_manager.scene.reset_clipping_range()\nshow_manager.scene.azimuth(30)\n\n# To interact with the UI, set interactive = True\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(show_manager.scene, size=current_size, out_path=\"viz_fury.ui.png\")" ] } ], diff --git a/dev/_downloads/352429e70db79ae93c188dcb793070c8/viz_earth_animation.ipynb b/dev/_downloads/352429e70db79ae93c188dcb793070c8/viz_earth_animation.ipynb index 0406ef459..6bf8bda93 100644 --- a/dev/_downloads/352429e70db79ae93c188dcb793070c8/viz_earth_animation.ipynb +++ b/dev/_downloads/352429e70db79ae93c188dcb793070c8/viz_earth_animation.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, io, utils, window\nfrom fury.data import (\n fetch_viz_models,\n fetch_viz_textures,\n read_viz_models,\n read_viz_textures,\n)" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()" + "scene = fury.window.Scene()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "fetch_viz_textures()\nearth_filename = read_viz_textures(\"1_earth_8k.jpg\")\nearth_image = io.load_image(earth_filename)" + "fury.data.fetch_viz_textures()\nearth_filename = fury.data.read_viz_textures(\"1_earth_8k.jpg\")\nearth_image = fury.io.load_image(earth_filename)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "earth_actor = actor.texture_on_sphere(earth_image)" + "earth_actor = fury.actor.texture_on_sphere(earth_image)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "moon_filename = read_viz_textures(\"moon-8k.jpg\")\nmoon_image = io.load_image(moon_filename)\n\nmoon_actor = actor.texture_on_sphere(moon_image)" + "moon_filename = fury.data.read_viz_textures(\"moon-8k.jpg\")\nmoon_image = fury.io.load_image(moon_filename)\n\nmoon_actor = fury.actor.texture_on_sphere(moon_image)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "moon_actor.SetPosition(1, 0.1, 0.5)\nmoon_actor.SetScale(0.25, 0.25, 0.25)\nutils.rotate(earth_actor, (-90, 1, 0, 0))" + "moon_actor.SetPosition(1, 0.1, 0.5)\nmoon_actor.SetScale(0.25, 0.25, 0.25)\nfury.utils.rotate(earth_actor, (-90, 1, 0, 0))" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" + "showm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "center = np.array([[-0.39, 0.3175, 0.025]])\nradius = 0.002\nsphere_actor = actor.sphere(center, window.colors.blue_medium, radius)" + "center = np.array([[-0.39, 0.3175, 0.025]])\nradius = 0.002\nsphere_actor = fury.actor.sphere(center, fury.window.colors.blue_medium, radius)" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "text_actor = actor.text_3d(\n \"Bloomington, Indiana\", (-0.42, 0.31, 0.03), window.colors.white, 0.004\n)\nutils.rotate(text_actor, (-90, 0, 1, 0))" + "text_actor = fury.actor.text_3d(\n \"Bloomington, Indiana\", (-0.42, 0.31, 0.03), fury.window.colors.white, 0.004\n)\nfury.utils.rotate(text_actor, (-90, 0, 1, 0))" ] }, { @@ -231,7 +231,7 @@ }, "outputs": [], "source": [ - "fetch_viz_models()\nsatellite_filename = read_viz_models(\"satellite_obj.obj\")\nsatellite = io.load_polydata(satellite_filename)\nsatellite_actor = utils.get_actor_from_polydata(satellite)\n\nsatellite_actor.SetPosition(-0.75, 0.1, 0.4)\nsatellite_actor.SetScale(0.005, 0.005, 0.005)" + "fury.data.fetch_viz_models()\nsatellite_filename = fury.data.read_viz_models(\"satellite_obj.obj\")\nsatellite = fury.io.load_polydata(satellite_filename)\nsatellite_actor = fury.utils.get_actor_from_polydata(satellite)\n\nsatellite_actor.SetPosition(-0.75, 0.1, 0.4)\nsatellite_actor.SetScale(0.005, 0.005, 0.005)" ] }, { @@ -249,7 +249,7 @@ }, "outputs": [], "source": [ - "def timer_callback(_obj, _event):\n cnt = next(counter)\n showm.render()\n if cnt < 450:\n utils.rotate(earth_actor, (1, 0, 1, 0))\n if cnt % 5 == 0 and cnt < 450:\n showm.scene.azimuth(-1)\n if cnt == 300:\n scene.set_camera(\n position=(-3.679, 0.00, 2.314),\n focal_point=(0.0, 0.35, 0.00),\n view_up=(0.00, 1.00, 0.00),\n )\n if cnt > 300 and cnt < 450:\n scene.zoom(1.01)\n if cnt >= 450 and cnt < 1500:\n scene.add(sphere_actor)\n scene.add(text_actor)\n if cnt >= 450 and cnt < 550:\n scene.zoom(1.01)\n if cnt == 575:\n moon_actor.SetPosition(-1, 0.1, 0.5)\n scene.set_camera(\n position=(-0.5, 0.1, 0.00),\n focal_point=(-1, 0.1, 0.5),\n view_up=(0.00, 1.00, 0.00),\n )\n scene.zoom(0.03)\n scene.add(satellite_actor)\n utils.rotate(satellite_actor, (180, 0, 1, 0))\n scene.rm(earth_actor)\n if cnt > 575 and cnt < 750:\n showm.scene.azimuth(-2)\n utils.rotate(moon_actor, (-2, 0, 1, 0))\n satellite_actor.SetPosition(-0.8, 0.1 - cnt / 10000, 0.4)\n if cnt >= 750 and cnt < 1100:\n showm.scene.azimuth(-2)\n utils.rotate(moon_actor, (-2, 0, 1, 0))\n satellite_actor.SetPosition(-0.8, -0.07 + cnt / 10000, 0.4)\n if cnt == 1100:\n showm.exit()" + "def timer_callback(_obj, _event):\n cnt = next(counter)\n showm.render()\n if cnt < 450:\n fury.utils.rotate(earth_actor, (1, 0, 1, 0))\n if cnt % 5 == 0 and cnt < 450:\n showm.scene.azimuth(-1)\n if cnt == 300:\n scene.set_camera(\n position=(-3.679, 0.00, 2.314),\n focal_point=(0.0, 0.35, 0.00),\n view_up=(0.00, 1.00, 0.00),\n )\n if cnt > 300 and cnt < 450:\n scene.zoom(1.01)\n if cnt >= 450 and cnt < 1500:\n scene.add(sphere_actor)\n scene.add(text_actor)\n if cnt >= 450 and cnt < 550:\n scene.zoom(1.01)\n if cnt == 575:\n moon_actor.SetPosition(-1, 0.1, 0.5)\n scene.set_camera(\n position=(-0.5, 0.1, 0.00),\n focal_point=(-1, 0.1, 0.5),\n view_up=(0.00, 1.00, 0.00),\n )\n scene.zoom(0.03)\n scene.add(satellite_actor)\n fury.utils.rotate(satellite_actor, (180, 0, 1, 0))\n scene.rm(earth_actor)\n if cnt > 575 and cnt < 750:\n showm.scene.azimuth(-2)\n fury.utils.rotate(moon_actor, (-2, 0, 1, 0))\n satellite_actor.SetPosition(-0.8, 0.1 - cnt / 10000, 0.4)\n if cnt >= 750 and cnt < 1100:\n showm.scene.azimuth(-2)\n fury.utils.rotate(moon_actor, (-2, 0, 1, 0))\n satellite_actor.SetPosition(-0.8, -0.07 + cnt / 10000, 0.4)\n if cnt == 1100:\n showm.exit()" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 35, timer_callback)\nshowm.start()\nwindow.record(showm.scene, size=(900, 768), out_path=\"viz_earth_animation.png\")" + "showm.add_timer_callback(True, 35, timer_callback)\nshowm.start()\nfury.window.record(showm.scene, size=(900, 768), out_path=\"viz_earth_animation.png\")" ] } ], diff --git a/dev/_downloads/35de4ad1a7ff55aeb7f746c9159f26be/viz_skinning.ipynb b/dev/_downloads/35de4ad1a7ff55aeb7f746c9159f26be/viz_skinning.ipynb index ed595549b..cb8e3fa2a 100644 --- a/dev/_downloads/35de4ad1a7ff55aeb7f746c9159f26be/viz_skinning.ipynb +++ b/dev/_downloads/35de4ad1a7ff55aeb7f746c9159f26be/viz_skinning.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import window\nfrom fury.data import fetch_gltf, read_viz_gltf\nfrom fury.gltf import glTF" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_gltf(\"RiggedFigure\", \"glTF\")\nfilename = read_viz_gltf(\"RiggedFigure\")" + "fury.data.fetch_gltf(\"RiggedFigure\", \"glTF\")\nfilename = fury.data.read_viz_gltf(\"RiggedFigure\")" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "gltf_obj = glTF(filename, apply_normals=False)" + "gltf_obj = fury.gltf.glTF(filename, apply_normals=False)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=True, order_transparent=True\n)\nshowm.initialize()\nscene.add(animation)" + "scene = fury.window.Scene()\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=True, order_transparent=True\n)\nshowm.initialize()\nscene.add(animation)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 20, timer_callback)\nscene.reset_camera()\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_skinning.png\", size=(900, 768))" + "showm.add_timer_callback(True, 20, timer_callback)\nscene.reset_camera()\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_skinning.png\", size=(900, 768))" ] } ], diff --git a/dev/_downloads/3630bcdd4a5c092c89da2eecc603e83b/viz_using_time_equations.zip b/dev/_downloads/3630bcdd4a5c092c89da2eecc603e83b/viz_using_time_equations.zip index f019eeb96..0cc339de2 100644 Binary files a/dev/_downloads/3630bcdd4a5c092c89da2eecc603e83b/viz_using_time_equations.zip and b/dev/_downloads/3630bcdd4a5c092c89da2eecc603e83b/viz_using_time_equations.zip differ diff --git a/dev/_downloads/370e553495e28e7de63e0513442e759f/viz_earth_animation.zip b/dev/_downloads/370e553495e28e7de63e0513442e759f/viz_earth_animation.zip index 631f903c4..7379baaa2 100644 Binary files a/dev/_downloads/370e553495e28e7de63e0513442e759f/viz_earth_animation.zip and b/dev/_downloads/370e553495e28e7de63e0513442e759f/viz_earth_animation.zip differ diff --git a/dev/_downloads/39aa8822f7757cc0da0e64c18082f036/viz_robot_arm_animation.py b/dev/_downloads/39aa8822f7757cc0da0e64c18082f036/viz_robot_arm_animation.py index 1e9485d02..b35fd105c 100644 --- a/dev/_downloads/39aa8822f7757cc0da0e64c18082f036/viz_robot_arm_animation.py +++ b/dev/_downloads/39aa8822f7757cc0da0e64c18082f036/viz_robot_arm_animation.py @@ -8,13 +8,11 @@ import numpy as np -from fury import actor, window -from fury.animation import Animation, Timeline -from fury.utils import set_actor_origin +import fury -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) showm.initialize() @@ -23,16 +21,20 @@ ############################################################################### # Creating robot arm components -base = actor.cylinder( +base = fury.actor.cylinder( np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), colors=(0, 1, 0), radius=1 ) -main_arm = actor.box(np.array([[0, 0, 0]]), colors=(1, 0.5, 0), scales=(12, 1, 1)) +main_arm = fury.actor.box(np.array([[0, 0, 0]]), colors=(1, 0.5, 0), scales=(12, 1, 1)) -sub_arm = actor.box(np.array([[0, 0, 0]]), colors=(0, 0.5, 0.8), scales=(8, 0.7, 0.7)) -joint_1 = actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]), radii=1.2) -joint_2 = actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1])) +sub_arm = fury.actor.box( + np.array([[0, 0, 0]]), colors=(0, 0.5, 0.8), scales=(8, 0.7, 0.7) +) +joint_1 = fury.actor.sphere( + np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]), radii=1.2 +) +joint_2 = fury.actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1])) -end = actor.cone( +end = fury.actor.cone( np.array([[0, 0, 0]]), np.array([[1, 0, 0]]), np.array([[1, 0, 0]]), @@ -42,18 +44,18 @@ ############################################################################### # Setting the center of both shafts to the beginning. -set_actor_origin(main_arm, np.array([-6, 0, 0])) -set_actor_origin(sub_arm, np.array([-4, 0, 0])) +fury.utils.set_actor_origin(main_arm, np.array([-6, 0, 0])) +fury.utils.set_actor_origin(sub_arm, np.array([-4, 0, 0])) ############################################################################### # Creating a timeline -timeline = Timeline(playback_panel=True) +timeline = fury.animation.Timeline(playback_panel=True) ############################################################################### # Creating animations -main_arm_animation = Animation([main_arm, joint_1], length=2 * np.pi) -child_arm_animation = Animation([sub_arm, joint_2]) -drill_animation = Animation(end) +main_arm_animation = fury.animation.Animation([main_arm, joint_1], length=2 * np.pi) +child_arm_animation = fury.animation.Animation([sub_arm, joint_2]) +drill_animation = fury.animation.Animation(end) ############################################################################### @@ -119,4 +121,4 @@ def rot_drill(t): if interactive: showm.start() -window.record(scene, out_path="viz_robot_arm.png", size=(900, 768)) +fury.window.record(scene, out_path="viz_robot_arm.png", size=(900, 768)) diff --git a/dev/_downloads/3aa38a61f3ecdfc816b700db8adb0518/viz_spiky.ipynb b/dev/_downloads/3aa38a61f3ecdfc816b700db8adb0518/viz_spiky.ipynb index efa0fdd80..b15e38854 100644 --- a/dev/_downloads/3aa38a61f3ecdfc816b700db8adb0518/viz_spiky.ipynb +++ b/dev/_downloads/3aa38a61f3ecdfc816b700db8adb0518/viz_spiky.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, primitive, utils, window" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()" + "scene = fury.window.Scene()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "vertices, triangles = primitive.prim_sphere(name=\"symmetric362\", gen_faces=False)" + "vertices, triangles = fury.primitive.prim_sphere(name=\"symmetric362\", gen_faces=False)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "point_actor = actor.point(vertices, point_radius=0.01, colors=(0, 1, 0))" + "point_actor = fury.actor.point(vertices, point_radius=0.01, colors=(0, 1, 0))" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "normals = utils.normals_from_v_f(vertices, triangles)" + "normals = fury.utils.normals_from_v_f(vertices, triangles)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "arrow_actor = actor.arrow(\n centers=vertices,\n directions=normals,\n colors=(1, 0, 0),\n heights=0.2,\n resolution=10,\n vertices=None,\n faces=None,\n)" + "arrow_actor = fury.actor.arrow(\n centers=vertices,\n directions=normals,\n colors=(1, 0, 0),\n heights=0.2,\n resolution=10,\n vertices=None,\n faces=None,\n)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "primitive_colors = np.zeros(vertices.shape)\nprimitive_colors[:, 2] = 180\nprimitive_actor = utils.get_actor_from_primitive(\n vertices=vertices,\n triangles=triangles,\n colors=primitive_colors,\n normals=normals,\n backface_culling=True,\n)" + "primitive_colors = np.zeros(vertices.shape)\nprimitive_colors[:, 2] = 180\nprimitive_actor = fury.utils.get_actor_from_primitive(\n vertices=vertices,\n triangles=triangles,\n colors=primitive_colors,\n normals=normals,\n backface_culling=True,\n)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "scene.add(point_actor)\nscene.add(arrow_actor)\nscene.add(primitive_actor)\nscene.add(actor.axes())" + "scene.add(point_actor)\nscene.add(arrow_actor)\nscene.add(primitive_actor)\nscene.add(fury.actor.axes())" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" + "showm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "def timer_callback(_obj, _event):\n cnt = next(counter)\n showm.scene.azimuth(0.05 * cnt)\n primitive_actor.GetProperty().SetOpacity(cnt / 10.0)\n showm.render()\n if cnt == 20:\n showm.exit()\n\n\nshowm.add_timer_callback(True, 200, timer_callback)\nshowm.start()\nwindow.record(showm.scene, size=(900, 768), out_path=\"viz_spiky.png\")" + "def timer_callback(_obj, _event):\n cnt = next(counter)\n showm.scene.azimuth(0.05 * cnt)\n primitive_actor.GetProperty().SetOpacity(cnt / 10.0)\n showm.render()\n if cnt == 20:\n showm.exit()\n\n\nshowm.add_timer_callback(True, 200, timer_callback)\nshowm.start()\nfury.window.record(showm.scene, size=(900, 768), out_path=\"viz_spiky.png\")" ] }, { diff --git a/dev/_downloads/3b433bf413a4790ff3c6b290992444ee/viz_sphere.py b/dev/_downloads/3b433bf413a4790ff3c6b290992444ee/viz_sphere.py index 92df3c73c..f81aae96f 100644 --- a/dev/_downloads/3b433bf413a4790ff3c6b290992444ee/viz_sphere.py +++ b/dev/_downloads/3b433bf413a4790ff3c6b290992444ee/viz_sphere.py @@ -7,7 +7,7 @@ import numpy as np -from fury import actor, window +import fury ############################################################################ # First thing, you have to specify centers and colors of the sphere @@ -18,7 +18,7 @@ ############################################################################ # The below sphere actor is generated by repeating the sphere primitive. -prim_sphere_actor = actor.sphere(centers, colors=colors, radii=5) +prim_sphere_actor = fury.actor.sphere(centers, colors=colors, radii=5) ############################################################################ # This time, we're using vtkSphereSource to generate the sphere actor @@ -26,9 +26,9 @@ cen2 = np.add(centers, np.array([12, 0, 0])) cols2 = np.array([1, 0, 0]) -vtk_sphere_actor = actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False) +vtk_sphere_actor = fury.actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False) -scene = window.Scene() +scene = fury.window.Scene() ############################################################################ # Adding our sphere actors to scene. @@ -39,6 +39,6 @@ interactive = False if interactive: - window.show(scene, size=(600, 600)) + fury.window.show(scene, size=(600, 600)) -window.record(scene, out_path="viz_sphere.png", size=(600, 600)) +fury.window.record(scene, out_path="viz_sphere.png", size=(600, 600)) diff --git a/dev/_downloads/3bdacbf5e9bfabcaa99c4e9c1edd4691/viz_bundles.zip b/dev/_downloads/3bdacbf5e9bfabcaa99c4e9c1edd4691/viz_bundles.zip index 421276fe4..9f4d0f6f8 100644 Binary files a/dev/_downloads/3bdacbf5e9bfabcaa99c4e9c1edd4691/viz_bundles.zip and b/dev/_downloads/3bdacbf5e9bfabcaa99c4e9c1edd4691/viz_bundles.zip differ diff --git a/dev/_downloads/3ce3334a3f164ae3b7039c1d97b84ef2/viz_texture.zip b/dev/_downloads/3ce3334a3f164ae3b7039c1d97b84ef2/viz_texture.zip index 6c50b8996..43b6e9edb 100644 Binary files a/dev/_downloads/3ce3334a3f164ae3b7039c1d97b84ef2/viz_texture.zip and b/dev/_downloads/3ce3334a3f164ae3b7039c1d97b84ef2/viz_texture.zip differ diff --git a/dev/_downloads/404c31871952713a02a25cf591770abd/viz_roi_contour.zip b/dev/_downloads/404c31871952713a02a25cf591770abd/viz_roi_contour.zip index 7507cc4b5..dff93d389 100644 Binary files a/dev/_downloads/404c31871952713a02a25cf591770abd/viz_roi_contour.zip and b/dev/_downloads/404c31871952713a02a25cf591770abd/viz_roi_contour.zip differ diff --git a/dev/_downloads/43858f75386ec76b0495b0be1ee1b122/collision-particles.zip b/dev/_downloads/43858f75386ec76b0495b0be1ee1b122/collision-particles.zip index d0ed0d9d7..7bf62e623 100644 Binary files a/dev/_downloads/43858f75386ec76b0495b0be1ee1b122/collision-particles.zip and b/dev/_downloads/43858f75386ec76b0495b0be1ee1b122/collision-particles.zip differ diff --git a/dev/_downloads/44b4046d70ae1df75a4459ef60d083fc/viz_cone.zip b/dev/_downloads/44b4046d70ae1df75a4459ef60d083fc/viz_cone.zip index 49f3a87f3..8c6810196 100644 Binary files a/dev/_downloads/44b4046d70ae1df75a4459ef60d083fc/viz_cone.zip and b/dev/_downloads/44b4046d70ae1df75a4459ef60d083fc/viz_cone.zip differ diff --git a/dev/_downloads/44c6770f18ab25e2228c6f470d88452f/viz_tab.py b/dev/_downloads/44c6770f18ab25e2228c6f470d88452f/viz_tab.py index da6f542c1..a4814c71e 100644 --- a/dev/_downloads/44c6770f18ab25e2228c6f470d88452f/viz_tab.py +++ b/dev/_downloads/44c6770f18ab25e2228c6f470d88452f/viz_tab.py @@ -15,18 +15,17 @@ import numpy as np -from fury import actor, ui, window -from fury.data import fetch_viz_icons +import fury ############################################################################## # First we need to fetch some icons that are included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ############################################################################### # First, we create the Tab UI. -tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True) +tab_ui = fury.ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True) ############################################################################### # We can also define the position of the Tab Bar. @@ -40,9 +39,9 @@ # # Now we prepare content for the first tab. -ring_slider = ui.RingSlider2D(initial_value=0, text_template="{angle:5.1f}°") +ring_slider = fury.ui.RingSlider2D(initial_value=0, text_template="{angle:5.1f}°") -line_slider_x = ui.LineSlider2D( +line_slider_x = fury.ui.LineSlider2D( initial_value=0, min_value=-10, max_value=10, @@ -50,7 +49,7 @@ text_alignment="Top", ) -line_slider_y = ui.LineSlider2D( +line_slider_y = fury.ui.LineSlider2D( initial_value=0, min_value=-10, max_value=10, @@ -58,7 +57,7 @@ text_alignment="Right", ) -cube = actor.box( +cube = fury.actor.box( centers=np.array([[10, 0, 0]]), directions=np.array([[0, 1, 0]]), colors=np.array([[0, 0, 1]]), @@ -105,17 +104,17 @@ def translate_cube_y(slider): # # Now we prepare content for second tab. -cylinder = actor.cylinder( +cylinder = fury.actor.cylinder( centers=np.array([[0, 0, 0]]), directions=np.array([[1, 1, 0]]), colors=np.array([[0, 1, 1]]), radius=1.0, ) -sphere = actor.sphere(centers=np.array([[5, 0, 0]]), colors=(1, 1, 0)) +sphere = fury.actor.sphere(centers=np.array([[5, 0, 0]]), colors=(1, 1, 0)) figure_dict = {"cylinder": cylinder, "sphere": sphere} -checkbox = ui.Checkbox(labels=["cylinder", "sphere"]) +checkbox = fury.ui.Checkbox(labels=["cylinder", "sphere"]) # Get difference between two lists. @@ -149,7 +148,7 @@ def set_figure_visiblity(checkboxes): # # Now we prepare content for third tab. -label = ui.TextBlock2D( +label = fury.ui.TextBlock2D( position=(600, 300), font_size=40, color=(1, 0.5, 0), @@ -168,7 +167,7 @@ def set_figure_visiblity(checkboxes): "Red": (1, 0, 0), } -color_combobox = ui.ComboBox2D( +color_combobox = fury.ui.ComboBox2D( items=list(colors.keys()), placeholder="Choose Text Color", size=(250, 150), @@ -228,7 +227,7 @@ def collapse(tab_ui): ############################################################################### # Next we prepare the scene and render it with the help of show manager. -sm = window.ShowManager(size=(800, 500), title="Viz Tab") +sm = fury.window.ShowManager(size=(800, 500), title="Viz Tab") sm.scene.add(tab_ui, cube, cylinder, sphere, label) # To interact with the ui set interactive = True @@ -237,4 +236,4 @@ def collapse(tab_ui): if interactive: sm.start() -window.record(sm.scene, size=(500, 500), out_path="viz_tab.png") +fury.window.record(sm.scene, size=(500, 500), out_path="viz_tab.png") diff --git a/dev/_downloads/4517c6a513f7b72c17aad95afd1a161f/viz_markers.ipynb b/dev/_downloads/4517c6a513f7b72c17aad95afd1a161f/viz_markers.ipynb index 377e3e35e..998f34886 100644 --- a/dev/_downloads/4517c6a513f7b72c17aad95afd1a161f/viz_markers.ipynb +++ b/dev/_downloads/4517c6a513f7b72c17aad95afd1a161f/viz_markers.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\n\nn = 10000" + "import numpy as np\n\nimport fury\n\nn = 10000" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "nodes_actor = actor.markers(\n centers,\n marker=markers,\n edge_width=0.1,\n edge_color=[255, 255, 0],\n colors=colors,\n scales=0.5,\n)" + "nodes_actor = fury.actor.markers(\n centers,\n marker=markers,\n edge_width=0.1,\n edge_color=[255, 255, 0],\n colors=colors,\n scales=0.5,\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "nodes_3d_actor = actor.markers(\n centers + np.ones_like(centers) * 25,\n marker=\"3d\",\n colors=colors,\n scales=0.5,\n)\n\nscene = window.Scene()\n\nscene.add(nodes_actor)\nscene.add(nodes_3d_actor)\n\ninteractive = False\n\nif interactive:\n window.show(scene, size=(600, 600))\n\nwindow.record(scene, out_path=\"viz_markers.png\", size=(600, 600))" + "nodes_3d_actor = fury.actor.markers(\n centers + np.ones_like(centers) * 25,\n marker=\"3d\",\n colors=colors,\n scales=0.5,\n)\n\nscene = fury.window.Scene()\n\nscene.add(nodes_actor)\nscene.add(nodes_3d_actor)\n\ninteractive = False\n\nif interactive:\n fury.window.show(scene, size=(600, 600))\n\nfury.window.record(scene, out_path=\"viz_markers.png\", size=(600, 600))" ] } ], diff --git a/dev/_downloads/4702bc8bbbcaf0f639ae036269723231/viz_domino.py b/dev/_downloads/4702bc8bbbcaf0f639ae036269723231/viz_domino.py index 9bb54afa4..104ec4db9 100644 --- a/dev/_downloads/4702bc8bbbcaf0f639ae036269723231/viz_domino.py +++ b/dev/_downloads/4702bc8bbbcaf0f639ae036269723231/viz_domino.py @@ -15,7 +15,7 @@ import numpy as np import pybullet as p -from fury import actor, ui, utils, window +import fury # Next, we initialize a pybullet client to render the physics. # We use `DIRECT` mode to initialize pybullet without a GUI. @@ -35,7 +35,7 @@ base_orientation = np.array([0, 0, 0, 1]) # Render a BASE plane to support the Dominoes. -base_actor = actor.box( +base_actor = fury.actor.box( centers=np.array([[0, 0, 0]]), directions=[0, 0, 0], scales=base_size, @@ -94,7 +94,7 @@ p.changeDynamics(dominos[i], -1, lateralFriction=0.2, restitution=0.1) -domino_actor = actor.box( +domino_actor = fury.actor.box( centers=domino_centers, directions=domino_directions, scales=domino_sizes, @@ -103,13 +103,13 @@ ############################################################################### # Now, we define a scene and add actors to it. -scene = window.Scene() -scene.add(actor.axes()) +scene = fury.window.Scene() +scene.add(fury.actor.axes()) scene.add(base_actor) scene.add(domino_actor) # Create show manager. -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) @@ -128,7 +128,7 @@ # Calculate the vertices of the dominos. -vertices = utils.vertices_from_actor(domino_actor) +vertices = fury.utils.vertices_from_actor(domino_actor) num_vertices = vertices.shape[0] num_objects = domino_centers.shape[0] sec = int(num_vertices / num_objects) @@ -173,7 +173,7 @@ def sync_domino(object_index, multibody): # Here, we define a textblock to display the Avg. FPS and simulation steps. fpss = np.array([]) -tb = ui.TextBlock2D( +tb = fury.ui.TextBlock2D( text="Avg. FPS: \nSim Steps: ", position=(0, 680), font_size=30, color=(1, 0.5, 0) ) scene.add(tb) @@ -224,7 +224,7 @@ def timer_callback(_obj, _event): # Updating the position and orientation of individual dominos. for idx, domino in enumerate(dominos): sync_domino(idx, domino) - utils.update_actor(domino_actor) + fury.utils.update_actor(domino_actor) # Simulate a step. p.stepSimulation() @@ -244,4 +244,4 @@ def timer_callback(_obj, _event): if interactive: showm.start() -window.record(scene, out_path="viz_domino.png", size=(900, 768)) +fury.window.record(scene, out_path="viz_domino.png", size=(900, 768)) diff --git a/dev/_downloads/4978e6bab44b48e4a6aba1c6548ccfde/viz_texture.py b/dev/_downloads/4978e6bab44b48e4a6aba1c6548ccfde/viz_texture.py index 31043b706..fe46def4c 100644 --- a/dev/_downloads/4978e6bab44b48e4a6aba1c6548ccfde/viz_texture.py +++ b/dev/_downloads/4978e6bab44b48e4a6aba1c6548ccfde/viz_texture.py @@ -5,13 +5,12 @@ In this tutorial, we will show how to create a sphere with a texture. """ -from fury import actor, io, window -from fury.data import fetch_viz_textures, read_viz_textures +import fury ############################################################################## # Create a scene to start. -scene = window.Scene() +scene = fury.window.Scene() ############################################################################## # Load an image (png, bmp, jpeg or jpg) using ``io.load_image``. In this @@ -19,17 +18,17 @@ # Earth's surface from the fury Github after using ''fetch_viz_textures()'' # to download the available textures. -fetch_viz_textures() -filename = read_viz_textures("1_earth_8k.jpg") -image = io.load_image(filename) +fury.data.fetch_viz_textures() +filename = fury.data.read_viz_textures("1_earth_8k.jpg") +image = fury.io.load_image(filename) ############################################################################## -# Next, use ``actor.texture_on_sphere`` to add a sphere with the texture from +# Next, use ``fury.actor.texture_on_sphere`` to add a sphere with the texture from # your loaded image to the already existing scene. # To add a texture to your scene as visualized on a plane, use -# ``actor.texture`` instead. +# ``fury.actor.texture`` instead. -scene.add(actor.texture_on_sphere(image)) +scene.add(fury.actor.texture_on_sphere(image)) ############################################################################## # Lastly, record the scene, or set interactive to True if you would like to @@ -37,5 +36,5 @@ interactive = False if interactive: - window.show(scene, size=(600, 600), reset_camera=False) -window.record(scene, size=(900, 768), out_path="viz_texture.png") + fury.window.show(scene, size=(600, 600), reset_camera=False) +fury.window.record(scene, size=(900, 768), out_path="viz_texture.png") diff --git a/dev/_downloads/49cb43af463ce8b3e9c431ddcb605524/viz_animated_surfaces.zip b/dev/_downloads/49cb43af463ce8b3e9c431ddcb605524/viz_animated_surfaces.zip index 49155b866..b095b2649 100644 Binary files a/dev/_downloads/49cb43af463ce8b3e9c431ddcb605524/viz_animated_surfaces.zip and b/dev/_downloads/49cb43af463ce8b3e9c431ddcb605524/viz_animated_surfaces.zip differ diff --git a/dev/_downloads/4c0316adcbc4df4dbff542b95e94b99f/viz_buttons.zip b/dev/_downloads/4c0316adcbc4df4dbff542b95e94b99f/viz_buttons.zip index 088b2286e..1ee76fa9a 100644 Binary files a/dev/_downloads/4c0316adcbc4df4dbff542b95e94b99f/viz_buttons.zip and b/dev/_downloads/4c0316adcbc4df4dbff542b95e94b99f/viz_buttons.zip differ diff --git a/dev/_downloads/4c208c4e684fa517d9857142424cd6c6/viz_gltf.ipynb b/dev/_downloads/4c208c4e684fa517d9857142424cd6c6/viz_gltf.ipynb index 1ac78bd0e..30c943479 100644 --- a/dev/_downloads/4c208c4e684fa517d9857142424cd6c6/viz_gltf.ipynb +++ b/dev/_downloads/4c208c4e684fa517d9857142424cd6c6/viz_gltf.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import window\nfrom fury.data import fetch_gltf, read_viz_gltf\nfrom fury.gltf import glTF" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.SetBackground(0.1, 0.1, 0.4)" + "scene = fury.window.Scene()\nscene.SetBackground(0.1, 0.1, 0.4)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "fetch_gltf(\"Duck\", \"glTF\")\nfilename = read_viz_gltf(\"Duck\")" + "fury.data.fetch_gltf(\"Duck\", \"glTF\")\nfilename = fury.data.read_viz_gltf(\"Duck\")" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "gltf_obj = glTF(filename, apply_normals=False)\nactors = gltf_obj.actors()" + "gltf_obj = fury.gltf.glTF(filename, apply_normals=False)\nactors = gltf_obj.actors()" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "cameras = gltf_obj.cameras\nif cameras:\n scene.SetActiveCamera(cameras[0])\n\ninteractive = False\n\nif interactive:\n window.show(scene, size=(1280, 720))\n\nwindow.record(scene, out_path=\"viz_gltf.png\", size=(1280, 720))" + "cameras = gltf_obj.cameras\nif cameras:\n scene.SetActiveCamera(cameras[0])\n\ninteractive = False\n\nif interactive:\n fury.window.show(scene, size=(1280, 720))\n\nfury.window.record(scene, out_path=\"viz_gltf.png\", size=(1280, 720))" ] } ], diff --git a/dev/_downloads/50d8940d1ce732009cff55c7ae40b100/viz_tesseract.py b/dev/_downloads/50d8940d1ce732009cff55c7ae40b100/viz_tesseract.py index f037c9026..a66312ea4 100644 --- a/dev/_downloads/50d8940d1ce732009cff55c7ae40b100/viz_tesseract.py +++ b/dev/_downloads/50d8940d1ce732009cff55c7ae40b100/viz_tesseract.py @@ -14,8 +14,7 @@ import numpy as np -from fury import actor, utils, window -from fury.ui import TextBlock2D +import fury ############################################################################### # Let's define some variables and their descriptions: @@ -118,11 +117,11 @@ def connect_points(verts3D): ############################################################################### # Creating a scene object and configuring the camera's position -scene = window.Scene() +scene = fury.window.Scene() scene.set_camera( position=(0, 10, -1), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0) ) -showm = window.ShowManager(scene, size=(1920, 1080), order_transparent=True) +showm = fury.window.ShowManager(scene, size=(1920, 1080), order_transparent=True) ############################################################################### @@ -130,8 +129,8 @@ def connect_points(verts3D): verts3D = rotate4D(verts4D) if not wireframe: - points = actor.point(verts3D, colors=p_color) - point_verts = utils.vertices_from_actor(points) + points = fury.actor.point(verts3D, colors=p_color) + point_verts = fury.utils.vertices_from_actor(points) no_vertices = len(point_verts) / 16 initial_verts = point_verts.copy() - np.repeat(verts3D, no_vertices, axis=0) @@ -141,8 +140,10 @@ def connect_points(verts3D): # Connecting points with lines actor lines = connect_points(verts3D) -edges = actor.line(lines=lines, colors=e_color, lod=False, fake_tube=True, linewidth=4) -lines_verts = utils.vertices_from_actor(edges) +edges = fury.actor.line( + lines=lines, colors=e_color, lod=False, fake_tube=True, linewidth=4 +) +lines_verts = fury.utils.vertices_from_actor(edges) initial_lines = lines_verts.copy() - np.reshape(lines, (-1, 3)) scene.add(edges) @@ -150,7 +151,7 @@ def connect_points(verts3D): ############################################################################### # Initializing text box to display the name -tb = TextBlock2D(text="Tesseract", position=(900, 950), font_size=20) +tb = fury.ui.TextBlock2D(text="Tesseract", position=(900, 950), font_size=20) showm.scene.add(tb) ############################################################################### @@ -167,11 +168,11 @@ def timer_callback(_obj, _event): verts3D = rotate4D(verts4D) if not wireframe: point_verts[:] = initial_verts + np.repeat(verts3D, no_vertices, axis=0) - utils.update_actor(points) + fury.utils.update_actor(points) lines = connect_points(verts3D) lines_verts[:] = initial_lines + np.reshape(lines, (-1, 3)) - utils.update_actor(edges) + fury.utils.update_actor(edges) showm.render() angle += dtheta @@ -186,4 +187,4 @@ def timer_callback(_obj, _event): showm.add_timer_callback(True, 20, timer_callback) showm.start() -window.record(showm.scene, size=(600, 600), out_path="viz_tesseract.png") +fury.window.record(showm.scene, size=(600, 600), out_path="viz_tesseract.png") diff --git a/dev/_downloads/5396abe89159c12e803367ea8e179107/viz_fine_tuning_gl_context.py b/dev/_downloads/5396abe89159c12e803367ea8e179107/viz_fine_tuning_gl_context.py index 2f11ee588..a347bf691 100644 --- a/dev/_downloads/5396abe89159c12e803367ea8e179107/viz_fine_tuning_gl_context.py +++ b/dev/_downloads/5396abe89159c12e803367ea8e179107/viz_fine_tuning_gl_context.py @@ -16,9 +16,7 @@ import numpy as np -from fury import actor, window -from fury.shaders import shader_apply_effects -from fury.utils import remove_observer_from_actor +import fury ############################################################################### # We just proceed as usual: creating the actors and initializing a scene in @@ -27,21 +25,21 @@ centers = np.array([[0, 0, 0], [-0.1, 0, 0], [0.1, 0, 0]]) colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) -actor_no_depth_test = actor.markers( +actor_no_depth_test = fury.actor.markers( centers, marker="s", colors=colors, marker_opacity=0.5, scales=0.2, ) -actor_normal_blending = actor.markers( +actor_normal_blending = fury.actor.markers( centers - np.array([[0, -0.5, 0]]), marker="s", colors=colors, marker_opacity=0.5, scales=0.2, ) -actor_add_blending = actor.markers( +actor_add_blending = fury.actor.markers( centers - np.array([[0, -1, 0]]), marker="s", colors=colors, @@ -49,14 +47,14 @@ scales=0.2, ) -actor_sub_blending = actor.markers( +actor_sub_blending = fury.actor.markers( centers - np.array([[0, -1.5, 0]]), marker="s", colors=colors, marker_opacity=0.5, scales=0.2, ) -actor_mul_blending = actor.markers( +actor_mul_blending = fury.actor.markers( centers - np.array([[0, -2, 0]]), marker="s", colors=colors, @@ -65,11 +63,11 @@ ) -scene = window.Scene() +scene = fury.window.Scene() scene.background((0.5, 0.5, 0.5)) -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=False ) @@ -89,36 +87,40 @@ # Here we're using the pre-build FURY window functions which has already a # set of specific behaviors to be applied in the OpenGL context -shader_apply_effects( - showm.window, actor_normal_blending, effects=window.gl_set_normal_blending +fury.shaders.shader_apply_effects( + showm.window, actor_normal_blending, effects=fury.window.gl_set_normal_blending ) # ############################################################################### # It's also possible use a list of effects. The final opengl state it'll # be the composition of each effect that each function has in the opengl state -id_observer = shader_apply_effects( +id_observer = fury.shaders.shader_apply_effects( showm.window, actor_no_depth_test, - effects=[window.gl_reset_blend, window.gl_disable_blend, window.gl_disable_depth], + effects=[ + fury.window.gl_reset_blend, + fury.window.gl_disable_blend, + fury.window.gl_disable_depth, + ], ) -shader_apply_effects( +fury.shaders.shader_apply_effects( showm.window, actor_add_blending, effects=[ - window.gl_reset_blend, - window.gl_enable_depth, - window.gl_set_additive_blending, + fury.window.gl_reset_blend, + fury.window.gl_enable_depth, + fury.window.gl_set_additive_blending, ], ) -shader_apply_effects( - showm.window, actor_sub_blending, effects=window.gl_set_subtractive_blending +fury.shaders.shader_apply_effects( + showm.window, actor_sub_blending, effects=fury.window.gl_set_subtractive_blending ) -shader_apply_effects( - showm.window, actor_mul_blending, effects=window.gl_set_multiplicative_blending +fury.shaders.shader_apply_effects( + showm.window, actor_mul_blending, effects=fury.window.gl_set_multiplicative_blending ) ############################################################################### @@ -137,9 +139,11 @@ def timer_callback(obj, event): # the results of each specific opengl-state showm.scene.azimuth(1) if cnt == 400: - remove_observer_from_actor(actor_no_depth_test, id_observer) - shader_apply_effects( - showm.window, actor_no_depth_test, effects=window.gl_set_additive_blending + fury.utils.remove_observer_from_actor(actor_no_depth_test, id_observer) + fury.shaders.shader_apply_effects( + showm.window, + actor_no_depth_test, + effects=fury.window.gl_set_additive_blending, ) if cnt == 1000: showm.exit() @@ -150,4 +154,4 @@ def timer_callback(obj, event): if interactive: showm.start() -window.record(scene, out_path="viz_fine_tuning_gl_context.png", size=(600, 600)) +fury.window.record(scene, out_path="viz_fine_tuning_gl_context.png", size=(600, 600)) diff --git a/dev/_downloads/5449f860691434ce246436ac36c9d4d4/viz_combobox.zip b/dev/_downloads/5449f860691434ce246436ac36c9d4d4/viz_combobox.zip index 1c78d33f0..3601391fe 100644 Binary files a/dev/_downloads/5449f860691434ce246436ac36c9d4d4/viz_combobox.zip and b/dev/_downloads/5449f860691434ce246436ac36c9d4d4/viz_combobox.zip differ diff --git a/dev/_downloads/5628bd14c230cc10efd070d96a508073/viz_sdf_cylinder.ipynb b/dev/_downloads/5628bd14c230cc10efd070d96a508073/viz_sdf_cylinder.ipynb index af3107a40..7736d8214 100644 --- a/dev/_downloads/5628bd14c230cc10efd070d96a508073/viz_sdf_cylinder.ipynb +++ b/dev/_downloads/5628bd14c230cc10efd070d96a508073/viz_sdf_cylinder.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import os\n\nimport numpy as np\n\nfrom fury import actor, window\nfrom fury.shaders import (\n attribute_to_actor,\n compose_shader,\n import_fury_shader,\n shader_to_actor,\n)" + "import os\n\nimport numpy as np\n\nimport fury" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "cylinders_8 = actor.cylinder(\n centers[:3],\n dirs[:3],\n colors[:3],\n radius=radius,\n heights=height,\n capped=True,\n resolution=8,\n)\ncylinders_16 = actor.cylinder(\n centers[3:6],\n dirs[3:6],\n colors[3:6],\n radius=radius,\n heights=height,\n capped=True,\n resolution=16,\n)\ncylinders_32 = actor.cylinder(\n centers[6:9],\n dirs[6:9],\n colors[6:9],\n radius=radius,\n heights=height,\n capped=True,\n resolution=32,\n)" + "cylinders_8 = fury.actor.cylinder(\n centers[:3],\n dirs[:3],\n colors[:3],\n radius=radius,\n heights=height,\n capped=True,\n resolution=8,\n)\ncylinders_16 = fury.actor.cylinder(\n centers[3:6],\n dirs[3:6],\n colors[3:6],\n radius=radius,\n heights=height,\n capped=True,\n resolution=16,\n)\ncylinders_32 = fury.actor.cylinder(\n centers[6:9],\n dirs[6:9],\n colors[6:9],\n radius=radius,\n heights=height,\n capped=True,\n resolution=32,\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nscene.add(cylinders_8)\nscene.add(cylinders_16)\nscene.add(cylinders_32)\n\ninteractive = False\n\nif interactive:\n window.show(scene)\n\nwindow.record(scene, size=(600, 600), out_path=\"viz_poly_cylinder.png\")" + "scene = fury.window.Scene()\n\nscene.add(cylinders_8)\nscene.add(cylinders_16)\nscene.add(cylinders_32)\n\ninteractive = False\n\nif interactive:\n fury.window.show(scene)\n\nfury.window.record(scene, size=(600, 600), out_path=\"viz_poly_cylinder.png\")" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "cylinders_8.GetProperty().SetRepresentationToWireframe()\ncylinders_16.GetProperty().SetRepresentationToWireframe()\ncylinders_32.GetProperty().SetRepresentationToWireframe()\n\nif interactive:\n window.show(scene)\n\nwindow.record(scene, size=(600, 600), out_path=\"viz_poly_cylinder_geom.png\")" + "cylinders_8.GetProperty().SetRepresentationToWireframe()\ncylinders_16.GetProperty().SetRepresentationToWireframe()\ncylinders_32.GetProperty().SetRepresentationToWireframe()\n\nif interactive:\n fury.window.show(scene)\n\nfury.window.record(scene, size=(600, 600), out_path=\"viz_poly_cylinder_geom.png\")" ] }, { @@ -130,7 +130,7 @@ }, "outputs": [], "source": [ - "box_actor = actor.box(\n centers=centers,\n directions=dirs,\n colors=colors,\n scales=(height, radius * 2, radius * 2),\n)" + "box_actor = fury.actor.box(\n centers=centers,\n directions=dirs,\n colors=colors,\n scales=(height, radius * 2, radius * 2),\n)" ] }, { @@ -148,7 +148,7 @@ }, "outputs": [], "source": [ - "rep_directions = np.repeat(dirs, 8, axis=0)\nrep_centers = np.repeat(centers, 8, axis=0)\nrep_radii = np.repeat(np.repeat(radius, 9), 8, axis=0)\nrep_heights = np.repeat(np.repeat(height, 9), 8, axis=0)\n\nattribute_to_actor(box_actor, rep_centers, \"center\")\nattribute_to_actor(box_actor, rep_directions, \"direction\")\nattribute_to_actor(box_actor, rep_radii, \"radius\")\nattribute_to_actor(box_actor, rep_heights, \"height\")" + "rep_directions = np.repeat(dirs, 8, axis=0)\nrep_centers = np.repeat(centers, 8, axis=0)\nrep_radii = np.repeat(np.repeat(radius, 9), 8, axis=0)\nrep_heights = np.repeat(np.repeat(height, 9), 8, axis=0)\n\nfury.shaders.attribute_to_actor(box_actor, rep_centers, \"center\")\nfury.shaders.attribute_to_actor(box_actor, rep_directions, \"direction\")\nfury.shaders.attribute_to_actor(box_actor, rep_radii, \"radius\")\nfury.shaders.attribute_to_actor(box_actor, rep_heights, \"height\")" ] }, { @@ -184,7 +184,7 @@ }, "outputs": [], "source": [ - "shader_to_actor(box_actor, \"vertex\", decl_code=vs_dec, impl_code=vs_impl)" + "fury.shaders.shader_to_actor(box_actor, \"vertex\", decl_code=vs_dec, impl_code=vs_impl)" ] }, { @@ -220,7 +220,7 @@ }, "outputs": [], "source": [ - "vec_to_vec_rot_mat = import_fury_shader(\n os.path.join(\"utils\", \"vec_to_vec_rot_mat.glsl\")\n)" + "vec_to_vec_rot_mat = fury.shaders.import_fury_shader(\n os.path.join(\"utils\", \"vec_to_vec_rot_mat.glsl\")\n)" ] }, { @@ -238,7 +238,7 @@ }, "outputs": [], "source": [ - "sd_cylinder = import_fury_shader(os.path.join(\"sdf\", \"sd_cylinder.frag\"))" + "sd_cylinder = fury.shaders.import_fury_shader(os.path.join(\"sdf\", \"sd_cylinder.frag\"))" ] }, { @@ -274,7 +274,7 @@ }, "outputs": [], "source": [ - "central_diffs_normal = import_fury_shader(os.path.join(\"sdf\", \"central_diffs.frag\"))" + "central_diffs_normal = fury.shaders.import_fury_shader(\n os.path.join(\"sdf\", \"central_diffs.frag\")\n)" ] }, { @@ -292,7 +292,7 @@ }, "outputs": [], "source": [ - "cast_ray = import_fury_shader(os.path.join(\"ray_marching\", \"cast_ray.frag\"))" + "cast_ray = fury.shaders.import_fury_shader(\n os.path.join(\"ray_marching\", \"cast_ray.frag\")\n)" ] }, { @@ -310,7 +310,7 @@ }, "outputs": [], "source": [ - "blinn_phong_model = import_fury_shader(\n os.path.join(\"lighting\", \"blinn_phong_model.frag\")\n)" + "blinn_phong_model = fury.shaders.import_fury_shader(\n os.path.join(\"lighting\", \"blinn_phong_model.frag\")\n)" ] }, { @@ -328,7 +328,7 @@ }, "outputs": [], "source": [ - "fs_dec = compose_shader(\n [\n fs_vars_dec,\n vec_to_vec_rot_mat,\n sd_cylinder,\n sdf_map,\n central_diffs_normal,\n cast_ray,\n blinn_phong_model,\n ]\n)\n\nshader_to_actor(box_actor, \"fragment\", decl_code=fs_dec)" + "fs_dec = fury.shaders.compose_shader(\n [\n fs_vars_dec,\n vec_to_vec_rot_mat,\n sd_cylinder,\n sdf_map,\n central_diffs_normal,\n cast_ray,\n blinn_phong_model,\n ]\n)\n\nfury.shaders.shader_to_actor(box_actor, \"fragment\", decl_code=fs_dec)" ] }, { @@ -346,7 +346,7 @@ }, "outputs": [], "source": [ - "sdf_cylinder_frag_impl = \"\"\"\n vec3 point = vertexMCVSOutput.xyz;\n\n // ray origin\n vec4 ro = -MCVCMatrix[3] * MCVCMatrix; // camera position in world space\n\n // ray direction\n vec3 rd = normalize(point - ro.xyz);\n\n // light direction\n vec3 ld = normalize(ro.xyz - point);\n\n ro += vec4((point - ro.xyz), 0);\n\n float t = castRay(ro.xyz, rd);\n\n if(t < 20.0)\n {\n vec3 position = ro.xyz + t * rd;\n vec3 normal = centralDiffsNormals(position, .0001);\n float lightAttenuation = dot(ld, normal);\n vec3 color = blinnPhongIllumModel(\n lightAttenuation, lightColor0, diffuseColor,\n specularPower, specularColor, ambientColor);\n fragOutput0 = vec4(color, opacity);\n }\n else\n {\n discard;\n }\n \"\"\"\n\nshader_to_actor(box_actor, \"fragment\", impl_code=sdf_cylinder_frag_impl, block=\"light\")" + "sdf_cylinder_frag_impl = \"\"\"\n vec3 point = vertexMCVSOutput.xyz;\n\n // ray origin\n vec4 ro = -MCVCMatrix[3] * MCVCMatrix; // camera position in world space\n\n // ray direction\n vec3 rd = normalize(point - ro.xyz);\n\n // light direction\n vec3 ld = normalize(ro.xyz - point);\n\n ro += vec4((point - ro.xyz), 0);\n\n float t = castRay(ro.xyz, rd);\n\n if(t < 20.0)\n {\n vec3 position = ro.xyz + t * rd;\n vec3 normal = centralDiffsNormals(position, .0001);\n float lightAttenuation = dot(ld, normal);\n vec3 color = blinnPhongIllumModel(\n lightAttenuation, lightColor0, diffuseColor,\n specularPower, specularColor, ambientColor);\n fragOutput0 = vec4(color, opacity);\n }\n else\n {\n discard;\n }\n \"\"\"\n\nfury.shaders.shader_to_actor(\n box_actor, \"fragment\", impl_code=sdf_cylinder_frag_impl, block=\"light\"\n)" ] }, { @@ -364,7 +364,7 @@ }, "outputs": [], "source": [ - "scene.add(box_actor)\n\nif interactive:\n window.show(scene)\n\nwindow.record(scene, size=(600, 600), out_path=\"viz_sdf_cylinder.png\")" + "scene.add(box_actor)\n\nif interactive:\n fury.window.show(scene)\n\nfury.window.record(scene, size=(600, 600), out_path=\"viz_sdf_cylinder.png\")" ] }, { diff --git a/dev/_downloads/568dd684277ffe775d64a3cfa6361d1e/viz_billboard_sdf_spheres.zip b/dev/_downloads/568dd684277ffe775d64a3cfa6361d1e/viz_billboard_sdf_spheres.zip index 4c5a4c1da..399258d36 100644 Binary files a/dev/_downloads/568dd684277ffe775d64a3cfa6361d1e/viz_billboard_sdf_spheres.zip and b/dev/_downloads/568dd684277ffe775d64a3cfa6361d1e/viz_billboard_sdf_spheres.zip differ diff --git a/dev/_downloads/57ee390aa6e8a4a632caefe5d60e0250/viz_selection.zip b/dev/_downloads/57ee390aa6e8a4a632caefe5d60e0250/viz_selection.zip index 010535151..ac3566842 100644 Binary files a/dev/_downloads/57ee390aa6e8a4a632caefe5d60e0250/viz_selection.zip and b/dev/_downloads/57ee390aa6e8a4a632caefe5d60e0250/viz_selection.zip differ diff --git a/dev/_downloads/5cd250c9f3b3f4ea2b64ca1198f2167c/viz_tesseract.ipynb b/dev/_downloads/5cd250c9f3b3f4ea2b64ca1198f2167c/viz_tesseract.ipynb index ef67b9532..0228b33f4 100644 --- a/dev/_downloads/5cd250c9f3b3f4ea2b64ca1198f2167c/viz_tesseract.ipynb +++ b/dev/_downloads/5cd250c9f3b3f4ea2b64ca1198f2167c/viz_tesseract.ipynb @@ -22,7 +22,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, utils, window\nfrom fury.ui import TextBlock2D" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -112,7 +112,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.set_camera(\n position=(0, 10, -1), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n)\nshowm = window.ShowManager(scene, size=(1920, 1080), order_transparent=True)" + "scene = fury.window.Scene()\nscene.set_camera(\n position=(0, 10, -1), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n)\nshowm = fury.window.ShowManager(scene, size=(1920, 1080), order_transparent=True)" ] }, { @@ -130,7 +130,7 @@ }, "outputs": [], "source": [ - "verts3D = rotate4D(verts4D)\nif not wireframe:\n points = actor.point(verts3D, colors=p_color)\n point_verts = utils.vertices_from_actor(points)\n no_vertices = len(point_verts) / 16\n initial_verts = point_verts.copy() - np.repeat(verts3D, no_vertices, axis=0)\n\n scene.add(points)" + "verts3D = rotate4D(verts4D)\nif not wireframe:\n points = fury.actor.point(verts3D, colors=p_color)\n point_verts = fury.utils.vertices_from_actor(points)\n no_vertices = len(point_verts) / 16\n initial_verts = point_verts.copy() - np.repeat(verts3D, no_vertices, axis=0)\n\n scene.add(points)" ] }, { @@ -148,7 +148,7 @@ }, "outputs": [], "source": [ - "lines = connect_points(verts3D)\nedges = actor.line(lines=lines, colors=e_color, lod=False, fake_tube=True, linewidth=4)\nlines_verts = utils.vertices_from_actor(edges)\ninitial_lines = lines_verts.copy() - np.reshape(lines, (-1, 3))\n\nscene.add(edges)" + "lines = connect_points(verts3D)\nedges = fury.actor.line(\n lines=lines, colors=e_color, lod=False, fake_tube=True, linewidth=4\n)\nlines_verts = fury.utils.vertices_from_actor(edges)\ninitial_lines = lines_verts.copy() - np.reshape(lines, (-1, 3))\n\nscene.add(edges)" ] }, { @@ -166,7 +166,7 @@ }, "outputs": [], "source": [ - "tb = TextBlock2D(text=\"Tesseract\", position=(900, 950), font_size=20)\nshowm.scene.add(tb)" + "tb = fury.ui.TextBlock2D(text=\"Tesseract\", position=(900, 950), font_size=20)\nshowm.scene.add(tb)" ] }, { @@ -184,7 +184,7 @@ }, "outputs": [], "source": [ - "counter = itertools.count()\nend = 200\n\n\ndef timer_callback(_obj, _event):\n global verts3D, angle\n cnt = next(counter)\n verts3D = rotate4D(verts4D)\n if not wireframe:\n point_verts[:] = initial_verts + np.repeat(verts3D, no_vertices, axis=0)\n utils.update_actor(points)\n\n lines = connect_points(verts3D)\n lines_verts[:] = initial_lines + np.reshape(lines, (-1, 3))\n utils.update_actor(edges)\n\n showm.render()\n angle += dtheta\n\n if cnt == end:\n showm.exit()" + "counter = itertools.count()\nend = 200\n\n\ndef timer_callback(_obj, _event):\n global verts3D, angle\n cnt = next(counter)\n verts3D = rotate4D(verts4D)\n if not wireframe:\n point_verts[:] = initial_verts + np.repeat(verts3D, no_vertices, axis=0)\n fury.utils.update_actor(points)\n\n lines = connect_points(verts3D)\n lines_verts[:] = initial_lines + np.reshape(lines, (-1, 3))\n fury.utils.update_actor(edges)\n\n showm.render()\n angle += dtheta\n\n if cnt == end:\n showm.exit()" ] }, { @@ -202,7 +202,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 20, timer_callback)\nshowm.start()\nwindow.record(showm.scene, size=(600, 600), out_path=\"viz_tesseract.png\")" + "showm.add_timer_callback(True, 20, timer_callback)\nshowm.start()\nfury.window.record(showm.scene, size=(600, 600), out_path=\"viz_tesseract.png\")" ] } ], diff --git a/dev/_downloads/5efd96037f0b528a5239a3eedeecde01/viz_solar_system.py b/dev/_downloads/5efd96037f0b528a5239a3eedeecde01/viz_solar_system.py index 2e60bb351..ffd495d0d 100644 --- a/dev/_downloads/5efd96037f0b528a5239a3eedeecde01/viz_solar_system.py +++ b/dev/_downloads/5efd96037f0b528a5239a3eedeecde01/viz_solar_system.py @@ -13,21 +13,24 @@ import numpy as np -from fury import actor, io, ui, utils, window -from fury.data import fetch_viz_textures, read_viz_icons, read_viz_textures +import fury ############################################################################## # Create a scene to start. -scene = window.Scene() +scene = fury.window.Scene() # Create a panel and the start/pause buttons -panel = ui.Panel2D(size=(300, 100), color=(1, 1, 1), align="right") +panel = fury.ui.Panel2D(size=(300, 100), color=(1, 1, 1), align="right") panel.center = (400, 50) -pause_button = ui.Button2D(icon_fnames=[("square", read_viz_icons(fname="pause2.png"))]) -start_button = ui.Button2D(icon_fnames=[("square", read_viz_icons(fname="play3.png"))]) +pause_button = fury.ui.Button2D( + icon_fnames=[("square", fury.data.read_viz_icons(fname="pause2.png"))] +) +start_button = fury.ui.Button2D( + icon_fnames=[("square", fury.data.read_viz_icons(fname="play3.png"))] +) # Add the buttons on the panel @@ -91,7 +94,7 @@ }, {"filename": "8k_sun.jpg", "position": 0, "earth_days": 27, "scale": (5, 5, 5)}, ] -fetch_viz_textures() +fury.data.fetch_viz_textures() ############################################################################## # To take advantage of the previously defined data structure we are going to @@ -114,12 +117,12 @@ def init_planet(planet_data): planet_actor: actor The corresponding sphere actor with texture applied. """ - planet_file = read_viz_textures(planet_data["filename"]) - planet_image = io.load_image(planet_file) - planet_actor = actor.texture_on_sphere(planet_image) + planet_file = fury.data.read_viz_textures(planet_data["filename"]) + planet_image = fury.io.load_image(planet_file) + planet_actor = fury.actor.texture_on_sphere(planet_image) planet_actor.SetPosition(planet_data["position"], 0, 0) if planet_data["filename"] != "8k_saturn_ring_alpha.png": - utils.rotate(planet_actor, (90, 1, 0, 0)) + fury.utils.rotate(planet_actor, (90, 1, 0, 0)) planet_actor.SetScale(planet_data["scale"]) scene.add(planet_actor) return planet_actor @@ -185,7 +188,7 @@ def get_orbital_position(radius, time): def rotate_axial(actor, time, radius): axis = (0, radius, 0) angle = 50 / time - utils.rotate(actor, (angle, axis[0], axis[1], axis[2])) + fury.utils.rotate(actor, (angle, axis[0], axis[1], axis[2])) return angle @@ -198,7 +201,7 @@ def rotate_axial(actor, time, radius): # Next, create a ShowManager object. The ShowManager class is the interface # between the scene, the window and the interactor. -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) scene.add(panel) @@ -277,7 +280,7 @@ def calculate_path(r_planet, c): # This is for orbit visualization. We are using line actor for orbits. # After creating an actor we add it to the scene. -orbit_actor = actor.line(planet_tracks, colors=(1, 1, 1), linewidth=0.1) +orbit_actor = fury.actor.line(planet_tracks, colors=(1, 1, 1), linewidth=0.1) scene.add(orbit_actor) ############################################################################## @@ -331,4 +334,6 @@ def pause_animation(i_ren, _obj, _button): showm.add_timer_callback(True, 10, timer_callback) showm.start() -window.record(showm.scene, size=(900, 768), out_path="viz_solar_system_animation.png") +fury.window.record( + showm.scene, size=(900, 768), out_path="viz_solar_system_animation.png" +) diff --git a/dev/_downloads/6029834e15834dbb021718f73b5f56ad/viz_shader.ipynb b/dev/_downloads/6029834e15834dbb021718f73b5f56ad/viz_shader.ipynb index c970fb960..3ffb286c2 100644 --- a/dev/_downloads/6029834e15834dbb021718f73b5f56ad/viz_shader.ipynb +++ b/dev/_downloads/6029834e15834dbb021718f73b5f56ad/viz_shader.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "\n# Varying Color\n\nThis example shows how to use shaders to generate a shaded output. We will\ndemonstrate how to load polydata then use a custom shader calls to render\na custom shaded model.\nFirst, a bunch of imports.\n" + "\n# Varying Color\n\nThis example shows how to use shaders to generate a shaded output. We will\ndemonstrate how to load polydata then use a custom shader calls to render\na custom shaded model.\nFirst, let's import FURY\n" ] }, { @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import io, ui, utils, window\nfrom fury.data.fetcher import fetch_viz_models, read_viz_models\nfrom fury.shaders import add_shader_callback, shader_to_actor" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_models()\nmodel = read_viz_models(\"utah.obj\")" + "fury.data.fetch_viz_models()\nmodel = fury.data.read_viz_models(\"utah.obj\")" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "utah = io.load_polydata(model)\nutah = utils.get_polymapper_from_polydata(utah)\nutah = utils.get_actor_from_polymapper(utah)\nmapper = utah.GetMapper()" + "utah = fury.io.load_polydata(model)\nutah = fury.utils.get_polymapper_from_polydata(utah)\nutah = fury.utils.get_actor_from_polymapper(utah)\nmapper = utah.GetMapper()" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "vertex_shader_code_decl = \"\"\"\n out vec4 myVertexVC;\n \"\"\"\n\nvertex_shader_code_impl = \"\"\"\n myVertexVC = vertexMC;\n \"\"\"\n\nfragment_shader_code_decl = \"\"\"\n uniform float time;\n varying vec4 myVertexVC;\n \"\"\"\n\nfragment_shader_code_impl = \"\"\"\n vec2 iResolution = vec2(1024,720);\n vec2 uv = myVertexVC.xy/iResolution;\n vec3 col = 0.5 + 0.5 * cos((time/30) + uv.xyx + vec3(0, 2, 4));\n fragOutput0 = vec4(col, fragOutput0.a);\n \"\"\"\n\nshader_to_actor(\n utah, \"vertex\", impl_code=vertex_shader_code_impl, decl_code=vertex_shader_code_decl\n)\nshader_to_actor(utah, \"fragment\", decl_code=fragment_shader_code_decl)\nshader_to_actor(utah, \"fragment\", impl_code=fragment_shader_code_impl, block=\"light\")" + "vertex_shader_code_decl = \"\"\"\n out vec4 myVertexVC;\n \"\"\"\n\nvertex_shader_code_impl = \"\"\"\n myVertexVC = vertexMC;\n \"\"\"\n\nfragment_shader_code_decl = \"\"\"\n uniform float time;\n varying vec4 myVertexVC;\n \"\"\"\n\nfragment_shader_code_impl = \"\"\"\n vec2 iResolution = vec2(1024,720);\n vec2 uv = myVertexVC.xy/iResolution;\n vec3 col = 0.5 + 0.5 * cos((time/30) + uv.xyx + vec3(0, 2, 4));\n fragOutput0 = vec4(col, fragOutput0.a);\n \"\"\"\n\nfury.shaders.shader_to_actor(\n utah, \"vertex\", impl_code=vertex_shader_code_impl, decl_code=vertex_shader_code_decl\n)\nfury.shaders.shader_to_actor(utah, \"fragment\", decl_code=fragment_shader_code_decl)\nfury.shaders.shader_to_actor(\n utah, \"fragment\", impl_code=fragment_shader_code_impl, block=\"light\"\n)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nglobal timer\ntimer = 0" + "scene = fury.window.Scene()\n\nglobal timer\ntimer = 0" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "def shader_callback(_caller, _event, calldata=None):\n program = calldata\n global timer\n if program is not None:\n try:\n program.SetUniformf(\"time\", timer)\n except ValueError:\n pass\n\n\nadd_shader_callback(utah, shader_callback)" + "def shader_callback(_caller, _event, calldata=None):\n program = calldata\n global timer\n if program is not None:\n try:\n program.SetUniformf(\"time\", timer)\n except ValueError:\n pass\n\n\nfury.shaders.add_shader_callback(utah, shader_callback)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "tb = ui.TextBlock2D()\ntb.message = \"Hello Shaders\"" + "tb = fury.ui.TextBlock2D()\ntb.message = \"Hello Shaders\"" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "current_size = (1024, 720)\nshowm = window.ShowManager(scene, size=current_size, reset_camera=False)\n\n\nshowm.add_timer_callback(True, 30, timer_callback)\n\nscene.add(utah)\nscene.add(tb)\n\ninteractive = False\nif interactive:\n showm.start()\n\nwindow.record(showm.scene, size=current_size, out_path=\"viz_shader.png\")" + "current_size = (1024, 720)\nshowm = fury.window.ShowManager(scene, size=current_size, reset_camera=False)\n\n\nshowm.add_timer_callback(True, 30, timer_callback)\n\nscene.add(utah)\nscene.add(tb)\n\ninteractive = False\nif interactive:\n showm.start()\n\nfury.window.record(showm.scene, size=current_size, out_path=\"viz_shader.png\")" ] } ], diff --git a/dev/_downloads/618515f9a1bb764be117d6b54207859a/viz_slice.py b/dev/_downloads/618515f9a1bb764be117d6b54207859a/viz_slice.py index 0a8c01303..e198b5aca 100644 --- a/dev/_downloads/618515f9a1bb764be117d6b54207859a/viz_slice.py +++ b/dev/_downloads/618515f9a1bb764be117d6b54207859a/viz_slice.py @@ -11,7 +11,7 @@ from dipy.data import fetch_bundles_2_subjects import nibabel as nib -from fury import actor, ui, window +import fury ############################################################################### # Let's download and load a T1. @@ -35,7 +35,7 @@ ############################################################################### # Create a Scene object which holds all the actors which we want to visualize. -scene = window.Scene() +scene = fury.window.Scene() scene.background((0.5, 0.5, 0.5)) ############################################################################### @@ -53,7 +53,7 @@ # transformation matrix. The default behavior of this function is to show the # middle slice of the last dimension of the resampled data. -slice_actor = actor.slicer(data, affine, value_range) +slice_actor = fury.actor.slicer(data, affine, value_range) ############################################################################### # The ``slice_actor`` contains an axial slice. @@ -81,12 +81,12 @@ ############################################################################### # In order to interact with the data you will need to uncomment the line below. -# window.show(scene, size=(600, 600), reset_camera=False) +# fury.window.show(scene, size=(600, 600), reset_camera=False) ############################################################################### # Otherwise, you can save a screenshot using the following command. -window.record(scene, out_path="slices.png", size=(600, 600), reset_camera=False) +fury.window.record(scene, out_path="slices.png", size=(600, 600), reset_camera=False) ############################################################################### # Render slices from FA with your colormap @@ -111,7 +111,7 @@ ############################################################################### # Notice here how the scale range is. We use FA min and max values to set it up -lut = actor.colormap_lookup_table( +lut = fury.actor.colormap_lookup_table( scale_range=(fa.min(), fa.max()), hue_range=(0.4, 1.0), saturation_range=(1, 1.0), @@ -122,7 +122,7 @@ # This is because the lookup table is applied in the slice after interpolating # to (0, 255). -fa_actor = actor.slicer(fa, affine, lookup_colormap=lut) +fa_actor = fury.actor.slicer(fa, affine, lookup_colormap=lut) scene.clear() scene.add(fa_actor) @@ -130,9 +130,11 @@ scene.reset_camera() scene.zoom(1.4) -# window.show(scene, size=(600, 600), reset_camera=False) +# fury.window.show(scene, size=(600, 600), reset_camera=False) -window.record(scene, out_path="slices_lut.png", size=(600, 600), reset_camera=False) +fury.window.record( + scene, out_path="slices_lut.png", size=(600, 600), reset_camera=False +) ############################################################################### # Now we would like to add the ability to click on a voxel and show its value @@ -142,19 +144,19 @@ # the ``ShowManager`` object, which allows accessing the pipeline in different # areas. -show_m = window.ShowManager(scene, size=(1200, 900)) +show_m = fury.window.ShowManager(scene, size=(1200, 900)) ############################################################################### # We'll start by creating the panel and adding it to the ``ShowManager`` -label_position = ui.TextBlock2D(text="Position:") -label_value = ui.TextBlock2D(text="Value:") +label_position = fury.ui.TextBlock2D(text="Position:") +label_value = fury.ui.TextBlock2D(text="Value:") -result_position = ui.TextBlock2D(text="") -result_value = ui.TextBlock2D(text="") +result_position = fury.ui.TextBlock2D(text="") +result_value = fury.ui.TextBlock2D(text="") -panel_picking = ui.Panel2D( +panel_picking = fury.ui.Panel2D( size=(250, 125), position=(20, 20), color=(0, 0, 0), opacity=0.75, align="left" ) @@ -203,7 +205,7 @@ def left_click_callback(obj, _ev): result_position.message = "" result_value.message = "" -show_m_mosaic = window.ShowManager(scene, size=(1200, 900)) +show_m_mosaic = fury.window.ShowManager(scene, size=(1200, 900)) def left_click_callback_mosaic(obj, _ev): @@ -260,4 +262,4 @@ def left_click_callback_mosaic(obj, _ev): # zoom in/out using the scroll wheel, and pick voxels with left click. -window.record(scene, out_path="mosaic.png", size=(900, 600), reset_camera=False) +fury.window.record(scene, out_path="mosaic.png", size=(900, 600), reset_camera=False) diff --git a/dev/_downloads/65de8bc78ef146e5712856a9fe0b2450/viz_emwave_animation.ipynb b/dev/_downloads/65de8bc78ef146e5712856a9fe0b2450/viz_emwave_animation.ipynb index 9118eaa5d..c653bd8a5 100644 --- a/dev/_downloads/65de8bc78ef146e5712856a9fe0b2450/viz_emwave_animation.ipynb +++ b/dev/_downloads/65de8bc78ef146e5712856a9fe0b2450/viz_emwave_animation.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, ui, utils, window" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.set_camera(\n position=(-6, 5, -10), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n)\nshowm = window.ShowManager(\n scene, size=(800, 600), reset_camera=True, order_transparent=True\n)" + "scene = fury.window.Scene()\nscene.set_camera(\n position=(-6, 5, -10), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n)\nshowm = fury.window.ShowManager(\n scene, size=(800, 600), reset_camera=True, order_transparent=True\n)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "centers = np.array([[3, 0, 0]])\ndirections = np.array([[-1, 0, 0]])\nheights = np.array([6.4])\narrow_actor = actor.arrow(\n centers,\n directions,\n window.colors.yellow,\n heights,\n resolution=20,\n tip_length=0.06,\n tip_radius=0.012,\n shaft_radius=0.005,\n)\nscene.add(arrow_actor)" + "centers = np.array([[3, 0, 0]])\ndirections = np.array([[-1, 0, 0]])\nheights = np.array([6.4])\narrow_actor = fury.actor.arrow(\n centers,\n directions,\n fury.window.colors.yellow,\n heights,\n resolution=20,\n tip_length=0.06,\n tip_radius=0.012,\n shaft_radius=0.005,\n)\nscene.add(arrow_actor)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "x = np.linspace(-3, 3, npoints)\ny = np.sin(wavenumber * x - angular_frq * time + phase_angle)\nz = np.array([0 for i in range(npoints)])\n\npts = np.array(list(zip(x, y, z)))\npts = [pts]\ncolors = window.colors.red\nwave_actor1 = actor.line(pts, colors, linewidth=3)\nscene.add(wave_actor1)\n\nvertices = utils.vertices_from_actor(wave_actor1)\nvcolors = utils.colors_from_actor(wave_actor1, \"colors\")\nno_vertices_per_point = len(vertices) / npoints\ninitial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0)" + "x = np.linspace(-3, 3, npoints)\ny = np.sin(wavenumber * x - angular_frq * time + phase_angle)\nz = np.array([0 for i in range(npoints)])\n\npts = np.array(list(zip(x, y, z)))\npts = [pts]\ncolors = fury.window.colors.red\nwave_actor1 = fury.actor.line(pts, colors, linewidth=3)\nscene.add(wave_actor1)\n\nvertices = fury.utils.vertices_from_actor(wave_actor1)\nvcolors = fury.utils.colors_from_actor(wave_actor1, \"colors\")\nno_vertices_per_point = len(vertices) / npoints\ninitial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "xx = np.linspace(-3, 3, npoints)\nyy = np.array([0 for i in range(npoints)])\nzz = np.sin(wavenumber * xx - angular_frq * time + phase_angle)\n\npts2 = np.array(list(zip(xx, yy, zz)))\npts2 = [pts2]\ncolors2 = window.colors.blue\nwave_actor2 = actor.line(pts2, colors2, linewidth=3)\nscene.add(wave_actor2)\n\nvertices2 = utils.vertices_from_actor(wave_actor2)\nvcolors2 = utils.colors_from_actor(wave_actor2, \"colors\")\nno_vertices_per_point2 = len(vertices2) / npoints\ninitial_vertices2 = vertices2.copy() - np.repeat(pts2, no_vertices_per_point2, axis=0)" + "xx = np.linspace(-3, 3, npoints)\nyy = np.array([0 for i in range(npoints)])\nzz = np.sin(wavenumber * xx - angular_frq * time + phase_angle)\n\npts2 = np.array(list(zip(xx, yy, zz)))\npts2 = [pts2]\ncolors2 = fury.window.colors.blue\nwave_actor2 = fury.actor.line(pts2, colors2, linewidth=3)\nscene.add(wave_actor2)\n\nvertices2 = fury.utils.vertices_from_actor(wave_actor2)\nvcolors2 = fury.utils.colors_from_actor(wave_actor2, \"colors\")\nno_vertices_per_point2 = len(vertices2) / npoints\ninitial_vertices2 = vertices2.copy() - np.repeat(pts2, no_vertices_per_point2, axis=0)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "tb = ui.TextBlock2D(bold=True, position=(160, 90))\ntb.message = \"Electromagnetic Wave\"\nscene.add(tb)" + "tb = fury.ui.TextBlock2D(bold=True, position=(160, 90))\ntb.message = \"Electromagnetic Wave\"\nscene.add(tb)" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "def timer_callback(_obj, _event):\n global pts, pts2, time, time_incre, angular_frq, phase_angle, wavenumber\n time += incre_time\n cnt = next(counter)\n\n x, y, z = update_coordinates(wavenumber, angular_frq, phase_angle, time)\n pts = np.array(list(zip(x, y, z)))\n vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0)\n utils.update_actor(wave_actor1)\n\n xx, zz, yy = update_coordinates(wavenumber, angular_frq, phase_angle, time)\n pts2 = np.array(list(zip(xx, yy, zz)))\n vertices2[:] = initial_vertices2 + np.repeat(pts2, no_vertices_per_point2, axis=0)\n utils.update_actor(wave_actor2)\n\n showm.render()\n\n # to end the animation\n if cnt == end:\n showm.exit()" + "def timer_callback(_obj, _event):\n global pts, pts2, time, time_incre, angular_frq, phase_angle, wavenumber\n time += incre_time\n cnt = next(counter)\n\n x, y, z = update_coordinates(wavenumber, angular_frq, phase_angle, time)\n pts = np.array(list(zip(x, y, z)))\n vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0)\n fury.utils.update_actor(wave_actor1)\n\n xx, zz, yy = update_coordinates(wavenumber, angular_frq, phase_angle, time)\n pts2 = np.array(list(zip(xx, yy, zz)))\n vertices2[:] = initial_vertices2 + np.repeat(pts2, no_vertices_per_point2, axis=0)\n fury.utils.update_actor(wave_actor2)\n\n showm.render()\n\n # to end the animation\n if cnt == end:\n showm.exit()" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 25, timer_callback)\n\ninteractive = False\nif interactive:\n showm.start()\nwindow.record(showm.scene, size=(800, 600), out_path=\"viz_emwave.png\")" + "showm.add_timer_callback(True, 25, timer_callback)\n\ninteractive = False\nif interactive:\n showm.start()\nfury.window.record(showm.scene, size=(800, 600), out_path=\"viz_emwave.png\")" ] } ], diff --git a/dev/_downloads/66f40585867173501e01adbff794b50a/viz_robot_arm_animation.zip b/dev/_downloads/66f40585867173501e01adbff794b50a/viz_robot_arm_animation.zip index 25403688e..dbb41bd8a 100644 Binary files a/dev/_downloads/66f40585867173501e01adbff794b50a/viz_robot_arm_animation.zip and b/dev/_downloads/66f40585867173501e01adbff794b50a/viz_robot_arm_animation.zip differ diff --git a/dev/_downloads/6810378b283a7a1bc8664ba73145aee0/viz_advanced.zip b/dev/_downloads/6810378b283a7a1bc8664ba73145aee0/viz_advanced.zip index ac3687d7a..12df6afcf 100644 Binary files a/dev/_downloads/6810378b283a7a1bc8664ba73145aee0/viz_advanced.zip and b/dev/_downloads/6810378b283a7a1bc8664ba73145aee0/viz_advanced.zip differ diff --git a/dev/_downloads/69f639d75866694297da02c7497b2673/viz_check_boxes.zip b/dev/_downloads/69f639d75866694297da02c7497b2673/viz_check_boxes.zip index fde5871a7..17cf344b7 100644 Binary files a/dev/_downloads/69f639d75866694297da02c7497b2673/viz_check_boxes.zip and b/dev/_downloads/69f639d75866694297da02c7497b2673/viz_check_boxes.zip differ diff --git a/dev/_downloads/6beeb7a237877e054f039827371f2e22/viz_slice.ipynb b/dev/_downloads/6beeb7a237877e054f039827371f2e22/viz_slice.ipynb index 33e114ada..2b590a6f0 100644 --- a/dev/_downloads/6beeb7a237877e054f039827371f2e22/viz_slice.ipynb +++ b/dev/_downloads/6beeb7a237877e054f039827371f2e22/viz_slice.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import os\n\nfrom dipy.data import fetch_bundles_2_subjects\nimport nibabel as nib\n\nfrom fury import actor, ui, window" + "import os\n\nfrom dipy.data import fetch_bundles_2_subjects\nimport nibabel as nib\n\nimport fury" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.background((0.5, 0.5, 0.5))" + "scene = fury.window.Scene()\nscene.background((0.5, 0.5, 0.5))" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "slice_actor = actor.slicer(data, affine, value_range)" + "slice_actor = fury.actor.slicer(data, affine, value_range)" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "# window.show(scene, size=(600, 600), reset_camera=False)" + "# fury.window.show(scene, size=(600, 600), reset_camera=False)" ] }, { @@ -177,7 +177,7 @@ }, "outputs": [], "source": [ - "window.record(scene, out_path=\"slices.png\", size=(600, 600), reset_camera=False)" + "fury.window.record(scene, out_path=\"slices.png\", size=(600, 600), reset_camera=False)" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "lut = actor.colormap_lookup_table(\n scale_range=(fa.min(), fa.max()),\n hue_range=(0.4, 1.0),\n saturation_range=(1, 1.0),\n value_range=(0.0, 1.0),\n)" + "lut = fury.actor.colormap_lookup_table(\n scale_range=(fa.min(), fa.max()),\n hue_range=(0.4, 1.0),\n saturation_range=(1, 1.0),\n value_range=(0.0, 1.0),\n)" ] }, { @@ -231,7 +231,7 @@ }, "outputs": [], "source": [ - "fa_actor = actor.slicer(fa, affine, lookup_colormap=lut)\n\nscene.clear()\nscene.add(fa_actor)\n\nscene.reset_camera()\nscene.zoom(1.4)\n\n# window.show(scene, size=(600, 600), reset_camera=False)\n\nwindow.record(scene, out_path=\"slices_lut.png\", size=(600, 600), reset_camera=False)" + "fa_actor = fury.actor.slicer(fa, affine, lookup_colormap=lut)\n\nscene.clear()\nscene.add(fa_actor)\n\nscene.reset_camera()\nscene.zoom(1.4)\n\n# fury.window.show(scene, size=(600, 600), reset_camera=False)\n\nfury.window.record(\n scene, out_path=\"slices_lut.png\", size=(600, 600), reset_camera=False\n)" ] }, { @@ -249,7 +249,7 @@ }, "outputs": [], "source": [ - "show_m = window.ShowManager(scene, size=(1200, 900))" + "show_m = fury.window.ShowManager(scene, size=(1200, 900))" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "label_position = ui.TextBlock2D(text=\"Position:\")\nlabel_value = ui.TextBlock2D(text=\"Value:\")\n\nresult_position = ui.TextBlock2D(text=\"\")\nresult_value = ui.TextBlock2D(text=\"\")\n\npanel_picking = ui.Panel2D(\n size=(250, 125), position=(20, 20), color=(0, 0, 0), opacity=0.75, align=\"left\"\n)\n\npanel_picking.add_element(label_position, (0.1, 0.55))\npanel_picking.add_element(label_value, (0.1, 0.25))\n\npanel_picking.add_element(result_position, (0.45, 0.55))\npanel_picking.add_element(result_value, (0.45, 0.25))\n\nshow_m.scene.add(panel_picking)" + "label_position = fury.ui.TextBlock2D(text=\"Position:\")\nlabel_value = fury.ui.TextBlock2D(text=\"Value:\")\n\nresult_position = fury.ui.TextBlock2D(text=\"\")\nresult_value = fury.ui.TextBlock2D(text=\"\")\n\npanel_picking = fury.ui.Panel2D(\n size=(250, 125), position=(20, 20), color=(0, 0, 0), opacity=0.75, align=\"left\"\n)\n\npanel_picking.add_element(label_position, (0.1, 0.55))\npanel_picking.add_element(label_value, (0.1, 0.25))\n\npanel_picking.add_element(result_position, (0.45, 0.55))\npanel_picking.add_element(result_value, (0.45, 0.25))\n\nshow_m.scene.add(panel_picking)" ] }, { @@ -303,7 +303,7 @@ }, "outputs": [], "source": [ - "scene.clear()\nscene.projection(\"parallel\")\n\nresult_position.message = \"\"\nresult_value.message = \"\"\n\nshow_m_mosaic = window.ShowManager(scene, size=(1200, 900))\n\n\ndef left_click_callback_mosaic(obj, _ev):\n \"\"\"Get the value of the clicked voxel and show it in the panel.\"\"\"\n event_pos = show_m_mosaic.iren.GetEventPosition()\n\n obj.picker.Pick(event_pos[0], event_pos[1], 0, show_m_mosaic.scene)\n\n i, j, k = obj.picker.GetPointIJK()\n result_position.message = \"({}, {}, {})\".format(str(i), str(j), str(k))\n result_value.message = \"%.8f\" % data[i, j, k]" + "scene.clear()\nscene.projection(\"parallel\")\n\nresult_position.message = \"\"\nresult_value.message = \"\"\n\nshow_m_mosaic = fury.window.ShowManager(scene, size=(1200, 900))\n\n\ndef left_click_callback_mosaic(obj, _ev):\n \"\"\"Get the value of the clicked voxel and show it in the panel.\"\"\"\n event_pos = show_m_mosaic.iren.GetEventPosition()\n\n obj.picker.Pick(event_pos[0], event_pos[1], 0, show_m_mosaic.scene)\n\n i, j, k = obj.picker.GetPointIJK()\n result_position.message = \"({}, {}, {})\".format(str(i), str(j), str(k))\n result_value.message = \"%.8f\" % data[i, j, k]" ] }, { @@ -339,7 +339,7 @@ }, "outputs": [], "source": [ - "window.record(scene, out_path=\"mosaic.png\", size=(900, 600), reset_camera=False)" + "fury.window.record(scene, out_path=\"mosaic.png\", size=(900, 600), reset_camera=False)" ] } ], diff --git a/dev/_downloads/6c96eb02c681c5d07657058bc1adec71/viz_network_animated.py b/dev/_downloads/6c96eb02c681c5d07657058bc1adec71/viz_network_animated.py index d68a19e4c..2f144a411 100644 --- a/dev/_downloads/6c96eb02c681c5d07657058bc1adec71/viz_network_animated.py +++ b/dev/_downloads/6c96eb02c681c5d07657058bc1adec71/viz_network_animated.py @@ -18,8 +18,7 @@ import numpy as np -from fury import actor, colormap as cmap, window -from fury.utils import compute_bounds, update_actor, vertices_from_actor +import fury ############################################################################### # This demo has two modes. @@ -72,7 +71,7 @@ index2category = np.unique(categories) -category_colors = cmap.distinguishable_colormap(nb_colors=len(index2category)) +category_colors = fury.colormap.distinguishable_colormap(nb_colors=len(index2category)) colors = np.array( [category_colors[category2index[category]] for category in categories] @@ -98,12 +97,12 @@ # build 2 actors that we represent our data : sphere_actor for the nodes and # lines_actor for the edges. -sphere_actor = actor.sphere( +sphere_actor = fury.actor.sphere( centers=np.zeros(positions.shape), colors=colors, radii=radii * 0.5, theta=8, phi=8 ) -lines_actor = actor.line( +lines_actor = fury.actor.line( np.zeros((len(edges), 2, 3)), colors=edges_colors, lod=False, @@ -129,7 +128,7 @@ def new_layout_timer( b = 1.0 deltaT = 1.0 - sphere_geometry = np.array(vertices_from_actor(sphere_actor)) + sphere_geometry = np.array(fury.utils.vertices_from_actor(sphere_actor)) geometry_length = sphere_geometry.shape[0] / vertices_count if vertex_initial_positions is not None: @@ -199,18 +198,18 @@ def _timer(_obj, _event): iterate(1) else: pos[:] += (np.random.random(pos.shape) - 0.5) * 1.5 - spheres_positions = vertices_from_actor(sphere_actor) + spheres_positions = fury.utils.vertices_from_actor(sphere_actor) spheres_positions[:] = sphere_geometry + np.repeat(pos, geometry_length, axis=0) - edges_positions = vertices_from_actor(lines_actor) + edges_positions = fury.utils.vertices_from_actor(lines_actor) edges_positions[::2] = pos[edges_list[:, 0]] edges_positions[1::2] = pos[edges_list[:, 1]] - update_actor(lines_actor) - compute_bounds(lines_actor) + fury.utils.update_actor(lines_actor) + fury.utils.compute_bounds(lines_actor) - update_actor(sphere_actor) - compute_bounds(lines_actor) + fury.utils.update_actor(sphere_actor) + fury.utils.compute_bounds(lines_actor) showm.scene.reset_clipping_range() showm.render() @@ -225,7 +224,7 @@ def _timer(_obj, _event): # lines_actor and sphere_actor. -scene = window.Scene() +scene = fury.window.Scene() camera = scene.camera() @@ -238,7 +237,7 @@ def _timer(_obj, _event): # parameter max_iteractions of the timer callback to let the animation run for # more time. -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, reset_camera=False, size=(900, 768), order_transparent=True, multi_samples=8 ) @@ -255,4 +254,4 @@ def _timer(_obj, _event): showm.start() -window.record(showm.scene, size=(900, 768), out_path="viz_animated_networks.png") +fury.window.record(showm.scene, size=(900, 768), out_path="viz_animated_networks.png") diff --git a/dev/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip b/dev/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip index e1a339e36..4a311cd90 100644 Binary files a/dev/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip and b/dev/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip differ diff --git a/dev/_downloads/6f651295e5bc4bc569be5f51657eaee5/viz_tab.ipynb b/dev/_downloads/6f651295e5bc4bc569be5f51657eaee5/viz_tab.ipynb index 9eb2ea117..f7103b740 100644 --- a/dev/_downloads/6f651295e5bc4bc569be5f51657eaee5/viz_tab.ipynb +++ b/dev/_downloads/6f651295e5bc4bc569be5f51657eaee5/viz_tab.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, ui, window\nfrom fury.data import fetch_viz_icons" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True)" + "tab_ui = fury.ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "ring_slider = ui.RingSlider2D(initial_value=0, text_template=\"{angle:5.1f}\u00b0\")\n\nline_slider_x = ui.LineSlider2D(\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"horizontal\",\n text_alignment=\"Top\",\n)\n\nline_slider_y = ui.LineSlider2D(\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"vertical\",\n text_alignment=\"Right\",\n)\n\ncube = actor.box(\n centers=np.array([[10, 0, 0]]),\n directions=np.array([[0, 1, 0]]),\n colors=np.array([[0, 0, 1]]),\n scales=np.array([[1, 1, 1]]),\n)\ncube_x = 0\ncube_y = 0\n\n\ndef rotate_cube(slider):\n angle = slider.value\n previous_angle = slider.previous_value\n rotation_angle = angle - previous_angle\n cube.RotateX(rotation_angle)\n\n\ndef translate_cube_x(slider):\n global cube_x, cube_y\n cube_x = slider.value\n cube.SetPosition(cube_x, cube_y, 0)\n\n\ndef translate_cube_y(slider):\n global cube_x, cube_y\n cube_y = slider.value\n cube.SetPosition(cube_x, cube_y, 0)\n\n\nring_slider.on_change = rotate_cube\nline_slider_x.on_change = translate_cube_x\nline_slider_y.on_change = translate_cube_y" + "ring_slider = fury.ui.RingSlider2D(initial_value=0, text_template=\"{angle:5.1f}\u00b0\")\n\nline_slider_x = fury.ui.LineSlider2D(\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"horizontal\",\n text_alignment=\"Top\",\n)\n\nline_slider_y = fury.ui.LineSlider2D(\n initial_value=0,\n min_value=-10,\n max_value=10,\n orientation=\"vertical\",\n text_alignment=\"Right\",\n)\n\ncube = fury.actor.box(\n centers=np.array([[10, 0, 0]]),\n directions=np.array([[0, 1, 0]]),\n colors=np.array([[0, 0, 1]]),\n scales=np.array([[1, 1, 1]]),\n)\ncube_x = 0\ncube_y = 0\n\n\ndef rotate_cube(slider):\n angle = slider.value\n previous_angle = slider.previous_value\n rotation_angle = angle - previous_angle\n cube.RotateX(rotation_angle)\n\n\ndef translate_cube_x(slider):\n global cube_x, cube_y\n cube_x = slider.value\n cube.SetPosition(cube_x, cube_y, 0)\n\n\ndef translate_cube_y(slider):\n global cube_x, cube_y\n cube_y = slider.value\n cube.SetPosition(cube_x, cube_y, 0)\n\n\nring_slider.on_change = rotate_cube\nline_slider_x.on_change = translate_cube_x\nline_slider_y.on_change = translate_cube_y" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "cylinder = actor.cylinder(\n centers=np.array([[0, 0, 0]]),\n directions=np.array([[1, 1, 0]]),\n colors=np.array([[0, 1, 1]]),\n radius=1.0,\n)\n\nsphere = actor.sphere(centers=np.array([[5, 0, 0]]), colors=(1, 1, 0))\n\nfigure_dict = {\"cylinder\": cylinder, \"sphere\": sphere}\ncheckbox = ui.Checkbox(labels=[\"cylinder\", \"sphere\"])\n\n\n# Get difference between two lists.\ndef sym_diff(l1, l2):\n return list(set(l1).symmetric_difference(set(l2)))\n\n\n# Set Visibility of the figures\ndef set_figure_visiblity(checkboxes):\n checked = checkboxes.checked_labels\n unchecked = sym_diff(list(figure_dict), checked)\n\n for visible in checked:\n figure_dict[visible].SetVisibility(True)\n\n for invisible in unchecked:\n figure_dict[invisible].SetVisibility(False)\n\n\ncheckbox.on_change = set_figure_visiblity" + "cylinder = fury.actor.cylinder(\n centers=np.array([[0, 0, 0]]),\n directions=np.array([[1, 1, 0]]),\n colors=np.array([[0, 1, 1]]),\n radius=1.0,\n)\n\nsphere = fury.actor.sphere(centers=np.array([[5, 0, 0]]), colors=(1, 1, 0))\n\nfigure_dict = {\"cylinder\": cylinder, \"sphere\": sphere}\ncheckbox = fury.ui.Checkbox(labels=[\"cylinder\", \"sphere\"])\n\n\n# Get difference between two lists.\ndef sym_diff(l1, l2):\n return list(set(l1).symmetric_difference(set(l2)))\n\n\n# Set Visibility of the figures\ndef set_figure_visiblity(checkboxes):\n checked = checkboxes.checked_labels\n unchecked = sym_diff(list(figure_dict), checked)\n\n for visible in checked:\n figure_dict[visible].SetVisibility(True)\n\n for invisible in unchecked:\n figure_dict[invisible].SetVisibility(False)\n\n\ncheckbox.on_change = set_figure_visiblity" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "label = ui.TextBlock2D(\n position=(600, 300),\n font_size=40,\n color=(1, 0.5, 0),\n justification=\"center\",\n vertical_justification=\"top\",\n text=\"FURY rocks!!!\",\n)\n\ncolors = {\n \"Violet\": (0.6, 0, 0.8),\n \"Indigo\": (0.3, 0, 0.5),\n \"Blue\": (0, 0, 1),\n \"Green\": (0, 1, 0),\n \"Yellow\": (1, 1, 0),\n \"Orange\": (1, 0.5, 0),\n \"Red\": (1, 0, 0),\n}\n\ncolor_combobox = ui.ComboBox2D(\n items=list(colors.keys()),\n placeholder=\"Choose Text Color\",\n size=(250, 150),\n draggable=True,\n)\n\n\ndef change_color(combobox):\n label.color = colors[combobox.selected_text]\n\n\ncolor_combobox.on_change = change_color" + "label = fury.ui.TextBlock2D(\n position=(600, 300),\n font_size=40,\n color=(1, 0.5, 0),\n justification=\"center\",\n vertical_justification=\"top\",\n text=\"FURY rocks!!!\",\n)\n\ncolors = {\n \"Violet\": (0.6, 0, 0.8),\n \"Indigo\": (0.3, 0, 0.5),\n \"Blue\": (0, 0, 1),\n \"Green\": (0, 1, 0),\n \"Yellow\": (1, 1, 0),\n \"Orange\": (1, 0.5, 0),\n \"Red\": (1, 0, 0),\n}\n\ncolor_combobox = fury.ui.ComboBox2D(\n items=list(colors.keys()),\n placeholder=\"Choose Text Color\",\n size=(250, 150),\n draggable=True,\n)\n\n\ndef change_color(combobox):\n label.color = colors[combobox.selected_text]\n\n\ncolor_combobox.on_change = change_color" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "sm = window.ShowManager(size=(800, 500), title=\"Viz Tab\")\nsm.scene.add(tab_ui, cube, cylinder, sphere, label)\n\n# To interact with the ui set interactive = True\ninteractive = False\n\nif interactive:\n sm.start()\n\nwindow.record(sm.scene, size=(500, 500), out_path=\"viz_tab.png\")" + "sm = fury.window.ShowManager(size=(800, 500), title=\"Viz Tab\")\nsm.scene.add(tab_ui, cube, cylinder, sphere, label)\n\n# To interact with the ui set interactive = True\ninteractive = False\n\nif interactive:\n sm.start()\n\nfury.window.record(sm.scene, size=(500, 500), out_path=\"viz_tab.png\")" ] } ], diff --git a/dev/_downloads/714d13c413f958429d90f34d3184ee5d/viz_layout.ipynb b/dev/_downloads/714d13c413f958429d90f34d3184ee5d/viz_layout.ipynb index d121291de..57bd53b26 100644 --- a/dev/_downloads/714d13c413f958429d90f34d3184ee5d/viz_layout.ipynb +++ b/dev/_downloads/714d13c413f958429d90f34d3184ee5d/viz_layout.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "\n# Using Layouts with different UI elements\n\nThis example shows how to place different UI elements in different Layouts.\nThe Layouts used here is GridLayout (with different cell shapes).\n\nFirst, some imports.\n" + "\n# Using Layouts with different UI elements\n\nThis example shows how to place different UI elements in different Layouts.\nThe Layouts used here is GridLayout (with different cell shapes).\n\nFirst, let's import fury.\n" ] }, { @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import ui, window\nfrom fury.layout import GridLayout" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "panel_1 = ui.Panel2D(size=(200, 200), color=(0.4, 0.6, 0.3), position=(100, 100))\n\npanel_2 = ui.Panel2D(size=(250, 250), color=(0.8, 0.3, 0.5), position=(150, 150))" + "panel_1 = fury.ui.Panel2D(size=(200, 200), color=(0.4, 0.6, 0.3), position=(100, 100))\n\npanel_2 = fury.ui.Panel2D(size=(250, 250), color=(0.8, 0.3, 0.5), position=(150, 150))" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "listbox_1 = ui.ListBox2D(size=(150, 150), values=[\"First\", \"Second\", \"Third\"])\n\nlistbox_2 = ui.ListBox2D(size=(250, 250), values=[\"First\", \"Second\", \"Third\"])" + "listbox_1 = fury.ui.ListBox2D(size=(150, 150), values=[\"First\", \"Second\", \"Third\"])\n\nlistbox_2 = fury.ui.ListBox2D(size=(250, 250), values=[\"First\", \"Second\", \"Third\"])" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "slider = ui.LineSlider2D(length=150)\nlistbox = ui.ListBox2D(size=(150, 150), values=[\"First\", \"Second\", \"Third\"])" + "slider = fury.ui.LineSlider2D(length=150)\nlistbox = fury.ui.ListBox2D(size=(150, 150), values=[\"First\", \"Second\", \"Third\"])" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "rect_grid = GridLayout(position_offset=(0, 0, 0))\nsquare_grid = GridLayout(cell_shape=\"square\", position_offset=(0, 300, 0))\ndiagonal_grid = GridLayout(cell_shape=\"diagonal\", position_offset=(0, 600, 0))" + "rect_grid = fury.layout.GridLayout(position_offset=(0, 0, 0))\nsquare_grid = fury.layout.GridLayout(cell_shape=\"square\", position_offset=(0, 300, 0))\ndiagonal_grid = fury.layout.GridLayout(\n cell_shape=\"diagonal\", position_offset=(0, 600, 0)\n)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "rect_grid.apply([panel_1, panel_2])\nsquare_grid.apply([listbox_1, listbox_2])\ndiagonal_grid.apply([slider, listbox])\n\ncurrent_size = (1500, 1500)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY UI Layout\")\n\nshow_manager.scene.add(panel_1, panel_2, listbox_1, listbox_2, slider, listbox)\n\n# To interact with the UI, set interactive = True\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, out_path=\"ui_layout.png\", size=(400, 400))" + "rect_grid.apply([panel_1, panel_2])\nsquare_grid.apply([listbox_1, listbox_2])\ndiagonal_grid.apply([slider, listbox])\n\ncurrent_size = (1500, 1500)\nshow_manager = fury.window.ShowManager(size=current_size, title=\"FURY UI Layout\")\n\nshow_manager.scene.add(panel_1, panel_2, listbox_1, listbox_2, slider, listbox)\n\n# To interact with the UI, set interactive = True\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(show_manager.scene, out_path=\"ui_layout.png\", size=(400, 400))" ] } ], diff --git a/dev/_downloads/715e8e819426b94a79e2ba3da8e2a4a5/viz_fractals.ipynb b/dev/_downloads/715e8e819426b94a79e2ba3da8e2a4a5/viz_fractals.ipynb index b583471bc..d63abcc13 100644 --- a/dev/_downloads/715e8e819426b94a79e2ba3da8e2a4a5/viz_fractals.ipynb +++ b/dev/_downloads/715e8e819426b94a79e2ba3da8e2a4a5/viz_fractals.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import math\n\nimport numpy as np\n\nfrom fury import primitive, ui, utils, window" + "import math\n\nimport numpy as np\n\nimport fury" ] }, { @@ -40,7 +40,7 @@ }, "outputs": [], "source": [ - "def tetrix(N):\n centers = np.zeros((4**N, 3))\n\n # skipping non-leaf nodes (see above)\n offset = (4**N - 1) // 3 + 1\n\n # just need the vertices\n U, _ = primitive.prim_tetrahedron()\n\n def gen_centers(depth, pos, center, dist):\n if depth == N:\n centers[pos - offset] = center\n else:\n idx = 4 * (pos - 1) + 2\n for i in range(4):\n # distance gets halved at each level\n gen_centers(depth + 1, idx + i, center + dist * U[i], dist / 2)\n\n # the division by sqrt(6) is to ensure correct scale\n gen_centers(0, 1, np.zeros(3), 2 / (6**0.5))\n\n vertices, faces = primitive.prim_tetrahedron()\n\n # primitive is scaled down depending on level\n vertices /= 2 ** (N - 1)\n\n # compute some pretty colors\n bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)\n colors = (centers - bounds_min) / (bounds_max - bounds_min)\n\n vertices, triangles, colors, _ = primitive.repeat_primitive(\n centers=centers, colors=colors, vertices=vertices, faces=faces\n )\n return utils.get_actor_from_primitive(vertices, triangles, colors)" + "def tetrix(N):\n centers = np.zeros((4**N, 3))\n\n # skipping non-leaf nodes (see above)\n offset = (4**N - 1) // 3 + 1\n\n # just need the vertices\n U, _ = fury.primitive.prim_tetrahedron()\n\n def gen_centers(depth, pos, center, dist):\n if depth == N:\n centers[pos - offset] = center\n else:\n idx = 4 * (pos - 1) + 2\n for i in range(4):\n # distance gets halved at each level\n gen_centers(depth + 1, idx + i, center + dist * U[i], dist / 2)\n\n # the division by sqrt(6) is to ensure correct scale\n gen_centers(0, 1, np.zeros(3), 2 / (6**0.5))\n\n vertices, faces = fury.primitive.prim_tetrahedron()\n\n # primitive is scaled down depending on level\n vertices /= 2 ** (N - 1)\n\n # compute some pretty colors\n bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)\n colors = (centers - bounds_min) / (bounds_max - bounds_min)\n\n vertices, triangles, colors, _ = fury.primitive.repeat_primitive(\n centers=centers, colors=colors, vertices=vertices, faces=faces\n )\n return fury.utils.get_actor_from_primitive(vertices, triangles, colors)" ] }, { @@ -58,7 +58,7 @@ }, "outputs": [], "source": [ - "def sponge(N):\n centers = np.zeros((20**N, 3))\n offset = (20**N - 1) // 19 + 1\n\n # these are the offsets of the new centers at the next level of recursion\n # each cube is divided into 20 smaller cubes for a snowflake\n V = np.array(\n [\n [0, 0, 0],\n [0, 0, 1],\n [0, 0, 2],\n [0, 1, 0],\n [0, 1, 2],\n [0, 2, 0],\n [0, 2, 1],\n [0, 2, 2],\n [1, 0, 0],\n [1, 0, 2],\n [1, 2, 0],\n [1, 2, 2],\n [2, 0, 0],\n [2, 0, 1],\n [2, 0, 2],\n [2, 1, 0],\n [2, 1, 2],\n [2, 2, 0],\n [2, 2, 1],\n [2, 2, 2],\n ]\n )\n\n def gen_centers(depth, pos, center, dist):\n if depth == N:\n centers[pos - offset] = center\n else:\n # we consider a corner cube as our starting point\n start = center - np.array([1, 1, 1]) * dist**0.5\n idx = 20 * (pos - 1) + 2\n\n # this moves from the corner cube to each new cube's center\n for i in range(20):\n # each cube is divided into 27 cubes so side gets divided by 3\n gen_centers(depth + 1, idx + i, start + V[i] * dist, dist / 3)\n\n gen_centers(0, 1, np.zeros(3), 1 / 3)\n\n vertices, faces = primitive.prim_box()\n vertices /= 3**N\n\n bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)\n colors = (centers - bounds_min) / (bounds_max - bounds_min)\n\n vertices, triangles, colors, _ = primitive.repeat_primitive(\n centers=centers, colors=colors, vertices=vertices, faces=faces\n )\n return utils.get_actor_from_primitive(vertices, triangles, colors)" + "def sponge(N):\n centers = np.zeros((20**N, 3))\n offset = (20**N - 1) // 19 + 1\n\n # these are the offsets of the new centers at the next level of recursion\n # each cube is divided into 20 smaller cubes for a snowflake\n V = np.array(\n [\n [0, 0, 0],\n [0, 0, 1],\n [0, 0, 2],\n [0, 1, 0],\n [0, 1, 2],\n [0, 2, 0],\n [0, 2, 1],\n [0, 2, 2],\n [1, 0, 0],\n [1, 0, 2],\n [1, 2, 0],\n [1, 2, 2],\n [2, 0, 0],\n [2, 0, 1],\n [2, 0, 2],\n [2, 1, 0],\n [2, 1, 2],\n [2, 2, 0],\n [2, 2, 1],\n [2, 2, 2],\n ]\n )\n\n def gen_centers(depth, pos, center, dist):\n if depth == N:\n centers[pos - offset] = center\n else:\n # we consider a corner cube as our starting point\n start = center - np.array([1, 1, 1]) * dist**0.5\n idx = 20 * (pos - 1) + 2\n\n # this moves from the corner cube to each new cube's center\n for i in range(20):\n # each cube is divided into 27 cubes so side gets divided by 3\n gen_centers(depth + 1, idx + i, start + V[i] * dist, dist / 3)\n\n gen_centers(0, 1, np.zeros(3), 1 / 3)\n\n vertices, faces = fury.primitive.prim_box()\n vertices /= 3**N\n\n bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)\n colors = (centers - bounds_min) / (bounds_max - bounds_min)\n\n vertices, triangles, colors, _ = fury.primitive.repeat_primitive(\n centers=centers, colors=colors, vertices=vertices, faces=faces\n )\n return fury.utils.get_actor_from_primitive(vertices, triangles, colors)" ] }, { @@ -76,7 +76,7 @@ }, "outputs": [], "source": [ - "def snowflake(N):\n centers = np.zeros((18**N, 3))\n offset = (18**N - 1) // 17 + 1\n V = np.array(\n [\n [0, 0, 1],\n [0, 1, 0],\n [0, 1, 1],\n [0, 1, 2],\n [0, 2, 1],\n [1, 0, 0],\n [1, 0, 1],\n [1, 0, 2],\n [1, 1, 0],\n [1, 1, 2],\n [1, 2, 0],\n [1, 2, 1],\n [1, 2, 2],\n [2, 0, 1],\n [2, 1, 0],\n [2, 1, 1],\n [2, 1, 2],\n [2, 2, 1],\n ]\n )\n\n def gen_centers(depth, pos, center, side):\n if depth == N:\n centers[pos - offset] = center\n else:\n start = center - np.array([1, 1, 1]) * side**0.5\n idx = 18 * (pos - 1) + 2\n for i in range(18):\n gen_centers(depth + 1, idx + i, start + V[i] * side, side / 3)\n\n gen_centers(0, 1, np.zeros(3), 1 / 3)\n\n vertices, faces = primitive.prim_box()\n vertices /= 3**N\n\n bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)\n colors = (centers - bounds_min) / (bounds_max - bounds_min)\n\n vertices, triangles, colors, _ = primitive.repeat_primitive(\n centers=centers, colors=colors, vertices=vertices, faces=faces\n )\n return utils.get_actor_from_primitive(vertices, triangles, colors)" + "def snowflake(N):\n centers = np.zeros((18**N, 3))\n offset = (18**N - 1) // 17 + 1\n V = np.array(\n [\n [0, 0, 1],\n [0, 1, 0],\n [0, 1, 1],\n [0, 1, 2],\n [0, 2, 1],\n [1, 0, 0],\n [1, 0, 1],\n [1, 0, 2],\n [1, 1, 0],\n [1, 1, 2],\n [1, 2, 0],\n [1, 2, 1],\n [1, 2, 2],\n [2, 0, 1],\n [2, 1, 0],\n [2, 1, 1],\n [2, 1, 2],\n [2, 2, 1],\n ]\n )\n\n def gen_centers(depth, pos, center, side):\n if depth == N:\n centers[pos - offset] = center\n else:\n start = center - np.array([1, 1, 1]) * side**0.5\n idx = 18 * (pos - 1) + 2\n for i in range(18):\n gen_centers(depth + 1, idx + i, start + V[i] * side, side / 3)\n\n gen_centers(0, 1, np.zeros(3), 1 / 3)\n\n vertices, faces = fury.primitive.prim_box()\n vertices /= 3**N\n\n bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)\n colors = (centers - bounds_min) / (bounds_max - bounds_min)\n\n vertices, triangles, colors, _ = fury.primitive.repeat_primitive(\n centers=centers, colors=colors, vertices=vertices, faces=faces\n )\n return fury.utils.get_actor_from_primitive(vertices, triangles, colors)" ] }, { @@ -94,7 +94,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nshowmgr = window.ShowManager(scene, \"Fractals\", (800, 800), reset_camera=True)" + "scene = fury.window.Scene()\nshowmgr = fury.window.ShowManager(scene, \"Fractals\", (800, 800), reset_camera=True)" ] }, { @@ -130,7 +130,7 @@ }, "outputs": [], "source": [ - "options = {\n \"Tetrix\": 0,\n \"Sponge\": 1,\n \"Snowflake\": 2,\n}\n\nshape_chooser = ui.RadioButton(\n options.keys(),\n padding=10,\n font_size=16,\n checked_labels=[\"Tetrix\"],\n position=(10, 10),\n)\n\n\ndef choose_shape(radio):\n showmgr.scene.rm(*fractals)\n showmgr.scene.add(fractals[options[radio.checked_labels[0]]])\n showmgr.scene.reset_camera()\n\n\nshape_chooser.on_change = choose_shape\n\n# selected at start\nshowmgr.scene.add(fractals[0])\nshowmgr.scene.add(shape_chooser)" + "options = {\n \"Tetrix\": 0,\n \"Sponge\": 1,\n \"Snowflake\": 2,\n}\n\nshape_chooser = fury.ui.RadioButton(\n options.keys(),\n padding=10,\n font_size=16,\n checked_labels=[\"Tetrix\"],\n position=(10, 10),\n)\n\n\ndef choose_shape(radio):\n showmgr.scene.rm(*fractals)\n showmgr.scene.add(fractals[options[radio.checked_labels[0]]])\n showmgr.scene.reset_camera()\n\n\nshape_chooser.on_change = choose_shape\n\n# selected at start\nshowmgr.scene.add(fractals[0])\nshowmgr.scene.add(shape_chooser)" ] }, { @@ -166,7 +166,7 @@ }, "outputs": [], "source": [ - "interactive = False\nif interactive:\n showmgr.start()\nelse:\n window.record(showmgr.scene, out_path=\"fractals.png\", size=(800, 800))" + "interactive = False\nif interactive:\n showmgr.start()\nelse:\n fury.window.record(showmgr.scene, out_path=\"fractals.png\", size=(800, 800))" ] } ], diff --git a/dev/_downloads/717d8fd32398439615fe0025eab4274c/viz_wrecking_ball.zip b/dev/_downloads/717d8fd32398439615fe0025eab4274c/viz_wrecking_ball.zip index 0695b8ec8..ea07e4c9b 100644 Binary files a/dev/_downloads/717d8fd32398439615fe0025eab4274c/viz_wrecking_ball.zip and b/dev/_downloads/717d8fd32398439615fe0025eab4274c/viz_wrecking_ball.zip differ diff --git a/dev/_downloads/75159ae673631da39bc99f4fdded84b5/viz_spinbox.zip b/dev/_downloads/75159ae673631da39bc99f4fdded84b5/viz_spinbox.zip index 506495c00..3a795e7d3 100644 Binary files a/dev/_downloads/75159ae673631da39bc99f4fdded84b5/viz_spinbox.zip and b/dev/_downloads/75159ae673631da39bc99f4fdded84b5/viz_spinbox.zip differ diff --git a/dev/_downloads/772d31df2ae71fa424c2d79524aea3b3/viz_drawpanel.ipynb b/dev/_downloads/772d31df2ae71fa424c2d79524aea3b3/viz_drawpanel.ipynb index 2d96a032e..feee35920 100644 --- a/dev/_downloads/772d31df2ae71fa424c2d79524aea3b3/viz_drawpanel.ipynb +++ b/dev/_downloads/772d31df2ae71fa424c2d79524aea3b3/viz_drawpanel.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import ui, window\nfrom fury.data import fetch_viz_new_icons" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_new_icons()" + "fury.data.fetch_viz_new_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "drawing_canvas = ui.DrawPanel(size=(560, 560), position=(40, 10))" + "drawing_canvas = fury.ui.DrawPanel(size=(560, 560), position=(40, 10))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "current_size = (650, 650)\nshowm = window.ShowManager(size=current_size, title=\"DrawPanel UI Example\")\n\nshowm.scene.add(drawing_canvas)\n\ninteractive = False\n\nif interactive:\n showm.start()\nelse:\n # If the UI isn't interactive, then adding a circle to the canvas\n drawing_canvas.current_mode = \"circle\"\n drawing_canvas.draw_shape(shape_type=\"circle\", current_position=(275, 275))\n drawing_canvas.shape_list[-1].resize((50, 50))\n\n window.record(showm.scene, size=current_size, out_path=\"viz_drawpanel.png\")" + "current_size = (650, 650)\nshowm = fury.window.ShowManager(size=current_size, title=\"DrawPanel UI Example\")\n\nshowm.scene.add(drawing_canvas)\n\ninteractive = False\n\nif interactive:\n showm.start()\nelse:\n # If the UI isn't interactive, then adding a circle to the canvas\n drawing_canvas.current_mode = \"circle\"\n drawing_canvas.draw_shape(shape_type=\"circle\", current_position=(275, 275))\n drawing_canvas.shape_list[-1].resize((50, 50))\n\n fury.window.record(showm.scene, size=current_size, out_path=\"viz_drawpanel.png\")" ] } ], diff --git a/dev/_downloads/795daba0fa86e361eace211ffe957f6d/viz_multithread.zip b/dev/_downloads/795daba0fa86e361eace211ffe957f6d/viz_multithread.zip index 65a7625f2..1f9b47ecc 100644 Binary files a/dev/_downloads/795daba0fa86e361eace211ffe957f6d/viz_multithread.zip and b/dev/_downloads/795daba0fa86e361eace211ffe957f6d/viz_multithread.zip differ diff --git a/dev/_downloads/7bfbbfd00fd881cb734a8ea525985abf/viz_dt_ellipsoids.zip b/dev/_downloads/7bfbbfd00fd881cb734a8ea525985abf/viz_dt_ellipsoids.zip index 9510e46d2..37d414005 100644 Binary files a/dev/_downloads/7bfbbfd00fd881cb734a8ea525985abf/viz_dt_ellipsoids.zip and b/dev/_downloads/7bfbbfd00fd881cb734a8ea525985abf/viz_dt_ellipsoids.zip differ diff --git a/dev/_downloads/7e782ed48e09a9468a3200cc0f19ebfd/viz_radio_buttons.ipynb b/dev/_downloads/7e782ed48e09a9468a3200cc0f19ebfd/viz_radio_buttons.ipynb index 654455450..1094af188 100644 --- a/dev/_downloads/7e782ed48e09a9468a3200cc0f19ebfd/viz_radio_buttons.ipynb +++ b/dev/_downloads/7e782ed48e09a9468a3200cc0f19ebfd/viz_radio_buttons.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, ui, utils, window\nfrom fury.data import fetch_viz_icons" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "sphere = actor.sphere(\n centers=np.array([[50, 0, 0]]),\n colors=np.array([[0, 0, 1]]),\n radii=11.0,\n theta=360,\n phi=360,\n)\n\n# Creating a dict of possible options and mapping it with their values.\noptions = {\"Blue\": (0, 0, 255), \"Red\": (255, 0, 0), \"Green\": (0, 255, 0)}\n\ncolor_toggler = ui.RadioButton(\n list(options),\n checked_labels=[\"Blue\"],\n padding=1,\n font_size=16,\n font_family=\"Arial\",\n position=(200, 200),\n)\n\n\n# A callback which will set the values for the box\ndef toggle_color(radio):\n vcolors = utils.colors_from_actor(sphere)\n color = options[radio.checked_labels[0]]\n vcolors[:] = np.array(color)\n utils.update_actor(sphere)\n\n\ncolor_toggler.on_change = toggle_color" + "sphere = fury.actor.sphere(\n centers=np.array([[50, 0, 0]]),\n colors=np.array([[0, 0, 1]]),\n radii=11.0,\n theta=360,\n phi=360,\n)\n\n# Creating a dict of possible options and mapping it with their values.\noptions = {\"Blue\": (0, 0, 255), \"Red\": (255, 0, 0), \"Green\": (0, 255, 0)}\n\ncolor_toggler = fury.ui.RadioButton(\n list(options),\n checked_labels=[\"Blue\"],\n padding=1,\n font_size=16,\n font_family=\"Arial\",\n position=(200, 200),\n)\n\n\n# A callback which will set the values for the box\ndef toggle_color(radio):\n vcolors = fury.utils.colors_from_actor(sphere)\n color = options[radio.checked_labels[0]]\n vcolors[:] = np.array(color)\n fury.utils.update_actor(sphere)\n\n\ncolor_toggler.on_change = toggle_color" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "current_size = (800, 800)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY Sphere Example\")\n\nshow_manager.scene.add(sphere)\nshow_manager.scene.add(color_toggler)" + "current_size = (800, 800)\nshow_manager = fury.window.ShowManager(size=current_size, title=\"FURY Sphere Example\")\n\nshow_manager.scene.add(sphere)\nshow_manager.scene.add(color_toggler)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "show_manager.scene.reset_camera()\nshow_manager.scene.set_camera(position=(0, 0, 150))\nshow_manager.scene.reset_clipping_range()\nshow_manager.scene.azimuth(30)\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, size=current_size, out_path=\"viz_radio_buttons.png\")" + "show_manager.scene.reset_camera()\nshow_manager.scene.set_camera(position=(0, 0, 150))\nshow_manager.scene.reset_clipping_range()\nshow_manager.scene.azimuth(30)\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(\n show_manager.scene, size=current_size, out_path=\"viz_radio_buttons.png\"\n)" ] } ], diff --git a/dev/_downloads/7f7ea9ef83cabfb8993df8e31149e92f/viz_shapes.py b/dev/_downloads/7f7ea9ef83cabfb8993df8e31149e92f/viz_shapes.py index e7e64361c..33a88ec80 100644 --- a/dev/_downloads/7f7ea9ef83cabfb8993df8e31149e92f/viz_shapes.py +++ b/dev/_downloads/7f7ea9ef83cabfb8993df8e31149e92f/viz_shapes.py @@ -10,28 +10,29 @@ First, a bunch of imports. """ -from fury import ui, window -from fury.data import fetch_viz_icons +import fury ############################################################################## # First we need to fetch some icons that are included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ############################################################################### # Let's draw some simple shapes. First, a rectangle. -rect = ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1)) +rect = fury.ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1)) ############################################################################### # Then we can draw a solid circle, or disk. -disk = ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0)) +disk = fury.ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0)) ############################################################################### # Add an inner radius to make a ring. -ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1)) +ring = fury.ui.Disk2D( + outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1) +) ############################################################################### @@ -39,7 +40,7 @@ # manager. current_size = (800, 800) -show_manager = window.ShowManager(size=current_size, title="FURY Shapes Example") +show_manager = fury.window.ShowManager(size=current_size, title="FURY Shapes Example") show_manager.scene.add(rect) show_manager.scene.add(disk) @@ -50,4 +51,4 @@ if interactive: show_manager.start() -window.record(show_manager.scene, size=current_size, out_path="viz_shapes.png") +fury.window.record(show_manager.scene, size=current_size, out_path="viz_shapes.png") diff --git a/dev/_downloads/80519c91c57ffaf03d20f4e9e1cba7c7/viz_play_video.ipynb b/dev/_downloads/80519c91c57ffaf03d20f4e9e1cba7c7/viz_play_video.ipynb index df8d6f0c3..7b9f0ddb9 100644 --- a/dev/_downloads/80519c91c57ffaf03d20f4e9e1cba7c7/viz_play_video.ipynb +++ b/dev/_downloads/80519c91c57ffaf03d20f4e9e1cba7c7/viz_play_video.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import time\n\nimport cv2\nimport numpy as np\n\nfrom fury import actor, window\n\n\n# The VideoCapturer Class\n# This Class wraps OpenCV Videocapture\nclass VideoCapturer:\n def __init__(self, video, time):\n self.path = video\n self.video = cv2.VideoCapture(self.path)\n self.fps = int(self.video.get(cv2.CAP_PROP_FPS))\n self.frames = int(self.video.get(cv2.CAP_PROP_FRAME_COUNT))\n self.time = time\n\n # A generator to yield video frames on every call\n def get_frame(self):\n start = time.time()\n for _ in range(self.frames):\n isframe, frame = self.video.read()\n dur = time.time() - start\n if dur > self.time:\n break\n if isframe:\n yield cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)\n self.video.release()\n yield None\n\n\nclass VideoPlayer:\n def __init__(self, video, time=10):\n # Initializes the Video object with the given Video\n self.video = VideoCapturer(video, time)\n self.video_generator = self.video.get_frame()\n self.current_video_frame = next(self.video_generator)\n # Initialize Scene\n self.initialize_scene()\n # Create a Show Manager and Initialize it\n self.show_manager = window.ShowManager(\n self.scene, size=(900, 768), reset_camera=False, order_transparent=True\n )\n\n # Initialize the Scene with actors\n def initialize_scene(self):\n self.scene = window.Scene()\n # Initialize a Plane actor with the 1st video frame along with\n # the actor grid which is to be updated in each iteration\n self.plane_actor = actor.texture(self.current_video_frame)\n self.scene.add(self.plane_actor)\n\n # The timer_callback function getting called by the show manager\n def timer_callback(self, _obj, _event):\n self.current_video_frame = next(self.video_generator)\n if isinstance(self.current_video_frame, np.ndarray):\n # update texture of the actor with the current frame image\n # by updating the actor grid\n actor.texture_update(self.plane_actor, self.current_video_frame)\n self.show_manager.scene.azimuth(1.5) # to rotate the camera\n else:\n self.show_manager.exit()\n\n self.show_manager.render()\n\n def run(self):\n # Add a timer callback to show manager after with\n # video frame duration as the interval\n self.frame_duration = int(1000 / self.video.fps)\n self.show_manager.add_timer_callback(\n True, self.frame_duration, self.timer_callback\n )\n self.show_manager.start()\n\n\n# Create VideoPlayer Object and run it\nvideo_url = (\n \"http://commondatastorage.googleapis.com/\"\n + \"gtv-videos-bucket/sample/BigBuckBunny.mp4\"\n)\nvp = VideoPlayer(video_url)\nvp.run()\nwindow.record(vp.show_manager.scene, out_path=\"viz_play_video.png\", size=(600, 600))" + "import time\n\nimport cv2\nimport numpy as np\n\nimport fury\n\n\n# The VideoCapturer Class\n# This Class wraps OpenCV Videocapture\nclass VideoCapturer:\n def __init__(self, video, time):\n self.path = video\n self.video = cv2.VideoCapture(self.path)\n self.fps = int(self.video.get(cv2.CAP_PROP_FPS))\n self.frames = int(self.video.get(cv2.CAP_PROP_FRAME_COUNT))\n self.time = time\n\n # A generator to yield video frames on every call\n def get_frame(self):\n start = time.time()\n for _ in range(self.frames):\n isframe, frame = self.video.read()\n dur = time.time() - start\n if dur > self.time:\n break\n if isframe:\n yield cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)\n self.video.release()\n yield None\n\n\nclass VideoPlayer:\n def __init__(self, video, time=10):\n # Initializes the Video object with the given Video\n self.video = VideoCapturer(video, time)\n self.video_generator = self.video.get_frame()\n self.current_video_frame = next(self.video_generator)\n # Initialize Scene\n self.initialize_scene()\n # Create a Show Manager and Initialize it\n self.show_manager = fury.window.ShowManager(\n self.scene, size=(900, 768), reset_camera=False, order_transparent=True\n )\n\n # Initialize the Scene with actors\n def initialize_scene(self):\n self.scene = fury.window.Scene()\n # Initialize a Plane actor with the 1st video frame along with\n # the actor grid which is to be updated in each iteration\n self.plane_actor = fury.actor.texture(self.current_video_frame)\n self.scene.add(self.plane_actor)\n\n # The timer_callback function getting called by the show manager\n def timer_callback(self, _obj, _event):\n self.current_video_frame = next(self.video_generator)\n if isinstance(self.current_video_frame, np.ndarray):\n # update texture of the actor with the current frame image\n # by updating the actor grid\n fury.actor.texture_update(self.plane_actor, self.current_video_frame)\n self.show_manager.scene.azimuth(1.5) # to rotate the camera\n else:\n self.show_manager.exit()\n\n self.show_manager.render()\n\n def run(self):\n # Add a timer callback to show manager after with\n # video frame duration as the interval\n self.frame_duration = int(1000 / self.video.fps)\n self.show_manager.add_timer_callback(\n True, self.frame_duration, self.timer_callback\n )\n self.show_manager.start()\n\n\n# Create VideoPlayer Object and run it\nvideo_url = (\n \"http://commondatastorage.googleapis.com/\"\n + \"gtv-videos-bucket/sample/BigBuckBunny.mp4\"\n)\nvp = VideoPlayer(video_url)\nvp.run()\nfury.window.record(\n vp.show_manager.scene, out_path=\"viz_play_video.png\", size=(600, 600)\n)" ] } ], diff --git a/dev/_downloads/81f4a54a677a19f3112fc2b6f3eff6ec/viz_sphere.zip b/dev/_downloads/81f4a54a677a19f3112fc2b6f3eff6ec/viz_sphere.zip index 5405d8e7f..49df1b99d 100644 Binary files a/dev/_downloads/81f4a54a677a19f3112fc2b6f3eff6ec/viz_sphere.zip and b/dev/_downloads/81f4a54a677a19f3112fc2b6f3eff6ec/viz_sphere.zip differ diff --git a/dev/_downloads/83b38f435b5fcfe8de72217d66850ec6/viz_sdf_cylinder.zip b/dev/_downloads/83b38f435b5fcfe8de72217d66850ec6/viz_sdf_cylinder.zip index 45559186b..040dbd8bc 100644 Binary files a/dev/_downloads/83b38f435b5fcfe8de72217d66850ec6/viz_sdf_cylinder.zip and b/dev/_downloads/83b38f435b5fcfe8de72217d66850ec6/viz_sdf_cylinder.zip differ diff --git a/dev/_downloads/847206dc3712b90c8233d1e6e32ea576/viz_gltf_animated.py b/dev/_downloads/847206dc3712b90c8233d1e6e32ea576/viz_gltf_animated.py index a7bf84ced..a664883c0 100644 --- a/dev/_downloads/847206dc3712b90c8233d1e6e32ea576/viz_gltf_animated.py +++ b/dev/_downloads/847206dc3712b90c8233d1e6e32ea576/viz_gltf_animated.py @@ -6,16 +6,14 @@ scene. """ -from fury import window -from fury.data import fetch_gltf, read_viz_gltf -from fury.gltf import glTF +import fury ############################################################################## # Create a scene. -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) showm.initialize() @@ -23,14 +21,14 @@ ############################################################################## # Retrieving the gltf model. -fetch_gltf("InterpolationTest", "glTF") -filename = read_viz_gltf("InterpolationTest") +fury.data.fetch_gltf("InterpolationTest", "glTF") +filename = fury.data.read_viz_gltf("InterpolationTest") ############################################################################## # Initialize the glTF object and get actors using `actors` method. # Get the main_timeline (which contains multiple Timeline objects). -gltf_obj = glTF(filename) +gltf_obj = fury.gltf.glTF(filename) timeline = gltf_obj.main_animation() ############################################################################## @@ -54,4 +52,4 @@ def timer_callback(_obj, _event): if interactive: showm.start() -window.record(scene, out_path="viz_gltf_animated.png", size=(900, 768)) +fury.window.record(scene, out_path="viz_gltf_animated.png", size=(900, 768)) diff --git a/dev/_downloads/89193b75dd3a4bdbe2786e1072a3e514/viz_ui_listbox.ipynb b/dev/_downloads/89193b75dd3a4bdbe2786e1072a3e514/viz_ui_listbox.ipynb index ac0e7bda2..6a78d5aa0 100644 --- a/dev/_downloads/89193b75dd3a4bdbe2786e1072a3e514/viz_ui_listbox.ipynb +++ b/dev/_downloads/89193b75dd3a4bdbe2786e1072a3e514/viz_ui_listbox.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import ui, window\nfrom fury.data import fetch_viz_icons" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "welcome_text = ui.TextBlock2D(text=\"Welcome\", font_size=30, position=(500, 400))\nbye_text = ui.TextBlock2D(text=\"Bye\", font_size=30, position=(500, 400))\nfury_text = ui.TextBlock2D(text=\"Fury\", font_size=30, position=(500, 400))\n\nexample = [welcome_text, bye_text, fury_text]" + "welcome_text = fury.ui.TextBlock2D(text=\"Welcome\", font_size=30, position=(500, 400))\nbye_text = fury.ui.TextBlock2D(text=\"Bye\", font_size=30, position=(500, 400))\nfury_text = fury.ui.TextBlock2D(text=\"Fury\", font_size=30, position=(500, 400))\n\nexample = [welcome_text, bye_text, fury_text]" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "values = [\"Welcome\", \"Bye\", \"Fury\"]\nlistbox = ui.ListBox2D(\n values=values, position=(10, 300), size=(200, 200), multiselection=False\n)" + "values = [\"Welcome\", \"Bye\", \"Fury\"]\nlistbox = fury.ui.ListBox2D(\n values=values, position=(10, 300), size=(200, 200), multiselection=False\n)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "current_size = (800, 800)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY UI ListBox_Example\")\n\nshow_manager.scene.add(listbox)\nshow_manager.scene.add(welcome_text)\nshow_manager.scene.add(bye_text)\nshow_manager.scene.add(fury_text)\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, size=current_size, out_path=\"viz_listbox.png\")" + "current_size = (800, 800)\nshow_manager = fury.window.ShowManager(\n size=current_size, title=\"FURY UI ListBox_Example\"\n)\n\nshow_manager.scene.add(listbox)\nshow_manager.scene.add(welcome_text)\nshow_manager.scene.add(bye_text)\nshow_manager.scene.add(fury_text)\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(show_manager.scene, size=current_size, out_path=\"viz_listbox.png\")" ] } ], diff --git a/dev/_downloads/89363d2004ae1ca5758a59fc982a7291/viz_ui.zip b/dev/_downloads/89363d2004ae1ca5758a59fc982a7291/viz_ui.zip index 37fbb7472..4b86fe717 100644 Binary files a/dev/_downloads/89363d2004ae1ca5758a59fc982a7291/viz_ui.zip and b/dev/_downloads/89363d2004ae1ca5758a59fc982a7291/viz_ui.zip differ diff --git a/dev/_downloads/8cdc4ef9f45f14ed1686dc026e06087d/viz_morphing.py b/dev/_downloads/8cdc4ef9f45f14ed1686dc026e06087d/viz_morphing.py index 9bf996759..ecd229e6a 100644 --- a/dev/_downloads/8cdc4ef9f45f14ed1686dc026e06087d/viz_morphing.py +++ b/dev/_downloads/8cdc4ef9f45f14ed1686dc026e06087d/viz_morphing.py @@ -5,22 +5,20 @@ In this tutorial, we will show how to use morphing in a glTF model in FURY. """ -from fury import window -from fury.data import fetch_gltf, read_viz_gltf -from fury.gltf import glTF +import fury ############################################################################## # Retrieving the model with morphing in it (look at Khronoos samples). # We're choosing the `MorphStressTest` model here. -fetch_gltf("MorphStressTest", "glTF") -filename = read_viz_gltf("MorphStressTest") +fury.data.fetch_gltf("MorphStressTest", "glTF") +filename = fury.data.read_viz_gltf("MorphStressTest") ############################################################################## # Initializing the glTF object, You can additionally set `apply_normals=True`. # Note: Normals might not work as intended with morphing. -gltf_obj = glTF(filename, apply_normals=True) +gltf_obj = fury.gltf.glTF(filename, apply_normals=True) ############################################################################## # Get the morph timeline using `morph_timeline` method, Choose the animation @@ -40,8 +38,8 @@ # Initialize the show manager and add timeline to the scene (No need to add # actors to the scene separately). -scene = window.Scene() -showm = window.ShowManager( +scene = fury.window.Scene() +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=True, order_transparent=True ) @@ -71,4 +69,4 @@ def timer_callback(_obj, _event): if interactive: showm.start() -window.record(scene, out_path="viz_morphing.png", size=(900, 768)) +fury.window.record(scene, out_path="viz_morphing.png", size=(900, 768)) diff --git a/dev/_downloads/8e284c61bd4308568ae92601a0a6626a/viz_solar_system.ipynb b/dev/_downloads/8e284c61bd4308568ae92601a0a6626a/viz_solar_system.ipynb index 47df02da0..eb03a90f6 100644 --- a/dev/_downloads/8e284c61bd4308568ae92601a0a6626a/viz_solar_system.ipynb +++ b/dev/_downloads/8e284c61bd4308568ae92601a0a6626a/viz_solar_system.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, io, ui, utils, window\nfrom fury.data import fetch_viz_textures, read_viz_icons, read_viz_textures" + "import itertools\n\nimport numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\n# Create a panel and the start/pause buttons\n\npanel = ui.Panel2D(size=(300, 100), color=(1, 1, 1), align=\"right\")\npanel.center = (400, 50)\n\npause_button = ui.Button2D(icon_fnames=[(\"square\", read_viz_icons(fname=\"pause2.png\"))])\nstart_button = ui.Button2D(icon_fnames=[(\"square\", read_viz_icons(fname=\"play3.png\"))])\n\n# Add the buttons on the panel\n\npanel.add_element(pause_button, (0.25, 0.33))\npanel.add_element(start_button, (0.66, 0.33))" + "scene = fury.window.Scene()\n\n# Create a panel and the start/pause buttons\n\npanel = fury.ui.Panel2D(size=(300, 100), color=(1, 1, 1), align=\"right\")\npanel.center = (400, 50)\n\npause_button = fury.ui.Button2D(\n icon_fnames=[(\"square\", fury.data.read_viz_icons(fname=\"pause2.png\"))]\n)\nstart_button = fury.ui.Button2D(\n icon_fnames=[(\"square\", fury.data.read_viz_icons(fname=\"play3.png\"))]\n)\n\n# Add the buttons on the panel\n\npanel.add_element(pause_button, (0.25, 0.33))\npanel.add_element(start_button, (0.66, 0.33))" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "planets_data = [\n {\n \"filename\": \"8k_mercury.jpg\",\n \"position\": 7,\n \"earth_days\": 58,\n \"scale\": (0.4, 0.4, 0.4),\n },\n {\n \"filename\": \"8k_venus_surface.jpg\",\n \"position\": 9,\n \"earth_days\": 243,\n \"scale\": (0.6, 0.6, 0.6),\n },\n {\n \"filename\": \"1_earth_8k.jpg\",\n \"position\": 11,\n \"earth_days\": 1,\n \"scale\": (0.4, 0.4, 0.4),\n },\n {\n \"filename\": \"8k_mars.jpg\",\n \"position\": 13,\n \"earth_days\": 1,\n \"scale\": (0.8, 0.8, 0.8),\n },\n {\"filename\": \"jupiter.jpg\", \"position\": 16, \"earth_days\": 0.41, \"scale\": (2, 2, 2)},\n {\n \"filename\": \"8k_saturn.jpg\",\n \"position\": 19,\n \"earth_days\": 0.45,\n \"scale\": (2, 2, 2),\n },\n {\n \"filename\": \"8k_saturn_ring_alpha.png\",\n \"position\": 19,\n \"earth_days\": 0.45,\n \"scale\": (3, 0.5, 3),\n },\n {\n \"filename\": \"2k_uranus.jpg\",\n \"position\": 22,\n \"earth_days\": 0.70,\n \"scale\": (1, 1, 1),\n },\n {\n \"filename\": \"2k_neptune.jpg\",\n \"position\": 25,\n \"earth_days\": 0.70,\n \"scale\": (1, 1, 1),\n },\n {\"filename\": \"8k_sun.jpg\", \"position\": 0, \"earth_days\": 27, \"scale\": (5, 5, 5)},\n]\nfetch_viz_textures()" + "planets_data = [\n {\n \"filename\": \"8k_mercury.jpg\",\n \"position\": 7,\n \"earth_days\": 58,\n \"scale\": (0.4, 0.4, 0.4),\n },\n {\n \"filename\": \"8k_venus_surface.jpg\",\n \"position\": 9,\n \"earth_days\": 243,\n \"scale\": (0.6, 0.6, 0.6),\n },\n {\n \"filename\": \"1_earth_8k.jpg\",\n \"position\": 11,\n \"earth_days\": 1,\n \"scale\": (0.4, 0.4, 0.4),\n },\n {\n \"filename\": \"8k_mars.jpg\",\n \"position\": 13,\n \"earth_days\": 1,\n \"scale\": (0.8, 0.8, 0.8),\n },\n {\"filename\": \"jupiter.jpg\", \"position\": 16, \"earth_days\": 0.41, \"scale\": (2, 2, 2)},\n {\n \"filename\": \"8k_saturn.jpg\",\n \"position\": 19,\n \"earth_days\": 0.45,\n \"scale\": (2, 2, 2),\n },\n {\n \"filename\": \"8k_saturn_ring_alpha.png\",\n \"position\": 19,\n \"earth_days\": 0.45,\n \"scale\": (3, 0.5, 3),\n },\n {\n \"filename\": \"2k_uranus.jpg\",\n \"position\": 22,\n \"earth_days\": 0.70,\n \"scale\": (1, 1, 1),\n },\n {\n \"filename\": \"2k_neptune.jpg\",\n \"position\": 25,\n \"earth_days\": 0.70,\n \"scale\": (1, 1, 1),\n },\n {\"filename\": \"8k_sun.jpg\", \"position\": 0, \"earth_days\": 27, \"scale\": (5, 5, 5)},\n]\nfury.data.fetch_viz_textures()" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "def init_planet(planet_data):\n \"\"\"Initialize a planet actor.\n\n Parameters\n ----------\n planet_data : dict\n The planet_data is a dictionary, and the keys are filename(texture),\n position and scale.\n\n Returns\n -------\n planet_actor: actor\n The corresponding sphere actor with texture applied.\n \"\"\"\n planet_file = read_viz_textures(planet_data[\"filename\"])\n planet_image = io.load_image(planet_file)\n planet_actor = actor.texture_on_sphere(planet_image)\n planet_actor.SetPosition(planet_data[\"position\"], 0, 0)\n if planet_data[\"filename\"] != \"8k_saturn_ring_alpha.png\":\n utils.rotate(planet_actor, (90, 1, 0, 0))\n planet_actor.SetScale(planet_data[\"scale\"])\n scene.add(planet_actor)\n return planet_actor" + "def init_planet(planet_data):\n \"\"\"Initialize a planet actor.\n\n Parameters\n ----------\n planet_data : dict\n The planet_data is a dictionary, and the keys are filename(texture),\n position and scale.\n\n Returns\n -------\n planet_actor: actor\n The corresponding sphere actor with texture applied.\n \"\"\"\n planet_file = fury.data.read_viz_textures(planet_data[\"filename\"])\n planet_image = fury.io.load_image(planet_file)\n planet_actor = fury.actor.texture_on_sphere(planet_image)\n planet_actor.SetPosition(planet_data[\"position\"], 0, 0)\n if planet_data[\"filename\"] != \"8k_saturn_ring_alpha.png\":\n fury.utils.rotate(planet_actor, (90, 1, 0, 0))\n planet_actor.SetScale(planet_data[\"scale\"])\n scene.add(planet_actor)\n return planet_actor" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "def rotate_axial(actor, time, radius):\n axis = (0, radius, 0)\n angle = 50 / time\n utils.rotate(actor, (angle, axis[0], axis[1], axis[2]))\n return angle" + "def rotate_axial(actor, time, radius):\n axis = (0, radius, 0)\n angle = 50 / time\n fury.utils.rotate(actor, (angle, axis[0], axis[1], axis[2]))\n return angle" ] }, { @@ -177,7 +177,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nscene.add(panel)" + "showm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nscene.add(panel)" ] }, { @@ -285,7 +285,7 @@ }, "outputs": [], "source": [ - "orbit_actor = actor.line(planet_tracks, colors=(1, 1, 1), linewidth=0.1)\nscene.add(orbit_actor)" + "orbit_actor = fury.actor.line(planet_tracks, colors=(1, 1, 1), linewidth=0.1)\nscene.add(orbit_actor)" ] }, { @@ -339,7 +339,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 10, timer_callback)\nshowm.start()\n\nwindow.record(showm.scene, size=(900, 768), out_path=\"viz_solar_system_animation.png\")" + "showm.add_timer_callback(True, 10, timer_callback)\nshowm.start()\n\nfury.window.record(\n showm.scene, size=(900, 768), out_path=\"viz_solar_system_animation.png\"\n)" ] } ], diff --git a/dev/_downloads/8f76342ecd3c433805035888e58c058f/viz_camera.zip b/dev/_downloads/8f76342ecd3c433805035888e58c058f/viz_camera.zip index ade810b68..0a9526fcc 100644 Binary files a/dev/_downloads/8f76342ecd3c433805035888e58c058f/viz_camera.zip and b/dev/_downloads/8f76342ecd3c433805035888e58c058f/viz_camera.zip differ diff --git a/dev/_downloads/9040c05e2c689e6b3272aa9d9fd1f4c7/viz_pbr_interactive.zip b/dev/_downloads/9040c05e2c689e6b3272aa9d9fd1f4c7/viz_pbr_interactive.zip index 85a8146c5..fd511781c 100644 Binary files a/dev/_downloads/9040c05e2c689e6b3272aa9d9fd1f4c7/viz_pbr_interactive.zip and b/dev/_downloads/9040c05e2c689e6b3272aa9d9fd1f4c7/viz_pbr_interactive.zip differ diff --git a/dev/_downloads/936d16e7edb5f588db3721c6df358491/viz_pbr_spheres.py b/dev/_downloads/936d16e7edb5f588db3721c6df358491/viz_pbr_spheres.py index 318fcc51e..e0cfa6f59 100644 --- a/dev/_downloads/936d16e7edb5f588db3721c6df358491/viz_pbr_spheres.py +++ b/dev/_downloads/936d16e7edb5f588db3721c6df358491/viz_pbr_spheres.py @@ -17,17 +17,12 @@ import numpy as np -from fury import actor, material, window -from fury.utils import ( - normals_from_actor, - tangents_from_direction_of_anisotropy, - tangents_to_actor, -) +import fury ############################################################################### # Now set up a new scene. -scene = window.Scene() +scene = fury.window.Scene() scene.background((0.9, 0.9, 0.9)) ############################################################################### @@ -59,13 +54,15 @@ center = [[0, -5 * i, 0]] for j in range(num_values): center[0][0] = -25 + 5 * j - sphere = actor.sphere(center, color, radii=2, theta=32, phi=32) - normals = normals_from_actor(sphere) - tangents = tangents_from_direction_of_anisotropy(normals, (0, 1, 0.5)) - tangents_to_actor(sphere, tangents) + sphere = fury.actor.sphere(center, color, radii=2, theta=32, phi=32) + normals = fury.utils.normals_from_actor(sphere) + tangents = fury.utils.tangents_from_direction_of_anisotropy( + normals, (0, 1, 0.5) + ) + fury.utils.tangents_to_actor(sphere, tangents) keys = list(params) params[keys[0]] = np.round(0.1 * j, decimals=1) - material.manifest_pbr(sphere, **params) + fury.material.manifest_pbr(sphere, **params) scene.add(sphere) ############################################################################### @@ -83,12 +80,14 @@ for i, name in enumerate(labels): pos = [-40, -5 * i, 0] - label = actor.vector_text(name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)) + label = fury.actor.vector_text( + name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0) + ) scene.add(label) for j in range(num_values): pos = [-26 + 5 * j, 3, 0] - label = actor.vector_text( + label = fury.actor.vector_text( str(np.round(j * 0.1, decimals=1)), pos=pos, scale=(0.8, 0.8, 0.8), @@ -123,10 +122,10 @@ center = [[0, -35 - (5 * i), 0]] for j in range(num_values): center[0][0] = -25 + 5 * j - sphere = actor.sphere(center, color, radii=2, theta=32, phi=32) + sphere = fury.actor.sphere(center, color, radii=2, theta=32, phi=32) keys = list(params) params[keys[0]] = iors[j] - material.manifest_pbr(sphere, **params) + fury.material.manifest_pbr(sphere, **params) scene.add(sphere) ############################################################################### @@ -136,12 +135,14 @@ for i, name in enumerate(labels): pos = [-40, -35 - (5 * i), 0] - label = actor.vector_text(name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)) + label = fury.actor.vector_text( + name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0) + ) scene.add(label) for j in range(num_values): pos = [-26 + 5 * j, -32, 0] - label = actor.vector_text( + label = fury.actor.vector_text( "{:.02f}".format(iors[j]), pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0) ) scene.add(label) @@ -151,6 +152,6 @@ interactive = False if interactive: - window.show(scene) + fury.window.show(scene) -window.record(scene, size=(600, 600), out_path="viz_pbr_spheres.png") +fury.window.record(scene, size=(600, 600), out_path="viz_pbr_spheres.png") diff --git a/dev/_downloads/93d3c8d4025f627e9d6e61d1ecc163e8/viz_drawpanel.zip b/dev/_downloads/93d3c8d4025f627e9d6e61d1ecc163e8/viz_drawpanel.zip index 6d8bc12a7..3fa8f7c2e 100644 Binary files a/dev/_downloads/93d3c8d4025f627e9d6e61d1ecc163e8/viz_drawpanel.zip and b/dev/_downloads/93d3c8d4025f627e9d6e61d1ecc163e8/viz_drawpanel.zip differ diff --git a/dev/_downloads/981f106388beb4e1abc724788ab86b5a/viz_using_time_equations.ipynb b/dev/_downloads/981f106388beb4e1abc724788ab86b5a/viz_using_time_equations.ipynb index cabbb7a5b..ed1613fcd 100644 --- a/dev/_downloads/981f106388beb4e1abc724788ab86b5a/viz_using_time_equations.ipynb +++ b/dev/_downloads/981f106388beb4e1abc724788ab86b5a/viz_using_time_equations.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\nfrom fury.animation import Animation\n\nscene = window.Scene()\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n\ncube = actor.cube(np.array([[0, 0, 0]]), (0, 0, 0), (1, 0, 1), scales=6)" + "import numpy as np\n\nimport fury\n\nscene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n\ncube = fury.actor.cube(np.array([[0, 0, 0]]), (0, 0, 0), (1, 0, 1), scales=6)" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "anim = Animation(length=2 * np.pi, loop=True, motion_path_res=200)" + "anim = fury.animation.Animation(length=2 * np.pi, loop=True, motion_path_res=200)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "showm.add_animation(anim)\n\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_keyframe_animation_evaluators.png\", size=(900, 768))" + "showm.add_animation(anim)\n\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(\n scene, out_path=\"viz_keyframe_animation_evaluators.png\", size=(900, 768)\n)" ] } ], diff --git a/dev/_downloads/98eee32aa3111f6bc8b5b2a404686a66/viz_principled_spheres.ipynb b/dev/_downloads/98eee32aa3111f6bc8b5b2a404686a66/viz_principled_spheres.ipynb index 5db62db9a..ec0f790c0 100644 --- a/dev/_downloads/98eee32aa3111f6bc8b5b2a404686a66/viz_principled_spheres.ipynb +++ b/dev/_downloads/98eee32aa3111f6bc8b5b2a404686a66/viz_principled_spheres.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, material, window" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.background((0.9, 0.9, 0.9))" + "scene = fury.window.Scene()\nscene.background((0.9, 0.9, 0.9))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "for i in range(10):\n center = np.array([[0, -5 * i, 0]])\n for j in range(11):\n center[0][0] = -25 + 5 * j\n sphere = actor.sphere(\n center, colors=material_params[i][0], radii=2, theta=32, phi=32\n )\n keys = list(material_params[i][1])\n material_params[i][1][keys[0]] = np.round(0.1 * j, decimals=1)\n material.manifest_principled(sphere, **material_params[i][1])\n scene.add(sphere)" + "for i in range(10):\n center = np.array([[0, -5 * i, 0]])\n for j in range(11):\n center[0][0] = -25 + 5 * j\n sphere = fury.actor.sphere(\n center, colors=material_params[i][0], radii=2, theta=32, phi=32\n )\n keys = list(material_params[i][1])\n material_params[i][1][keys[0]] = np.round(0.1 * j, decimals=1)\n fury.material.manifest_principled(sphere, **material_params[i][1])\n scene.add(sphere)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "labels = [\n \"Subsurface\",\n \"Metallic\",\n \"Specular\",\n \"Specular Tint\",\n \"Roughness\",\n \"Anisotropic\",\n \"Sheen\",\n \"Sheen Tint\",\n \"Clearcoat\",\n \"Clearcoat Gloss\",\n]\n\nfor i in range(10):\n pos = [-40, -5 * i, 0]\n label = actor.vector_text(\n labels[i], pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)\n )\n scene.add(label)\n\nfor j in range(11):\n pos = [-26 + 5 * j, 5, 0]\n label = actor.vector_text(\n str(np.round(j * 0.1, decimals=1)),\n pos=pos,\n scale=(0.8, 0.8, 0.8),\n color=(0, 0, 0),\n )\n scene.add(label)" + "labels = [\n \"Subsurface\",\n \"Metallic\",\n \"Specular\",\n \"Specular Tint\",\n \"Roughness\",\n \"Anisotropic\",\n \"Sheen\",\n \"Sheen Tint\",\n \"Clearcoat\",\n \"Clearcoat Gloss\",\n]\n\nfor i in range(10):\n pos = [-40, -5 * i, 0]\n label = fury.actor.vector_text(\n labels[i], pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)\n )\n scene.add(label)\n\nfor j in range(11):\n pos = [-26 + 5 * j, 5, 0]\n label = fury.actor.vector_text(\n str(np.round(j * 0.1, decimals=1)),\n pos=pos,\n scale=(0.8, 0.8, 0.8),\n color=(0, 0, 0),\n )\n scene.add(label)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "interactive = False\nif interactive:\n window.show(scene)\n\nwindow.record(scene, size=(600, 600), out_path=\"viz_principled_spheres.png\")" + "interactive = False\nif interactive:\n fury.window.show(scene)\n\nfury.window.record(scene, size=(600, 600), out_path=\"viz_principled_spheres.png\")" ] } ], diff --git a/dev/_downloads/99010aa2e5b2ef6899c5427c758cd74d/viz_roi_contour.py b/dev/_downloads/99010aa2e5b2ef6899c5427c758cd74d/viz_roi_contour.py index 17590a3df..1a8b07806 100644 --- a/dev/_downloads/99010aa2e5b2ef6899c5427c758cd74d/viz_roi_contour.py +++ b/dev/_downloads/99010aa2e5b2ef6899c5427c758cd74d/viz_roi_contour.py @@ -24,8 +24,7 @@ from dipy.tracking import utils from dipy.tracking.streamline import Streamlines -from fury import actor, window -from fury.colormap import line_colors +import fury ############################################################################### # First, we need to generate some streamlines. For a more complete @@ -39,7 +38,7 @@ white_matter = (labels == 1) | (labels == 2) -csa_model = CsaOdfModel(gtab, sh_order=6) +csa_model = CsaOdfModel(gtab, sh_order_max=6) csa_peaks = peaks_from_model( csa_model, data, @@ -63,7 +62,7 @@ ############################################################################### # We will create a streamline actor from the streamlines. -streamlines_actor = actor.line(streamlines, line_colors(streamlines)) +streamlines_actor = fury.actor.line(streamlines, fury.colormap.line_colors(streamlines)) ############################################################################### # Next, we create a surface actor from the corpus callosum seed ROI. We @@ -74,7 +73,7 @@ surface_opacity = 0.5 surface_color = [0, 1, 1] -seedroi_actor = actor.contour_from_roi( +seedroi_actor = fury.actor.contour_from_roi( seed_mask, affine, surface_color, surface_opacity ) @@ -82,7 +81,7 @@ # Next, we initialize a ''Scene'' object and add both actors # to the rendering. -scene = window.Scene() +scene = fury.window.Scene() scene.add(streamlines_actor) scene.add(seedroi_actor) @@ -92,9 +91,9 @@ interactive = False if interactive: - window.show(scene) + fury.window.show(scene) # scene.zoom(1.5) # scene.reset_clipping_range() -window.record(scene, out_path="contour_from_roi_tutorial.png", size=(600, 600)) +fury.window.record(scene, out_path="contour_from_roi_tutorial.png", size=(600, 600)) diff --git a/dev/_downloads/99d1b60ac02d74de2908f74166caf0a6/viz_earth_coordinates.zip b/dev/_downloads/99d1b60ac02d74de2908f74166caf0a6/viz_earth_coordinates.zip index 68e1ec527..a78904ae7 100644 Binary files a/dev/_downloads/99d1b60ac02d74de2908f74166caf0a6/viz_earth_coordinates.zip and b/dev/_downloads/99d1b60ac02d74de2908f74166caf0a6/viz_earth_coordinates.zip differ diff --git a/dev/_downloads/9a0690581f35d885a20f1f0fa0068842/viz_widget.ipynb b/dev/_downloads/9a0690581f35d885a20f1f0fa0068842/viz_widget.ipynb index 0f54781b4..0ade840cb 100644 --- a/dev/_downloads/9a0690581f35d885a20f1f0fa0068842/viz_widget.ipynb +++ b/dev/_downloads/9a0690581f35d885a20f1f0fa0068842/viz_widget.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import asyncio\nimport platform\nimport time\n\nimport numpy as np\n\nfrom fury import actor, window\nfrom fury.stream.widget import Widget\n\ninteractive = False\nwindow_size = (720, 500)\nN = 4\ncenters = np.random.normal(size=(N, 3))\ncolors = np.random.uniform(0.1, 1.0, size=(N, 3))\nactors = actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)\nscene = window.Scene()\nscene.add(actors)\nshowm = window.ShowManager(scene, size=(window_size[0], window_size[1]))" + "import asyncio\nimport platform\nimport time\n\nimport numpy as np\n\nimport fury\n\ninteractive = False\nwindow_size = (720, 500)\nN = 4\ncenters = np.random.normal(size=(N, 3))\ncolors = np.random.uniform(0.1, 1.0, size=(N, 3))\nactors = fury.actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)\nscene = fury.window.Scene()\nscene.add(actors)\nshowm = fury.window.ShowManager(scene, size=(window_size[0], window_size[1]))" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "widget = Widget(showm, port=8000)\n\n# if you want to use webRTC, you can pass the argument to choose this encoding\n# which is a more robust option.\n# `widget = Widget(showm, port=8000, encoding='webrtc')`\n\ntime_sleep = 1000 if interactive else 1" + "widget = fury.stream.Widget(showm, port=8000)\n\n# if you want to use webRTC, you can pass the argument to choose this encoding\n# which is a more robust option.\n# `widget = Widget(showm, port=8000, encoding='webrtc')`\n\ntime_sleep = 1000 if interactive else 1" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "if platform.system() == \"Windows\":\n\n async def main():\n widget.start()\n await asyncio.sleep(time_sleep)\n widget.stop()\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main())\nelse:\n # Running the widget in a normal Python environment in Linux or MacOS\n # we can use the normal version of the widget.\n widget.start()\n time.sleep(time_sleep)\n widget.stop()\n\nwindow.record(showm.scene, size=window_size, out_path=\"viz_widget.png\")" + "if platform.system() == \"Windows\":\n\n async def main():\n widget.start()\n await asyncio.sleep(time_sleep)\n widget.stop()\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main())\nelse:\n # Running the widget in a normal Python environment in Linux or MacOS\n # we can use the normal version of the widget.\n widget.start()\n time.sleep(time_sleep)\n widget.stop()\n\nfury.window.record(showm.scene, size=window_size, out_path=\"viz_widget.png\")" ] } ], diff --git a/dev/_downloads/9a61b3bc372d33ce36ca176a3f4efe89/viz_pbr_spheres.zip b/dev/_downloads/9a61b3bc372d33ce36ca176a3f4efe89/viz_pbr_spheres.zip index 8c33abb16..1e0c23f7c 100644 Binary files a/dev/_downloads/9a61b3bc372d33ce36ca176a3f4efe89/viz_pbr_spheres.zip and b/dev/_downloads/9a61b3bc372d33ce36ca176a3f4efe89/viz_pbr_spheres.zip differ diff --git a/dev/_downloads/9e6be02794740496fc4184b942139604/viz_ui_slider.py b/dev/_downloads/9e6be02794740496fc4184b942139604/viz_ui_slider.py index 034761fc3..31e47f0c4 100644 --- a/dev/_downloads/9e6be02794740496fc4184b942139604/viz_ui_slider.py +++ b/dev/_downloads/9e6be02794740496fc4184b942139604/viz_ui_slider.py @@ -12,13 +12,12 @@ import numpy as np -from fury import actor, ui, window -from fury.data import fetch_viz_icons +import fury ############################################################################## # First we need to fetch some icons that are included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ############################################################################### # Cube and sliders @@ -26,7 +25,7 @@ # # Add a cube to the scene . -cube = actor.cube( +cube = fury.actor.cube( centers=np.array([[15, 0, 0]]), colors=np.array([[0, 0, 1]]), scales=np.array([[20, 20, 20]]), @@ -37,11 +36,11 @@ # Now we'll add five sliders: 1 circular and 4 linear sliders. # By default the alignments are 'bottom' for horizontal and 'top' for vertical. -ring_slider = ui.RingSlider2D( +ring_slider = fury.ui.RingSlider2D( center=(630, 400), initial_value=0, text_template="{angle:5.1f}°" ) -hor_line_slider_text_top = ui.LineSlider2D( +hor_line_slider_text_top = fury.ui.LineSlider2D( center=(400, 230), initial_value=0, orientation="horizontal", @@ -50,7 +49,7 @@ text_alignment="top", ) -hor_line_slider_text_bottom = ui.LineSlider2D( +hor_line_slider_text_bottom = fury.ui.LineSlider2D( center=(400, 200), initial_value=0, orientation="horizontal", @@ -59,7 +58,7 @@ text_alignment="bottom", ) -ver_line_slider_text_left = ui.LineSlider2D( +ver_line_slider_text_left = fury.ui.LineSlider2D( center=(100, 400), initial_value=0, orientation="vertical", @@ -68,7 +67,7 @@ text_alignment="left", ) -ver_line_slider_text_right = ui.LineSlider2D( +ver_line_slider_text_right = fury.ui.LineSlider2D( center=(150, 400), initial_value=0, orientation="vertical", @@ -118,7 +117,7 @@ def translate_cube_hor(slider): # manager. current_size = (800, 800) -show_manager = window.ShowManager(size=current_size, title="FURY Cube Example") +show_manager = fury.window.ShowManager(size=current_size, title="FURY Cube Example") show_manager.scene.add(cube) show_manager.scene.add(ring_slider) @@ -150,4 +149,4 @@ def translate_cube_hor(slider): if interactive: show_manager.start() -window.record(show_manager.scene, size=current_size, out_path="viz_slider.png") +fury.window.record(show_manager.scene, size=current_size, out_path="viz_slider.png") diff --git a/dev/_downloads/9ebe900db14d7cf8291982cfd64a5eae/viz_introduction.py b/dev/_downloads/9ebe900db14d7cf8291982cfd64a5eae/viz_introduction.py index f3b2673bf..55c6a124e 100644 --- a/dev/_downloads/9ebe900db14d7cf8291982cfd64a5eae/viz_introduction.py +++ b/dev/_downloads/9ebe900db14d7cf8291982cfd64a5eae/viz_introduction.py @@ -57,12 +57,11 @@ import numpy as np -from fury import actor, window -from fury.animation import Animation +import fury -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager(scene, size=(900, 768)) +showm = fury.window.ShowManager(scene, size=(900, 768)) showm.initialize() @@ -73,11 +72,11 @@ # This is a quick demo showing how to translate a sphere from (0, 0, 0) to # (1, 1, 1). # First, we create an ``Animation``. See ``viz_interpolators.py`` tutorial -animation = Animation() +animation = fury.animation.Animation() ############################################################################### # We also create the FURY sphere actor that will be animated. -sphere = actor.sphere(np.zeros([1, 3]), np.ones([1, 3])) +sphere = fury.actor.sphere(np.zeros([1, 3]), np.ones([1, 3])) ############################################################################### # Then lets add the sphere actor to the ``Animation`` @@ -112,6 +111,6 @@ if interactive: showm.start() -window.record( +fury.window.record( scene, out_path="viz_keyframe_animation_introduction.png", size=(900, 768) ) diff --git a/dev/_downloads/9f4f7e3dea1f0e152b6d0c2f88f21109/viz_introduction.ipynb b/dev/_downloads/9f4f7e3dea1f0e152b6d0c2f88f21109/viz_introduction.ipynb index 7b1050a95..4324bf4cc 100644 --- a/dev/_downloads/9f4f7e3dea1f0e152b6d0c2f88f21109/viz_introduction.ipynb +++ b/dev/_downloads/9f4f7e3dea1f0e152b6d0c2f88f21109/viz_introduction.ipynb @@ -36,7 +36,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\nfrom fury.animation import Animation\n\nscene = window.Scene()\n\nshowm = window.ShowManager(scene, size=(900, 768))\nshowm.initialize()" + "import numpy as np\n\nimport fury\n\nscene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(scene, size=(900, 768))\nshowm.initialize()" ] }, { @@ -54,7 +54,7 @@ }, "outputs": [], "source": [ - "animation = Animation()" + "animation = fury.animation.Animation()" ] }, { @@ -72,7 +72,7 @@ }, "outputs": [], "source": [ - "sphere = actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))" + "sphere = fury.actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))" ] }, { @@ -151,7 +151,7 @@ }, "outputs": [], "source": [ - "interactive = False\n\nif interactive:\n showm.start()\n\nwindow.record(\n scene, out_path=\"viz_keyframe_animation_introduction.png\", size=(900, 768)\n)" + "interactive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(\n scene, out_path=\"viz_keyframe_animation_introduction.png\", size=(900, 768)\n)" ] } ], diff --git a/dev/_downloads/a15dfdc281ecf5ef2be53f74eba90888/viz_fractals.zip b/dev/_downloads/a15dfdc281ecf5ef2be53f74eba90888/viz_fractals.zip index c74c26fec..5fad89ce3 100644 Binary files a/dev/_downloads/a15dfdc281ecf5ef2be53f74eba90888/viz_fractals.zip and b/dev/_downloads/a15dfdc281ecf5ef2be53f74eba90888/viz_fractals.zip differ diff --git a/dev/_downloads/a45e245b3472717786fb1ffc09a9f1c5/viz_dt_ellipsoids.ipynb b/dev/_downloads/a45e245b3472717786fb1ffc09a9f1c5/viz_dt_ellipsoids.ipynb index b250c2a6f..be12ed47b 100644 --- a/dev/_downloads/a45e245b3472717786fb1ffc09a9f1c5/viz_dt_ellipsoids.ipynb +++ b/dev/_downloads/a45e245b3472717786fb1ffc09a9f1c5/viz_dt_ellipsoids.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nfrom dipy.io.image import load_nifti\nimport numpy as np\n\nfrom fury import actor, ui, window\nfrom fury.actor import _color_fa, _fa\nfrom fury.data import fetch_viz_dmri, read_viz_dmri\nfrom fury.primitive import prim_sphere" + "import itertools\n\nfrom dipy.io.image import load_nifti\nimport numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_dmri()" + "fury.data.fetch_viz_dmri()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "slice_evecs, _ = load_nifti(read_viz_dmri(\"slice_evecs.nii.gz\"))\nslice_evals, _ = load_nifti(read_viz_dmri(\"slice_evals.nii.gz\"))\nroi_evecs, _ = load_nifti(read_viz_dmri(\"roi_evecs.nii.gz\"))\nroi_evals, _ = load_nifti(read_viz_dmri(\"roi_evals.nii.gz\"))\nwhole_brain_evecs, _ = load_nifti(read_viz_dmri(\"whole_brain_evecs.nii.gz\"))\nwhole_brain_evals, _ = load_nifti(read_viz_dmri(\"whole_brain_evals.nii.gz\"))" + "slice_evecs, _ = load_nifti(fury.data.read_viz_dmri(\"slice_evecs.nii.gz\"))\nslice_evals, _ = load_nifti(fury.data.read_viz_dmri(\"slice_evals.nii.gz\"))\nroi_evecs, _ = load_nifti(fury.data.read_viz_dmri(\"roi_evecs.nii.gz\"))\nroi_evals, _ = load_nifti(fury.data.read_viz_dmri(\"roi_evals.nii.gz\"))\nwhole_brain_evecs, _ = load_nifti(fury.data.read_viz_dmri(\"whole_brain_evecs.nii.gz\"))\nwhole_brain_evals, _ = load_nifti(fury.data.read_viz_dmri(\"whole_brain_evals.nii.gz\"))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "vertices, faces = prim_sphere(\"repulsion100\", True)" + "vertices, faces = fury.prim_sphere(\"repulsion100\", True)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "tensor_slice = actor.tensor_slicer(\n evals=slice_evals, evecs=slice_evecs, sphere=sphere100, scale=0.3\n)" + "tensor_slice = fury.actor.tensor_slicer(\n evals=slice_evals, evecs=slice_evecs, sphere=sphere100, scale=0.3\n)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.background([255, 255, 255])\nscene.add(tensor_slice)\n\n# Create show manager\nshowm = window.ShowManager(scene, size=(600, 600))\n\n# Enables/disables interactive visualization\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(showm.scene, size=(600, 600), out_path=\"tensor_slice_100.png\")" + "scene = fury.window.Scene()\nscene.background([255, 255, 255])\nscene.add(tensor_slice)\n\n# Create show manager\nshowm = fury.window.ShowManager(scene, size=(600, 600))\n\n# Enables/disables interactive visualization\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(showm.scene, size=(600, 600), out_path=\"tensor_slice_100.png\")" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "scene.roll(10)\nscene.pitch(90)\nshowm = window.ShowManager(scene, size=(600, 600), order_transparent=True)\nshowm.scene.zoom(50)\n\nif interactive:\n showm.render()\n showm.start()\n\nwindow.record(\n showm.scene,\n out_path=\"tensor_slice_100_zoom.png\",\n size=(600, 300),\n reset_camera=False,\n)" + "scene.roll(10)\nscene.pitch(90)\nshowm = fury.window.ShowManager(scene, size=(600, 600), order_transparent=True)\nshowm.scene.zoom(50)\n\nif interactive:\n showm.render()\n showm.start()\n\nfury.window.record(\n showm.scene,\n out_path=\"tensor_slice_100_zoom.png\",\n size=(600, 300),\n reset_camera=False,\n)" ] }, { @@ -177,7 +177,7 @@ }, "outputs": [], "source": [ - "def get_params(evecs, evals):\n # We define the centers which corresponds to the ellipsoids positions.\n valid_mask = np.abs(evecs).max(axis=(-2, -1)) > 0\n indices = np.nonzero(valid_mask)\n centers = np.asarray(indices).T\n\n # We need to pass the data of the axes and lengths of the ellipsoid as a\n # ndarray, so it is necessary to rearrange the data of the eigenvectors and\n # eigenvalues.\n fevecs = evecs[indices]\n fevals = evals[indices]\n\n # We need to define the colors of the ellipsoids following the default\n # coloring in tensor_slicer that is uses _color_fa that is a way to map\n # colors to each tensor based on the fractional anisotropy (FA) of each\n # diffusion tensor.\n colors = _color_fa(_fa(fevals), fevecs)\n\n return centers, fevecs, fevals, colors" + "def get_params(evecs, evals):\n # We define the centers which corresponds to the ellipsoids positions.\n valid_mask = np.abs(evecs).max(axis=(-2, -1)) > 0\n indices = np.nonzero(valid_mask)\n centers = np.asarray(indices).T\n\n # We need to pass the data of the axes and lengths of the ellipsoid as a\n # ndarray, so it is necessary to rearrange the data of the eigenvectors and\n # eigenvalues.\n fevecs = evecs[indices]\n fevals = evals[indices]\n\n # We need to define the colors of the ellipsoids following the default\n # coloring in tensor_slicer that is uses _color_fa that is a way to map\n # colors to each tensor based on the fractional anisotropy (FA) of each\n # diffusion tensor.\n colors = fury.actor._color_fa(fury.actor._fa(fevals), fevecs)\n\n return centers, fevecs, fevals, colors" ] }, { @@ -213,7 +213,7 @@ }, "outputs": [], "source": [ - "tensors = actor.ellipsoid(\n centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6\n)\nshowm.scene.add(tensors)\n\nif interactive:\n showm.start()\n\nwindow.record(scene, size=(600, 600), out_path=\"tensor_slice_sdf.png\")" + "tensors = fury.actor.ellipsoid(\n centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6\n)\nshowm.scene.add(tensors)\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, size=(600, 600), out_path=\"tensor_slice_sdf.png\")" ] }, { @@ -231,7 +231,7 @@ }, "outputs": [], "source": [ - "scene.roll(10)\nscene.pitch(90)\nshowm = window.ShowManager(scene, size=(600, 600), order_transparent=True)\nshowm.scene.zoom(50)\n\nif interactive:\n showm.render()\n showm.start()\n\nwindow.record(\n showm.scene,\n out_path=\"tensor_slice_sdf_zoom.png\",\n size=(600, 300),\n reset_camera=False,\n)\n\nshowm.scene.clear()\nshowm.scene.pitch(-90)\nshowm.scene.roll(-10)" + "scene.roll(10)\nscene.pitch(90)\nshowm = fury.window.ShowManager(scene, size=(600, 600), order_transparent=True)\nshowm.scene.zoom(50)\n\nif interactive:\n showm.render()\n showm.start()\n\nfury.window.record(\n showm.scene,\n out_path=\"tensor_slice_sdf_zoom.png\",\n size=(600, 300),\n reset_camera=False,\n)\n\nshowm.scene.clear()\nshowm.scene.pitch(-90)\nshowm.scene.roll(-10)" ] }, { @@ -249,7 +249,7 @@ }, "outputs": [], "source": [ - "mevals = np.array([1.4, 1.0, 0.35]) * 10 ** (-3)\nmevecs = np.array(\n [[2 / 3, -2 / 3, 1 / 3], [1 / 3, 2 / 3, 2 / 3], [2 / 3, 1 / 3, -2 / 3]]\n)\n\nevals = np.zeros((1, 1, 1, 3))\nevecs = np.zeros((1, 1, 1, 3, 3))\n\nevals[..., :] = mevals\nevecs[..., :, :] = mevecs\n\nvertices, faces = prim_sphere(\"repulsion200\", True)\nsphere200 = Sphere(vertices, faces)\nvertices, faces = prim_sphere(\"repulsion724\", True)\nsphere724 = Sphere(vertices, faces)\n\ntensor_100 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere100, scale=1.0)\ntensor_200 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere200, scale=1.0)\ntensor_724 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere724, scale=1.0)\n\ncenters, evecs, evals, colors = get_params(evecs=evecs, evals=evals)\ntensor_sdf = actor.ellipsoid(\n centers=centers, axes=evecs, lengths=evals, colors=colors, scales=2.0\n)" + "mevals = np.array([1.4, 1.0, 0.35]) * 10 ** (-3)\nmevecs = np.array(\n [[2 / 3, -2 / 3, 1 / 3], [1 / 3, 2 / 3, 2 / 3], [2 / 3, 1 / 3, -2 / 3]]\n)\n\nevals = np.zeros((1, 1, 1, 3))\nevecs = np.zeros((1, 1, 1, 3, 3))\n\nevals[..., :] = mevals\nevecs[..., :, :] = mevecs\n\nvertices, faces = fury.prim_sphere(\"repulsion200\", True)\nsphere200 = Sphere(vertices, faces)\nvertices, faces = fury.prim_sphere(\"repulsion724\", True)\nsphere724 = Sphere(vertices, faces)\n\ntensor_100 = fury.actor.tensor_slicer(\n evals=evals, evecs=evecs, sphere=sphere100, scale=1.0\n)\ntensor_200 = fury.actor.tensor_slicer(\n evals=evals, evecs=evecs, sphere=sphere200, scale=1.0\n)\ntensor_724 = fury.actor.tensor_slicer(\n evals=evals, evecs=evecs, sphere=sphere724, scale=1.0\n)\n\ncenters, evecs, evals, colors = get_params(evecs=evecs, evals=evals)\ntensor_sdf = fury.actor.ellipsoid(\n centers=centers, axes=evecs, lengths=evals, colors=colors, scales=2.0\n)" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "objects = [tensor_100, tensor_200, tensor_724, tensor_sdf]\ntext = [\n actor.vector_text(\"Tensor 100\"),\n actor.vector_text(\"Tensor 200\"),\n actor.vector_text(\"Tensor 724\"),\n actor.vector_text(\"Tensor SDF\"),\n]\n\ngrid_ui = ui.GridUI(\n actors=objects,\n captions=text,\n cell_padding=0.1,\n caption_offset=(-0.7, -2.5, 0),\n dim=(1, 4),\n)\n\nscene = window.Scene()\nscene.background([255, 255, 255])\nscene.zoom(3.5)\nscene.set_camera(position=(3.2, -20, 12), focal_point=(3.2, 0.0, 0.0))\nshowm = window.ShowManager(scene, size=(560, 200))\nshowm.scene.add(grid_ui)\n\nif interactive:\n showm.start()\n\nwindow.record(\n showm.scene,\n size=(560, 200),\n out_path=\"tensor_comparison.png\",\n reset_camera=False,\n magnification=2,\n)\n\nshowm.scene.clear()" + "objects = [tensor_100, tensor_200, tensor_724, tensor_sdf]\ntext = [\n fury.actor.vector_text(\"Tensor 100\"),\n fury.actor.vector_text(\"Tensor 200\"),\n fury.actor.vector_text(\"Tensor 724\"),\n fury.actor.vector_text(\"Tensor SDF\"),\n]\n\ngrid_ui = fury.ui.GridUI(\n actors=objects,\n captions=text,\n cell_padding=0.1,\n caption_offset=(-0.7, -2.5, 0),\n dim=(1, 4),\n)\n\nscene = fury.window.Scene()\nscene.background([255, 255, 255])\nscene.zoom(3.5)\nscene.set_camera(position=(3.2, -20, 12), focal_point=(3.2, 0.0, 0.0))\nshowm = fury.window.ShowManager(scene, size=(560, 200))\nshowm.scene.add(grid_ui)\n\nif interactive:\n showm.start()\n\nfury.window.record(\n showm.scene,\n size=(560, 200),\n out_path=\"tensor_comparison.png\",\n reset_camera=False,\n magnification=2,\n)\n\nshowm.scene.clear()" ] }, { @@ -285,7 +285,7 @@ }, "outputs": [], "source": [ - "tensor_roi = actor.tensor_slicer(\n evals=roi_evals, evecs=roi_evecs, sphere=sphere100, scale=0.3\n)\n\ndata_shape = roi_evals.shape[:3]\ntensor_roi.display_extent(0, data_shape[0], 0, data_shape[1], 0, data_shape[2])\n\nshowm.size = (600, 600)\nshowm.scene.background([0, 0, 0])\nshowm.scene.add(tensor_roi)\nshowm.scene.azimuth(87)\n\nif interactive:\n showm.start()\n\nwindow.record(showm.scene, size=(600, 600), out_path=\"tensor_roi_100.png\")\n\nshowm.scene.clear()" + "tensor_roi = fury.actor.tensor_slicer(\n evals=roi_evals, evecs=roi_evecs, sphere=sphere100, scale=0.3\n)\n\ndata_shape = roi_evals.shape[:3]\ntensor_roi.display_extent(0, data_shape[0], 0, data_shape[1], 0, data_shape[2])\n\nshowm.size = (600, 600)\nshowm.scene.background([0, 0, 0])\nshowm.scene.add(tensor_roi)\nshowm.scene.azimuth(87)\n\nif interactive:\n showm.start()\n\nfury.window.record(showm.scene, size=(600, 600), out_path=\"tensor_roi_100.png\")\n\nshowm.scene.clear()" ] }, { @@ -303,7 +303,7 @@ }, "outputs": [], "source": [ - "centers, evecs, evals, colors = get_params(roi_evecs, roi_evals)\n\ntensors = actor.ellipsoid(\n centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6\n)\nshowm.scene.add(tensors)\n\nif interactive:\n showm.start()\n\nwindow.record(showm.scene, size=(600, 600), out_path=\"tensor_roi_sdf.png\")\n\nshowm.scene.clear()" + "centers, evecs, evals, colors = get_params(roi_evecs, roi_evals)\n\ntensors = fury.actor.ellipsoid(\n centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6\n)\nshowm.scene.add(tensors)\n\nif interactive:\n showm.start()\n\nfury.window.record(showm.scene, size=(600, 600), out_path=\"tensor_roi_sdf.png\")\n\nshowm.scene.clear()" ] }, { @@ -321,7 +321,7 @@ }, "outputs": [], "source": [ - "centers, evecs, evals, colors = get_params(whole_brain_evecs, whole_brain_evals)\n\n# We remove all the noise around the brain to have a better visualization.\nfil = [len(set(elem)) != 1 for elem in evals]\ncenters = np.array(list(itertools.compress(centers, fil)))\ncolors = np.array(list(itertools.compress(colors, fil)))\nevecs = np.array(list(itertools.compress(evecs, fil)))\nevals = np.array(list(itertools.compress(evals, fil)))\n\ntensors = actor.ellipsoid(\n centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6\n)\n\nscene = window.Scene()\nscene.add(tensors)\nscene.pitch(180)\nshowm = window.ShowManager(scene, size=(600, 600))\n\nif interactive:\n showm.start()\n\nwindow.record(\n showm.scene,\n size=(600, 600),\n reset_camera=False,\n out_path=\"tensor_whole_brain_sdf.png\",\n)\n\nshowm.scene.clear()" + "centers, evecs, evals, colors = get_params(whole_brain_evecs, whole_brain_evals)\n\n# We remove all the noise around the brain to have a better visualization.\nfil = [len(set(elem)) != 1 for elem in evals]\ncenters = np.array(list(itertools.compress(centers, fil)))\ncolors = np.array(list(itertools.compress(colors, fil)))\nevecs = np.array(list(itertools.compress(evecs, fil)))\nevals = np.array(list(itertools.compress(evals, fil)))\n\ntensors = fury.actor.ellipsoid(\n centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6\n)\n\nscene = fury.window.Scene()\nscene.add(tensors)\nscene.pitch(180)\nshowm = fury.window.ShowManager(scene, size=(600, 600))\n\nif interactive:\n showm.start()\n\nfury.window.record(\n showm.scene,\n size=(600, 600),\n reset_camera=False,\n out_path=\"tensor_whole_brain_sdf.png\",\n)\n\nshowm.scene.clear()" ] } ], diff --git a/dev/_downloads/a58ef38299540de6143bfa8bdf807686/viz_helical_motion.py b/dev/_downloads/a58ef38299540de6143bfa8bdf807686/viz_helical_motion.py index b17f319ff..b3cad3132 100644 --- a/dev/_downloads/a58ef38299540de6143bfa8bdf807686/viz_helical_motion.py +++ b/dev/_downloads/a58ef38299540de6143bfa8bdf807686/viz_helical_motion.py @@ -20,7 +20,7 @@ import numpy as np -from fury import actor, ui, utils, window +import fury ############################################################################### # Let's define some variable and their description: @@ -50,12 +50,12 @@ ############################################################################### # Creating a scene object and configuring the camera's position -scene = window.Scene() +scene = fury.window.Scene() scene.zoom(1.2) scene.set_camera( position=(10, 12.5, 19), focal_point=(3.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0) ) -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(800, 600), reset_camera=True, order_transparent=True ) @@ -64,11 +64,11 @@ # Creating a blue colored arrow which shows the direction of magnetic field and # electric field. -color_arrow = window.colors.blue # color of the arrow can be manipulated +color_arrow = fury.window.colors.blue # color of the arrow can be manipulated centers = np.array([[0, 0, 0]]) directions = np.array([[1, 0, 0]]) heights = np.array([8]) -arrow_actor = actor.arrow( +arrow_actor = fury.actor.arrow( centers, directions, color_arrow, @@ -90,13 +90,13 @@ ############################################################################### # Initializing point actor which will represent the charged particle -color_particle = window.colors.red # color of particle can be manipulated +color_particle = fury.window.colors.red # color of particle can be manipulated pts = np.array([[x, y, z]]) -charge_actor = actor.point(pts, color_particle, point_radius=radius_particle) +charge_actor = fury.actor.point(pts, color_particle, point_radius=radius_particle) scene.add(charge_actor) -vertices = utils.vertices_from_actor(charge_actor) -vcolors = utils.colors_from_actor(charge_actor, "colors") +vertices = fury.utils.vertices_from_actor(charge_actor) +vcolors = fury.utils.colors_from_actor(charge_actor, "colors") no_vertices_per_point = len(vertices) initial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0) @@ -104,7 +104,7 @@ ############################################################################### # Initializing text box to display the name of the animation -tb = ui.TextBlock2D(bold=True, position=(100, 90)) +tb = fury.ui.TextBlock2D(bold=True, position=(100, 90)) m1 = "Motion of a charged particle in a " m2 = "combined electric and magnetic field" tb.message = m1 + m2 @@ -143,13 +143,13 @@ def timer_callback(_obj, _event): vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0) - utils.update_actor(charge_actor) + fury.utils.update_actor(charge_actor) # Plotting the path followed by the particle coor_2 = np.array([x, y, z]) coors = np.array([coor_1, coor_2]) coors = [coors] - line_actor = actor.line(coors, window.colors.cyan, linewidth=3) + line_actor = fury.actor.line(coors, fury.window.colors.cyan, linewidth=3) scene.add(line_actor) coor_1 = coor_2 @@ -166,4 +166,4 @@ def timer_callback(_obj, _event): showm.add_timer_callback(True, 15, timer_callback) showm.start() -window.record(showm.scene, size=(800, 600), out_path="viz_helical_motion.png") +fury.window.record(showm.scene, size=(800, 600), out_path="viz_helical_motion.png") diff --git a/dev/_downloads/a72ac8dbca1bdb9fc4c6d1c9797fa511/viz_tab.zip b/dev/_downloads/a72ac8dbca1bdb9fc4c6d1c9797fa511/viz_tab.zip index 572912fd0..e8635382a 100644 Binary files a/dev/_downloads/a72ac8dbca1bdb9fc4c6d1c9797fa511/viz_tab.zip and b/dev/_downloads/a72ac8dbca1bdb9fc4c6d1c9797fa511/viz_tab.zip differ diff --git a/dev/_downloads/a9b8318fd0eccbcba5df20bbc8c9d72b/viz_hierarchical_animation.zip b/dev/_downloads/a9b8318fd0eccbcba5df20bbc8c9d72b/viz_hierarchical_animation.zip index 45d90dbbf..0e8c51e51 100644 Binary files a/dev/_downloads/a9b8318fd0eccbcba5df20bbc8c9d72b/viz_hierarchical_animation.zip and b/dev/_downloads/a9b8318fd0eccbcba5df20bbc8c9d72b/viz_hierarchical_animation.zip differ diff --git a/dev/_downloads/add7a5726ae59960b3bcb9ef1af5110c/viz_interaction.py b/dev/_downloads/add7a5726ae59960b3bcb9ef1af5110c/viz_interaction.py index 7becb5964..73eb145dc 100644 --- a/dev/_downloads/add7a5726ae59960b3bcb9ef1af5110c/viz_interaction.py +++ b/dev/_downloads/add7a5726ae59960b3bcb9ef1af5110c/viz_interaction.py @@ -36,13 +36,11 @@ import numpy as np -from fury import actor, window -from fury.stream.client import FuryStreamClient, FuryStreamInteraction +import fury # if this example it's not working for you and you're using MacOs # uncomment the following line # multiprocessing.set_start_method('spawn') -from fury.stream.server.main import WEBRTC_AVAILABLE, web_server, web_server_raw_array if __name__ == "__main__": interactive = False @@ -77,23 +75,23 @@ centers = np.array([[0, 0, 0], [-1, 0, 0], [1, 0, 0]]) colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) - actors = actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors) - scene = window.Scene() + actors = fury.actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors) + scene = fury.window.Scene() scene.add(actors) - showm = window.ShowManager(scene, size=(window_size[0], window_size[1])) + showm = fury.window.ShowManager(scene, size=(window_size[0], window_size[1])) - stream = FuryStreamClient( + stream = fury.stream.FuryStreamClient( showm, max_window_size=max_window_size, use_raw_array=use_raw_array ) - stream_interaction = FuryStreamInteraction( + stream_interaction = fury.stream.client.FuryStreamInteraction( showm, max_queue_size=max_queue_size, use_raw_array=use_raw_array ) if use_raw_array: p = multiprocessing.Process( - target=web_server_raw_array, + target=fury.stream.server.web_server_raw_array, args=( stream.img_manager.image_buffers, stream.img_manager.info_buffer, @@ -102,13 +100,13 @@ 8000, "localhost", True, - WEBRTC_AVAILABLE, + fury.stream.server.main.WEBRTC_AVAILABLE, ), ) else: p = multiprocessing.Process( - target=web_server, + target=fury.stream.server.web_server, args=( stream.img_manager.image_buffer_names, stream.img_manager.info_buffer_name, @@ -117,7 +115,7 @@ 8000, "localhost", True, - WEBRTC_AVAILABLE, + fury.stream.server.main.WEBRTC_AVAILABLE, ), ) p.start() @@ -143,4 +141,4 @@ stream.cleanup() stream_interaction.cleanup() - window.record(showm.scene, size=window_size, out_path="viz_interaction.png") + fury.window.record(showm.scene, size=window_size, out_path="viz_interaction.png") diff --git a/dev/_downloads/b0080f836f729d7f9eb9ba972bd58bfa/viz_shapes.zip b/dev/_downloads/b0080f836f729d7f9eb9ba972bd58bfa/viz_shapes.zip index 92b70b1f7..055e6872c 100644 Binary files a/dev/_downloads/b0080f836f729d7f9eb9ba972bd58bfa/viz_shapes.zip and b/dev/_downloads/b0080f836f729d7f9eb9ba972bd58bfa/viz_shapes.zip differ diff --git a/dev/_downloads/b0147e9215e27233d0d56f5c5c388371/viz_surfaces.py b/dev/_downloads/b0147e9215e27233d0d56f5c5c388371/viz_surfaces.py index 6cc62c551..fe19ecb91 100644 --- a/dev/_downloads/b0147e9215e27233d0d56f5c5c388371/viz_surfaces.py +++ b/dev/_downloads/b0147e9215e27233d0d56f5c5c388371/viz_surfaces.py @@ -14,9 +14,7 @@ import numpy as np -from fury import utils, window -from fury.io import load_polydata, save_polydata -from fury.lib import PolyData +import fury ############################################################################### # Import useful functions @@ -25,7 +23,7 @@ ############################################################################### # Create an empty ``PolyData`` -my_polydata = PolyData() +my_polydata = fury.lib.PolyData() ############################################################################### # Create a cube with vertices and triangles as numpy arrays @@ -65,43 +63,43 @@ ############################################################################### # Set vertices and triangles in the ``PolyData`` -utils.set_polydata_vertices(my_polydata, my_vertices) -utils.set_polydata_triangles(my_polydata, my_triangles) +fury.utils.set_polydata_vertices(my_polydata, my_vertices) +fury.utils.set_polydata_triangles(my_polydata, my_triangles) ############################################################################### # Save the ``PolyData`` file_name = "my_cube.vtk" -save_polydata(my_polydata, file_name) +fury.io.save_polydata(my_polydata, file_name) print("Surface saved in " + file_name) ############################################################################### # Load the ``PolyData`` -cube_polydata = load_polydata(file_name) +cube_polydata = fury.io.load_polydata(file_name) ############################################################################### # add color based on vertices position -cube_vertices = utils.get_polydata_vertices(cube_polydata) +cube_vertices = fury.utils.get_polydata_vertices(cube_polydata) colors = cube_vertices * 255 -utils.set_polydata_colors(cube_polydata, colors) +fury.utils.set_polydata_colors(cube_polydata, colors) print("new surface colors") -print(utils.get_polydata_colors(cube_polydata)) +print(fury.utils.get_polydata_colors(cube_polydata)) ############################################################################### # Visualize surfaces # get Actor -cube_actor = utils.get_actor_from_polydata(cube_polydata) +cube_actor = fury.utils.get_actor_from_polydata(cube_polydata) # Create a scene -scene = window.Scene() +scene = fury.window.Scene() scene.add(cube_actor) scene.set_camera(position=(10, 5, 7), focal_point=(0.5, 0.5, 0.5)) scene.zoom(3) # display -# window.show(scene, size=(600, 600), reset_camera=False) -window.record(scene, out_path="cube.png", size=(600, 600)) +# fury.window.show(scene, size=(600, 600), reset_camera=False) +fury.window.record(scene, out_path="cube.png", size=(600, 600)) diff --git a/dev/_downloads/b03f0b0eb9b655c3899a93d34941848b/viz_network_animated.ipynb b/dev/_downloads/b03f0b0eb9b655c3899a93d34941848b/viz_network_animated.ipynb index bde728ccb..d8fa35e53 100644 --- a/dev/_downloads/b03f0b0eb9b655c3899a93d34941848b/viz_network_animated.ipynb +++ b/dev/_downloads/b03f0b0eb9b655c3899a93d34941848b/viz_network_animated.ipynb @@ -22,7 +22,7 @@ }, "outputs": [], "source": [ - "import math\nfrom os.path import join as pjoin\n\nimport numpy as np\n\nfrom fury import actor, colormap as cmap, window\nfrom fury.utils import compute_bounds, update_actor, vertices_from_actor" + "import math\nfrom os.path import join as pjoin\n\nimport numpy as np\n\nimport fury" ] }, { @@ -112,7 +112,7 @@ }, "outputs": [], "source": [ - "category2index = {category: i for i, category in enumerate(np.unique(categories))}\n\nindex2category = np.unique(categories)\n\ncategory_colors = cmap.distinguishable_colormap(nb_colors=len(index2category))\n\ncolors = np.array(\n [category_colors[category2index[category]] for category in categories]\n)" + "category2index = {category: i for i, category in enumerate(np.unique(categories))}\n\nindex2category = np.unique(categories)\n\ncategory_colors = fury.colormap.distinguishable_colormap(nb_colors=len(index2category))\n\ncolors = np.array(\n [category_colors[category2index[category]] for category in categories]\n)" ] }, { @@ -166,7 +166,7 @@ }, "outputs": [], "source": [ - "sphere_actor = actor.sphere(\n centers=np.zeros(positions.shape), colors=colors, radii=radii * 0.5, theta=8, phi=8\n)\n\n\nlines_actor = actor.line(\n np.zeros((len(edges), 2, 3)),\n colors=edges_colors,\n lod=False,\n fake_tube=True,\n linewidth=3,\n)" + "sphere_actor = fury.actor.sphere(\n centers=np.zeros(positions.shape), colors=colors, radii=radii * 0.5, theta=8, phi=8\n)\n\n\nlines_actor = fury.actor.line(\n np.zeros((len(edges), 2, 3)),\n colors=edges_colors,\n lod=False,\n fake_tube=True,\n linewidth=3,\n)" ] }, { @@ -184,7 +184,7 @@ }, "outputs": [], "source": [ - "def new_layout_timer(\n showm,\n edges_list,\n vertices_count,\n max_iterations=1000,\n vertex_initial_positions=None,\n):\n view_size = 500\n viscosity = 0.10\n alpha = 0.5\n a = 0.0005\n b = 1.0\n deltaT = 1.0\n\n sphere_geometry = np.array(vertices_from_actor(sphere_actor))\n geometry_length = sphere_geometry.shape[0] / vertices_count\n\n if vertex_initial_positions is not None:\n pos = np.array(vertex_initial_positions)\n else:\n pos = view_size * np.random.random((vertices_count, 3)) - view_size / 2.0\n\n velocities = np.zeros((vertices_count, 3))\n\n def iterate(iterationCount):\n nonlocal pos, velocities\n for _ in range(iterationCount):\n forces = np.zeros((vertices_count, 3))\n # repulstive forces\n for vertex1 in range(vertices_count):\n for vertex2 in range(vertex1):\n x1, y1, z1 = pos[vertex1]\n x2, y2, z2 = pos[vertex2]\n distance = (\n math.sqrt(\n (x2 - x1) * (x2 - x1)\n + (y2 - y1) * (y2 - y1)\n + (z2 - z1) * (z2 - z1)\n )\n + alpha\n )\n rx = (x2 - x1) / distance\n ry = (y2 - y1) / distance\n rz = (z2 - z1) / distance\n Fx = -b * rx / distance / distance\n Fy = -b * ry / distance / distance\n Fz = -b * rz / distance / distance\n forces[vertex1] += np.array([Fx, Fy, Fz])\n forces[vertex2] -= np.array([Fx, Fy, Fz])\n # attractive forces\n for vFrom, vTo in edges_list:\n if vFrom == vTo:\n continue\n x1, y1, z1 = pos[vFrom]\n x2, y2, z2 = pos[vTo]\n distance = math.sqrt(\n (x2 - x1) * (x2 - x1)\n + (y2 - y1) * (y2 - y1)\n + (z2 - z1) * (z2 - z1)\n )\n Rx = x2 - x1\n Ry = y2 - y1\n Rz = z2 - z1\n Fx = a * Rx * distance\n Fy = a * Ry * distance\n Fz = a * Rz * distance\n forces[vFrom] += np.array([Fx, Fy, Fz])\n forces[vTo] -= np.array([Fx, Fy, Fz])\n velocities += forces * deltaT\n velocities *= 1.0 - viscosity\n pos += velocities * deltaT\n pos[:, 0] -= np.mean(pos[:, 0])\n pos[:, 1] -= np.mean(pos[:, 1])\n pos[:, 2] -= np.mean(pos[:, 2])\n\n counter = 0\n\n def _timer(_obj, _event):\n nonlocal counter, pos\n counter += 1\n if mode == 0:\n iterate(1)\n else:\n pos[:] += (np.random.random(pos.shape) - 0.5) * 1.5\n spheres_positions = vertices_from_actor(sphere_actor)\n spheres_positions[:] = sphere_geometry + np.repeat(pos, geometry_length, axis=0)\n\n edges_positions = vertices_from_actor(lines_actor)\n edges_positions[::2] = pos[edges_list[:, 0]]\n edges_positions[1::2] = pos[edges_list[:, 1]]\n\n update_actor(lines_actor)\n compute_bounds(lines_actor)\n\n update_actor(sphere_actor)\n compute_bounds(lines_actor)\n showm.scene.reset_clipping_range()\n showm.render()\n\n if counter >= max_iterations:\n showm.exit()\n\n return _timer" + "def new_layout_timer(\n showm,\n edges_list,\n vertices_count,\n max_iterations=1000,\n vertex_initial_positions=None,\n):\n view_size = 500\n viscosity = 0.10\n alpha = 0.5\n a = 0.0005\n b = 1.0\n deltaT = 1.0\n\n sphere_geometry = np.array(fury.utils.vertices_from_actor(sphere_actor))\n geometry_length = sphere_geometry.shape[0] / vertices_count\n\n if vertex_initial_positions is not None:\n pos = np.array(vertex_initial_positions)\n else:\n pos = view_size * np.random.random((vertices_count, 3)) - view_size / 2.0\n\n velocities = np.zeros((vertices_count, 3))\n\n def iterate(iterationCount):\n nonlocal pos, velocities\n for _ in range(iterationCount):\n forces = np.zeros((vertices_count, 3))\n # repulstive forces\n for vertex1 in range(vertices_count):\n for vertex2 in range(vertex1):\n x1, y1, z1 = pos[vertex1]\n x2, y2, z2 = pos[vertex2]\n distance = (\n math.sqrt(\n (x2 - x1) * (x2 - x1)\n + (y2 - y1) * (y2 - y1)\n + (z2 - z1) * (z2 - z1)\n )\n + alpha\n )\n rx = (x2 - x1) / distance\n ry = (y2 - y1) / distance\n rz = (z2 - z1) / distance\n Fx = -b * rx / distance / distance\n Fy = -b * ry / distance / distance\n Fz = -b * rz / distance / distance\n forces[vertex1] += np.array([Fx, Fy, Fz])\n forces[vertex2] -= np.array([Fx, Fy, Fz])\n # attractive forces\n for vFrom, vTo in edges_list:\n if vFrom == vTo:\n continue\n x1, y1, z1 = pos[vFrom]\n x2, y2, z2 = pos[vTo]\n distance = math.sqrt(\n (x2 - x1) * (x2 - x1)\n + (y2 - y1) * (y2 - y1)\n + (z2 - z1) * (z2 - z1)\n )\n Rx = x2 - x1\n Ry = y2 - y1\n Rz = z2 - z1\n Fx = a * Rx * distance\n Fy = a * Ry * distance\n Fz = a * Rz * distance\n forces[vFrom] += np.array([Fx, Fy, Fz])\n forces[vTo] -= np.array([Fx, Fy, Fz])\n velocities += forces * deltaT\n velocities *= 1.0 - viscosity\n pos += velocities * deltaT\n pos[:, 0] -= np.mean(pos[:, 0])\n pos[:, 1] -= np.mean(pos[:, 1])\n pos[:, 2] -= np.mean(pos[:, 2])\n\n counter = 0\n\n def _timer(_obj, _event):\n nonlocal counter, pos\n counter += 1\n if mode == 0:\n iterate(1)\n else:\n pos[:] += (np.random.random(pos.shape) - 0.5) * 1.5\n spheres_positions = fury.utils.vertices_from_actor(sphere_actor)\n spheres_positions[:] = sphere_geometry + np.repeat(pos, geometry_length, axis=0)\n\n edges_positions = fury.utils.vertices_from_actor(lines_actor)\n edges_positions[::2] = pos[edges_list[:, 0]]\n edges_positions[1::2] = pos[edges_list[:, 1]]\n\n fury.utils.update_actor(lines_actor)\n fury.utils.compute_bounds(lines_actor)\n\n fury.utils.update_actor(sphere_actor)\n fury.utils.compute_bounds(lines_actor)\n showm.scene.reset_clipping_range()\n showm.render()\n\n if counter >= max_iterations:\n showm.exit()\n\n return _timer" ] }, { @@ -202,7 +202,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\ncamera = scene.camera()\n\nscene.add(lines_actor)\nscene.add(sphere_actor)" + "scene = fury.window.Scene()\n\ncamera = scene.camera()\n\nscene.add(lines_actor)\nscene.add(sphere_actor)" ] }, { @@ -220,7 +220,7 @@ }, "outputs": [], "source": [ - "showm = window.ShowManager(\n scene, reset_camera=False, size=(900, 768), order_transparent=True, multi_samples=8\n)\n\n\nscene.set_camera(position=(0, 0, -300))\n\ntimer_callback = new_layout_timer(\n showm, edges, vertices_count, max_iterations=200, vertex_initial_positions=positions\n)\n\n\n# Run every 16 milliseconds\nshowm.add_timer_callback(True, 16, timer_callback)\n\nshowm.start()\n\nwindow.record(showm.scene, size=(900, 768), out_path=\"viz_animated_networks.png\")" + "showm = fury.window.ShowManager(\n scene, reset_camera=False, size=(900, 768), order_transparent=True, multi_samples=8\n)\n\n\nscene.set_camera(position=(0, 0, -300))\n\ntimer_callback = new_layout_timer(\n showm, edges, vertices_count, max_iterations=200, vertex_initial_positions=positions\n)\n\n\n# Run every 16 milliseconds\nshowm.add_timer_callback(True, 16, timer_callback)\n\nshowm.start()\n\nfury.window.record(showm.scene, size=(900, 768), out_path=\"viz_animated_networks.png\")" ] } ], diff --git a/dev/_downloads/b117b7a1c76377c5cc90f0e7ba0e4af3/viz_hierarchical_animation.ipynb b/dev/_downloads/b117b7a1c76377c5cc90f0e7ba0e4af3/viz_hierarchical_animation.ipynb index 1b6c3df5a..ec7efd692 100644 --- a/dev/_downloads/b117b7a1c76377c5cc90f0e7ba0e4af3/viz_hierarchical_animation.ipynb +++ b/dev/_downloads/b117b7a1c76377c5cc90f0e7ba0e4af3/viz_hierarchical_animation.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\nfrom fury.animation import Animation\n\nscene = window.Scene()\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nshowm.initialize()" + "import numpy as np\n\nimport fury\n\nscene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nshowm.initialize()" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "road = actor.box(\n np.array([[0, 0, 0]]), colors=np.array([[1, 1, 1]]), scales=np.array([[22, 0.1, 5]])\n)" + "road = fury.actor.box(\n np.array([[0, 0, 0]]), colors=np.array([[1, 1, 1]]), scales=np.array([[22, 0.1, 5]])\n)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "body_actor = actor.box(\n np.array([[0, 0.5, 0], [-0.2, 1, 0]]),\n scales=((4, 1, 2), (2.5, 1.5, 1.8)),\n colors=(0.6, 0.3, 0.1),\n)" + "body_actor = fury.actor.box(\n np.array([[0, 0.5, 0], [-0.2, 1, 0]]),\n scales=((4, 1, 2), (2.5, 1.5, 1.8)),\n colors=(0.6, 0.3, 0.1),\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "car_anim = Animation(body_actor)" + "car_anim = fury.animation.Animation(body_actor)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "wheel_center = np.array([[0, 0, 0]])\n\nwheel_direction = np.array([[0, 0, 1]])\nwheel_positions = [\n [1.2, 0, 1.1],\n [-1.2, 0, 1.1],\n [1.2, 0, -1.1],\n [-1.2, 0, -1.1],\n]\n\nwheels = [\n actor.cylinder(\n wheel_center,\n wheel_direction,\n (0.1, 0.7, 0.3),\n radius=1.7,\n heights=0.3,\n resolution=10,\n capped=True,\n )\n for _ in range(4)\n]" + "wheel_center = np.array([[0, 0, 0]])\n\nwheel_direction = np.array([[0, 0, 1]])\nwheel_positions = [\n [1.2, 0, 1.1],\n [-1.2, 0, 1.1],\n [1.2, 0, -1.1],\n [-1.2, 0, -1.1],\n]\n\nwheels = [\n fury.actor.cylinder(\n wheel_center,\n wheel_direction,\n (0.1, 0.7, 0.3),\n radius=1.7,\n heights=0.3,\n resolution=10,\n capped=True,\n )\n for _ in range(4)\n]" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "wheels_animations = [Animation(wheel) for wheel in wheels]\n\nfor wheel_anim in wheels_animations:\n wheel_anim.set_position(0.0, wheel_positions.pop())\n wheel_anim.set_rotation(0.0, [0, 0, 1, 1])\n wheel_anim.set_rotation(1.0, [0, 0, 1, -1])" + "wheels_animations = [fury.animation.Animation(wheel) for wheel in wheels]\n\nfor wheel_anim in wheels_animations:\n wheel_anim.set_position(0.0, wheel_positions.pop())\n wheel_anim.set_rotation(0.0, [0, 0, 1, 1])\n wheel_anim.set_rotation(1.0, [0, 0, 1, -1])" ] }, { @@ -130,7 +130,7 @@ }, "outputs": [], "source": [ - "radar_shaft = actor.cylinder(\n np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), (0, 1, 0), heights=1\n)" + "radar_shaft = fury.actor.cylinder(\n np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), (0, 1, 0), heights=1\n)" ] }, { @@ -148,7 +148,7 @@ }, "outputs": [], "source": [ - "radar_shaft_anim = Animation(radar_shaft)" + "radar_shaft_anim = fury.animation.Animation(radar_shaft)" ] }, { @@ -202,7 +202,7 @@ }, "outputs": [], "source": [ - "radar = actor.cone(np.array([[0, 0, 0]]), directions=(0, 0, 0), colors=(0.2, 0.2, 0.9))" + "radar = fury.actor.cone(\n np.array([[0, 0, 0]]), directions=(0, 0, 0), colors=(0.2, 0.2, 0.9)\n)" ] }, { @@ -220,7 +220,7 @@ }, "outputs": [], "source": [ - "radar_animation = Animation(radar)" + "radar_animation = fury.animation.Animation(radar)" ] }, { @@ -310,7 +310,7 @@ }, "outputs": [], "source": [ - "showm.add_animation(car_anim)\nscene.add(road)\nscene.camera().SetPosition(0, 20, 30)\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(\n scene, out_path=\"viz_keyframe_hierarchical_animation.png\", size=(900, 768)\n)" + "showm.add_animation(car_anim)\nscene.add(road)\nscene.camera().SetPosition(0, 20, 30)\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(\n scene, out_path=\"viz_keyframe_hierarchical_animation.png\", size=(900, 768)\n)" ] } ], diff --git a/dev/_downloads/b1cbdd4b47f6141dee863c502752ffaf/viz_timers.zip b/dev/_downloads/b1cbdd4b47f6141dee863c502752ffaf/viz_timers.zip index c5958b8cf..c88d9c9a2 100644 Binary files a/dev/_downloads/b1cbdd4b47f6141dee863c502752ffaf/viz_timers.zip and b/dev/_downloads/b1cbdd4b47f6141dee863c502752ffaf/viz_timers.zip differ diff --git a/dev/_downloads/b33d67a49295c353364e99a202bc6e99/viz_selection.py b/dev/_downloads/b33d67a49295c353364e99a202bc6e99/viz_selection.py index 6c0a4c485..58b71ebca 100644 --- a/dev/_downloads/b33d67a49295c353364e99a202bc6e99/viz_selection.py +++ b/dev/_downloads/b33d67a49295c353364e99a202bc6e99/viz_selection.py @@ -22,7 +22,7 @@ import numpy as np -from fury import actor, pick, utils, window +import fury ############################################################################### # Adding many cubes of different sizes and colors @@ -44,31 +44,31 @@ ############################################################################### # Build scene and add an actor with many objects. -scene = window.Scene() +scene = fury.window.Scene() ############################################################################### # Build the actor containing all the cubes -cube_actor = actor.cube(centers, directions=(1, 0, 0), colors=colors, scales=radii) +cube_actor = fury.actor.cube(centers, directions=(1, 0, 0), colors=colors, scales=radii) ############################################################################### # Access the memory of the vertices of all the cubes -vertices = utils.vertices_from_actor(cube_actor) +vertices = fury.utils.vertices_from_actor(cube_actor) num_vertices = vertices.shape[0] num_objects = centers.shape[0] ############################################################################### # Access the memory of the colors of all the cubes -vcolors = utils.colors_from_actor(cube_actor, "colors") +vcolors = fury.utils.colors_from_actor(cube_actor, "colors") ############################################################################### # Create a rectangular 2d box as a texture rgba = 255 * np.ones((100, 200, 4)) rgba[1:-1, 1:-1] = np.zeros((98, 198, 4)) + 100 -texa = actor.texture_2d(rgba.astype(np.uint8)) +texa = fury.actor.texture_2d(rgba.astype(np.uint8)) scene.add(cube_actor) scene.add(texa) @@ -78,7 +78,7 @@ ############################################################################### # Create the Selection Manager -selm = pick.SelectionManager(select="faces") +selm = fury.pick.SelectionManager(select="faces") ############################################################################### # Tell Selection Manager to avoid selecting specific actors @@ -109,14 +109,14 @@ def hover_callback(_obj, _event): vcolors[object_index * sec : object_index * sec + sec] = ( color_change ) - utils.update_actor(cube_actor) + fury.utils.update_actor(cube_actor) showm.render() ############################################################################### # Make the window appear -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(1024, 768), order_transparent=True, reset_camera=False ) @@ -138,4 +138,4 @@ def hover_callback(_obj, _event): ############################################################################### # Save the current framebuffer in a PNG file -window.record(showm.scene, size=(1024, 768), out_path="viz_selection.png") +fury.window.record(showm.scene, size=(1024, 768), out_path="viz_selection.png") diff --git a/dev/_downloads/b64ef23a56baebb136e3a90db117d6c5/viz_emwave_animation.zip b/dev/_downloads/b64ef23a56baebb136e3a90db117d6c5/viz_emwave_animation.zip index 0bbbc83d4..1553e28ed 100644 Binary files a/dev/_downloads/b64ef23a56baebb136e3a90db117d6c5/viz_emwave_animation.zip and b/dev/_downloads/b64ef23a56baebb136e3a90db117d6c5/viz_emwave_animation.zip differ diff --git a/dev/_downloads/b65e489e7aa31f9307df145524104173/viz_ui.py b/dev/_downloads/b65e489e7aa31f9307df145524104173/viz_ui.py index 31eecdc0b..8d50712e2 100644 --- a/dev/_downloads/b65e489e7aa31f9307df145524104173/viz_ui.py +++ b/dev/_downloads/b65e489e7aa31f9307df145524104173/viz_ui.py @@ -12,8 +12,7 @@ import numpy as np -from fury import actor, ui, window -from fury.data import fetch_viz_icons, read_viz_icons +import fury ############################################################################### # Shapes @@ -21,17 +20,19 @@ # # Let's start by drawing some simple shapes. First, a rectangle. -rect = ui.Rectangle2D(size=(200, 200), position=(400, 300), color=(1, 0, 1)) +rect = fury.ui.Rectangle2D(size=(200, 200), position=(400, 300), color=(1, 0, 1)) ############################################################################### # Then we can draw a solid circle, or disk. -disk = ui.Disk2D(outer_radius=50, center=(500, 500), color=(1, 1, 0)) +disk = fury.ui.Disk2D(outer_radius=50, center=(500, 500), color=(1, 1, 0)) ############################################################################### # Add an inner radius to make a ring. -ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 300), color=(0, 1, 1)) +ring = fury.ui.Disk2D( + outer_radius=50, inner_radius=45, center=(500, 300), color=(0, 1, 1) +) ############################################################################### # Image @@ -40,13 +41,13 @@ # Now let's display an image. First we need to fetch some icons that are # included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ############################################################################### # Now we can create an image container. -img = ui.ImageContainer2D( - img_path=read_viz_icons(fname="home3.png"), position=(450, 350) +img = fury.ui.ImageContainer2D( + img_path=fury.data.read_viz_icons(fname="home3.png"), position=(450, 350) ) ############################################################################### @@ -56,15 +57,15 @@ # 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 = fury.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 specify the position with integer numbers of pixels. -text = ui.TextBlock2D(text="Click me") -text2 = ui.TextBlock2D(text="Me too") +text = fury.ui.TextBlock2D(text="Click me") +text2 = fury.ui.TextBlock2D(text="Me too") panel.add_element(text, (50, 100)) panel.add_element(text2, (180, 100)) @@ -75,17 +76,17 @@ # percentages of the panel size. -button_example = ui.Button2D( - icon_fnames=[("square", read_viz_icons(fname="stop2.png"))] +button_example = fury.ui.Button2D( + icon_fnames=[("square", fury.data.read_viz_icons(fname="stop2.png"))] ) icon_files = [] -icon_files.append(("down", read_viz_icons(fname="circle-down.png"))) -icon_files.append(("left", read_viz_icons(fname="circle-left.png"))) -icon_files.append(("up", read_viz_icons(fname="circle-up.png"))) -icon_files.append(("right", read_viz_icons(fname="circle-right.png"))) +icon_files.append(("down", fury.data.read_viz_icons(fname="circle-down.png"))) +icon_files.append(("left", fury.data.read_viz_icons(fname="circle-left.png"))) +icon_files.append(("up", fury.data.read_viz_icons(fname="circle-up.png"))) +icon_files.append(("right", fury.data.read_viz_icons(fname="circle-right.png"))) -second_button_example = ui.Button2D(icon_fnames=icon_files) +second_button_example = fury.ui.Button2D(icon_fnames=icon_files) panel.add_element(button_example, (0.25, 0.33)) panel.add_element(second_button_example, (0.66, 0.33)) @@ -114,7 +115,7 @@ def change_icon_callback(i_ren, _obj, _button): # Let's add a cube to the scene and control it with sliders. -cube = actor.cube( +cube = fury.actor.cube( centers=np.array([[15, 0, 0]]), colors=np.array([[0, 0, 1]]), scales=np.array([[20, 20, 20]]), @@ -124,11 +125,11 @@ def change_icon_callback(i_ren, _obj, _button): ############################################################################### # Now we'll add three sliders: one circular and two linear. -ring_slider = ui.RingSlider2D( +ring_slider = fury.ui.RingSlider2D( center=(740, 400), initial_value=0, text_template="{angle:5.1f}°" ) -line_slider_x = ui.LineSlider2D( +line_slider_x = fury.ui.LineSlider2D( center=(500, 250), initial_value=0, min_value=-10, @@ -136,7 +137,7 @@ def change_icon_callback(i_ren, _obj, _button): orientation="horizontal", ) -line_slider_y = ui.LineSlider2D( +line_slider_y = fury.ui.LineSlider2D( center=(650, 350), initial_value=0, min_value=-10, @@ -187,7 +188,7 @@ def translate_cube_y(slider): # Finally, we can add a range slider. This element is composed of two sliders. # The first slider has two handles which let you set the range of the second. -range_slider_x = ui.RangeSlider( +range_slider_x = fury.ui.RangeSlider( line_width=8, handle_side=25, range_slider_center=(450, 450), @@ -201,7 +202,7 @@ def translate_cube_y(slider): shape="square", ) -range_slider_y = ui.RangeSlider( +range_slider_y = fury.ui.RangeSlider( line_width=8, handle_side=25, range_slider_center=(750, 400), @@ -263,7 +264,7 @@ def hide_all_examples(): ############################################################################### # Now we can create the menu. -listbox = ui.ListBox2D( +listbox = fury.ui.ListBox2D( values=values, position=(10, 300), size=(300, 200), multiselection=False ) @@ -291,7 +292,7 @@ def display_element(): # manager. current_size = (800, 800) -show_manager = window.ShowManager(size=current_size, title="FURY UI Example") +show_manager = fury.window.ShowManager(size=current_size, title="FURY UI Example") show_manager.scene.add(listbox) for example in examples: @@ -309,4 +310,4 @@ def display_element(): if interactive: show_manager.start() -window.record(show_manager.scene, size=current_size, out_path="viz_ui.png") +fury.window.record(show_manager.scene, size=current_size, out_path="viz_fury.ui.png") diff --git a/dev/_downloads/b990604c3b5a2778e66d16988eb16560/viz_wrecking_ball.py b/dev/_downloads/b990604c3b5a2778e66d16988eb16560/viz_wrecking_ball.py index 1e574ccc3..31e9587a3 100644 --- a/dev/_downloads/b990604c3b5a2778e66d16988eb16560/viz_wrecking_ball.py +++ b/dev/_downloads/b990604c3b5a2778e66d16988eb16560/viz_wrecking_ball.py @@ -15,7 +15,7 @@ import numpy as np import pybullet as p -from fury import actor, ui, utils, window +import fury ############################################################################### # Initiate pybullet and enable gravity. @@ -52,7 +52,7 @@ # Creating the base plane actor. # Base -base_actor = actor.box( +base_actor = fury.actor.box( centers=np.array([[0, 0, 0]]), directions=[0, 0, 0], scales=(5, 5, 0.2), @@ -108,7 +108,7 @@ p.changeDynamics(bricks[idx], -1, lateralFriction=0.1, restitution=0.1) idx += 1 -brick_actor = actor.box( +brick_actor = fury.actor.box( centers=brick_centers, directions=brick_directions, scales=brick_sizes, @@ -160,7 +160,7 @@ link_heights = np.zeros(n_links) link_heights[:] = dx_link -rope_actor = actor.cylinder( +rope_actor = fury.actor.cylinder( centers=linkPositions, directions=linkDirections, colors=np.random.rand(n_links, 3), @@ -213,14 +213,14 @@ rope, -1, -1, -1, p.JOINT_FIXED, [0, 0, 0], [0, 0, 0], [0, 0, 2] ) -box_actor = actor.box( +box_actor = fury.actor.box( centers=np.array([[0, 0, 0]]), directions=np.array([[0, 0, 0]]), scales=(0.02, 0.02, 0.02), colors=np.array([[1, 0, 0]]), ) -ball_actor = actor.sphere( +ball_actor = fury.actor.sphere( centers=np.array([[0, 0, 0]]), radii=ball_radius, colors=np.array([1, 0, 1]) ) @@ -228,12 +228,12 @@ # Now we add the necessary actors to the scene and set the camera for better # visualization. -scene = window.Scene() +scene = fury.window.Scene() scene.set_camera((10.28, -7.10, 6.39), (0.0, 0.0, 0.4), (-0.35, 0.26, 1.0)) -scene.add(actor.axes(scale=(0.5, 0.5, 0.5)), base_actor, brick_actor) +scene.add(fury.actor.axes(scale=(0.5, 0.5, 0.5)), base_actor, brick_actor) scene.add(rope_actor, box_actor, ball_actor) -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) @@ -247,7 +247,7 @@ ############################################################################### # Calculate the vertices of the bricks. -brick_vertices = utils.vertices_from_actor(brick_actor) +brick_vertices = fury.utils.vertices_from_actor(brick_actor) num_vertices = brick_vertices.shape[0] num_objects = brick_centers.shape[0] brick_sec = int(num_vertices / num_objects) @@ -255,7 +255,7 @@ ############################################################################### # Calculate the vertices of the wrecking ball. -chain_vertices = utils.vertices_from_actor(rope_actor) +chain_vertices = fury.utils.vertices_from_actor(rope_actor) num_vertices = chain_vertices.shape[0] num_objects = brick_centers.shape[0] chain_sec = int(num_vertices / num_objects) @@ -316,7 +316,7 @@ def sync_chain(actor_list, multibody): counter = itertools.count() fpss = np.array([]) -tb = ui.TextBlock2D( +tb = fury.ui.TextBlock2D( position=(0, 680), font_size=30, color=(1, 0.5, 0), text="Avg. FPS: \nSim Steps: " ) scene.add(tb) @@ -355,8 +355,8 @@ def timer_callback(_obj, _event): pos = p.getLinkState(rope, p.getNumJoints(rope) - 1)[4] ball_actor.SetPosition(*pos) sync_chain(rope_actor, rope) - utils.update_actor(brick_actor) - utils.update_actor(rope_actor) + fury.utils.update_actor(brick_actor) + fury.utils.update_actor(rope_actor) # Simulate a step. p.stepSimulation() @@ -375,4 +375,4 @@ def timer_callback(_obj, _event): if interactive: showm.start() -window.record(scene, size=(900, 768), out_path="viz_wrecking_ball.png") +fury.window.record(scene, size=(900, 768), out_path="viz_wrecking_ball.png") diff --git a/dev/_downloads/ba971dacdfcb1101c922af9e48afc4ab/viz_shader.zip b/dev/_downloads/ba971dacdfcb1101c922af9e48afc4ab/viz_shader.zip index 11020cc1c..4914a3abd 100644 Binary files a/dev/_downloads/ba971dacdfcb1101c922af9e48afc4ab/viz_shader.zip and b/dev/_downloads/ba971dacdfcb1101c922af9e48afc4ab/viz_shader.zip differ diff --git a/dev/_downloads/bd014674b55899498e6c47d54b8c1e50/viz_widget.py b/dev/_downloads/bd014674b55899498e6c47d54b8c1e50/viz_widget.py index 6768a843e..ee7b99da8 100644 --- a/dev/_downloads/bd014674b55899498e6c47d54b8c1e50/viz_widget.py +++ b/dev/_downloads/bd014674b55899498e6c47d54b8c1e50/viz_widget.py @@ -42,23 +42,22 @@ import numpy as np -from fury import actor, window -from fury.stream.widget import Widget +import fury interactive = False window_size = (720, 500) N = 4 centers = np.random.normal(size=(N, 3)) colors = np.random.uniform(0.1, 1.0, size=(N, 3)) -actors = actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors) -scene = window.Scene() +actors = fury.actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors) +scene = fury.window.Scene() scene.add(actors) -showm = window.ShowManager(scene, size=(window_size[0], window_size[1])) +showm = fury.window.ShowManager(scene, size=(window_size[0], window_size[1])) ########################################################################## # Create a stream widget -widget = Widget(showm, port=8000) +widget = fury.stream.Widget(showm, port=8000) # if you want to use webRTC, you can pass the argument to choose this encoding # which is a more robust option. @@ -86,4 +85,4 @@ async def main(): time.sleep(time_sleep) widget.stop() -window.record(showm.scene, size=window_size, out_path="viz_widget.png") +fury.window.record(showm.scene, size=window_size, out_path="viz_widget.png") diff --git a/dev/_downloads/bda8ef3a26a1a05148ae2a99f6db2ade/viz_radio_buttons.py b/dev/_downloads/bda8ef3a26a1a05148ae2a99f6db2ade/viz_radio_buttons.py index 71dd1c6fe..e10e5f376 100644 --- a/dev/_downloads/bda8ef3a26a1a05148ae2a99f6db2ade/viz_radio_buttons.py +++ b/dev/_downloads/bda8ef3a26a1a05148ae2a99f6db2ade/viz_radio_buttons.py @@ -11,13 +11,12 @@ import numpy as np -from fury import actor, ui, utils, window -from fury.data import fetch_viz_icons +import fury ############################################################################## # First we need to fetch some icons that are included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ######################################################################## # Sphere and Radio Buttons @@ -25,7 +24,7 @@ # # Add a Sphere to the scene. -sphere = actor.sphere( +sphere = fury.actor.sphere( centers=np.array([[50, 0, 0]]), colors=np.array([[0, 0, 1]]), radii=11.0, @@ -36,7 +35,7 @@ # Creating a dict of possible options and mapping it with their values. options = {"Blue": (0, 0, 255), "Red": (255, 0, 0), "Green": (0, 255, 0)} -color_toggler = ui.RadioButton( +color_toggler = fury.ui.RadioButton( list(options), checked_labels=["Blue"], padding=1, @@ -48,10 +47,10 @@ # A callback which will set the values for the box def toggle_color(radio): - vcolors = utils.colors_from_actor(sphere) + vcolors = fury.utils.colors_from_actor(sphere) color = options[radio.checked_labels[0]] vcolors[:] = np.array(color) - utils.update_actor(sphere) + fury.utils.update_actor(sphere) color_toggler.on_change = toggle_color @@ -65,7 +64,7 @@ def toggle_color(radio): # manager. current_size = (800, 800) -show_manager = window.ShowManager(size=current_size, title="FURY Sphere Example") +show_manager = fury.window.ShowManager(size=current_size, title="FURY Sphere Example") show_manager.scene.add(sphere) show_manager.scene.add(color_toggler) @@ -82,4 +81,6 @@ def toggle_color(radio): if interactive: show_manager.start() -window.record(show_manager.scene, size=current_size, out_path="viz_radio_buttons.png") +fury.window.record( + show_manager.scene, size=current_size, out_path="viz_radio_buttons.png" +) diff --git a/dev/_downloads/be1eb6133d637ba186789b6a23d43028/viz_morphing.zip b/dev/_downloads/be1eb6133d637ba186789b6a23d43028/viz_morphing.zip index 51a5fc64c..4ee83091a 100644 Binary files a/dev/_downloads/be1eb6133d637ba186789b6a23d43028/viz_morphing.zip and b/dev/_downloads/be1eb6133d637ba186789b6a23d43028/viz_morphing.zip differ diff --git a/dev/_downloads/bec5b25431c5031ca931dab4315e269b/viz_ball_collide.zip b/dev/_downloads/bec5b25431c5031ca931dab4315e269b/viz_ball_collide.zip index cb2d9b55f..97cc772cb 100644 Binary files a/dev/_downloads/bec5b25431c5031ca931dab4315e269b/viz_ball_collide.zip and b/dev/_downloads/bec5b25431c5031ca931dab4315e269b/viz_ball_collide.zip differ diff --git a/dev/_downloads/c03fedba7f4db7fae10985fef3f9aa8c/viz_domino.zip b/dev/_downloads/c03fedba7f4db7fae10985fef3f9aa8c/viz_domino.zip index 75b92ed2a..6cedd03b0 100644 Binary files a/dev/_downloads/c03fedba7f4db7fae10985fef3f9aa8c/viz_domino.zip and b/dev/_downloads/c03fedba7f4db7fae10985fef3f9aa8c/viz_domino.zip differ diff --git a/dev/_downloads/c073544028e092162082916bdc72e0f5/viz_custom_interpolator.zip b/dev/_downloads/c073544028e092162082916bdc72e0f5/viz_custom_interpolator.zip index 6a254d2c5..a5429575a 100644 Binary files a/dev/_downloads/c073544028e092162082916bdc72e0f5/viz_custom_interpolator.zip and b/dev/_downloads/c073544028e092162082916bdc72e0f5/viz_custom_interpolator.zip differ diff --git a/dev/_downloads/c2aaa3511941c3de8cde8d6048f25338/viz_gltf_export.ipynb b/dev/_downloads/c2aaa3511941c3de8cde8d6048f25338/viz_gltf_export.ipynb index d9546ec9b..fc36077ce 100644 --- a/dev/_downloads/c2aaa3511941c3de8cde8d6048f25338/viz_gltf_export.ipynb +++ b/dev/_downloads/c2aaa3511941c3de8cde8d6048f25338/viz_gltf_export.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, gltf, window\nfrom fury.data import fetch_gltf, read_viz_gltf" + "import numpy as np\n\nimport fury" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()" + "scene = fury.window.Scene()" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "cube = actor.cube(np.add(centers, np.array([2, 0, 0])), colors=colors / 2)\nscene.add(cube)\n\nsphere = actor.sphere(np.add(centers, np.array([0, 2, 0])), colors=colors)\nscene.add(sphere)\n\nfetch_gltf(\"BoxTextured\", \"glTF\")\nfilename = read_viz_gltf(\"BoxTextured\")\ngltf_obj = gltf.glTF(filename)\nbox_actor = gltf_obj.actors()\nscene.add(box_actor[0])" + "cube = fury.actor.cube(np.add(centers, np.array([2, 0, 0])), colors=colors / 2)\nscene.add(cube)\n\nsphere = fury.actor.sphere(np.add(centers, np.array([0, 2, 0])), colors=colors)\nscene.add(sphere)\n\nfury.data.fetch_gltf(\"BoxTextured\", \"glTF\")\nfilename = fury.data.read_viz_gltf(\"BoxTextured\")\ngltf_obj = fury.gltf.glTF(filename)\nbox_actor = gltf_obj.actors()\nscene.add(box_actor[0])" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "gltf.export_scene(scene, filename=\"viz_gltf_export.gltf\")" + "fury.gltf.export_scene(scene, filename=\"viz_gltf_export.gltf\")" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "gltf_obj = gltf.glTF(\"viz_gltf_export.gltf\")\nactors = gltf_obj.actors()" + "gltf_obj = fury.gltf.glTF(\"viz_gltf_export.gltf\")\nactors = gltf_obj.actors()" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "scene.add(*actors)\n\ninteractive = False\n\nif interactive:\n window.show(scene, size=(1280, 720))\n\nwindow.record(scene, out_path=\"viz_gltf_export.png\", size=(1280, 720))" + "scene.add(*actors)\n\ninteractive = False\n\nif interactive:\n fury.window.show(scene, size=(1280, 720))\n\nfury.window.record(scene, out_path=\"viz_gltf_export.png\", size=(1280, 720))" ] } ], diff --git a/dev/_downloads/c3c0c6bd615e44c636e67acbc672c964/viz_skinning.zip b/dev/_downloads/c3c0c6bd615e44c636e67acbc672c964/viz_skinning.zip index da23ee353..beb0f72ad 100644 Binary files a/dev/_downloads/c3c0c6bd615e44c636e67acbc672c964/viz_skinning.zip and b/dev/_downloads/c3c0c6bd615e44c636e67acbc672c964/viz_skinning.zip differ diff --git a/dev/_downloads/c539298c1966ce620bae10e2057d5ee7/viz_no_interaction.py b/dev/_downloads/c539298c1966ce620bae10e2057d5ee7/viz_no_interaction.py index d68b70076..1a968a5ef 100644 --- a/dev/_downloads/c539298c1966ce620bae10e2057d5ee7/viz_no_interaction.py +++ b/dev/_downloads/c539298c1966ce620bae10e2057d5ee7/viz_no_interaction.py @@ -12,10 +12,7 @@ # multiprocessing.set_start_method('spawn') import numpy as np -from fury import actor, colormap as cmap, window -from fury.data.fetcher import fetch_viz_wiki_nw -from fury.stream.client import FuryStreamClient -from fury.stream.server.main import web_server_raw_array +import fury if __name__ == "__main__": interactive = False @@ -24,7 +21,7 @@ window_size = (400, 400) - files, folder = fetch_viz_wiki_nw() + files, folder = fury.data.fetch_viz_wiki_nw() categories_file, edges_file, positions_file = sorted(files.keys()) positions = np.loadtxt(pjoin(folder, positions_file)) categories = np.loadtxt(pjoin(folder, categories_file), dtype=str) @@ -33,7 +30,9 @@ index2category = np.unique(categories) - categoryColors = cmap.distinguishable_colormap(nb_colors=len(index2category)) + categoryColors = fury.colormap.distinguishable_colormap( + nb_colors=len(index2category) + ) colors = np.array( [categoryColors[category2index[category]] for category in categories] @@ -49,19 +48,19 @@ edgesPositions = np.array(edgesPositions) edgesColors = np.average(np.array(edgesColors), axis=1) - sphere_actor = actor.sdf( + sphere_actor = fury.actor.sdf( centers=positions, colors=colors, primitives="sphere", scales=radii * 0.5, ) - lines_actor = actor.line( + lines_actor = fury.actor.line( edgesPositions, colors=edgesColors, opacity=0.1, ) - scene = window.Scene() + scene = fury.window.Scene() scene.add(lines_actor) scene.add(sphere_actor) @@ -70,7 +69,7 @@ position=(0, 0, 1000), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0) ) - showm = window.ShowManager( + showm = fury.window.ShowManager( scene, reset_camera=False, size=(window_size[0], window_size[1]), @@ -82,9 +81,9 @@ ms = 0 - stream = FuryStreamClient(showm, use_raw_array=True) + stream = fury.stream.FuryStreamClient(showm, use_raw_array=True) p = multiprocessing.Process( - target=web_server_raw_array, + target=fury.stream.server.web_server_raw_array, args=( stream.img_manager.image_buffers, stream.img_manager.info_buffer, @@ -100,4 +99,4 @@ stream.stop() stream.cleanup() - window.record(showm.scene, size=window_size, out_path="viz_no_interaction.png") + fury.window.record(showm.scene, size=window_size, out_path="viz_no_interaction.png") diff --git a/dev/_downloads/c5580fbbf92d43a5a1e9ea1d9fc0854d/viz_dt_ellipsoids.py b/dev/_downloads/c5580fbbf92d43a5a1e9ea1d9fc0854d/viz_dt_ellipsoids.py index f9e7ec5ab..4b2d37e02 100644 --- a/dev/_downloads/c5580fbbf92d43a5a1e9ea1d9fc0854d/viz_dt_ellipsoids.py +++ b/dev/_downloads/c5580fbbf92d43a5a1e9ea1d9fc0854d/viz_dt_ellipsoids.py @@ -16,28 +16,25 @@ from dipy.io.image import load_nifti import numpy as np -from fury import actor, ui, window -from fury.actor import _color_fa, _fa -from fury.data import fetch_viz_dmri, read_viz_dmri -from fury.primitive import prim_sphere +import fury ############################################################################### # Now, we fetch and load the data needed to display the Diffusion Tensor # Images. -fetch_viz_dmri() +fury.data.fetch_viz_dmri() ############################################################################### # The tensor ellipsoids are expressed as eigenvalues and eigenvectors which are # the decomposition of the diffusion tensor that describes the water diffusion # within a voxel. -slice_evecs, _ = load_nifti(read_viz_dmri("slice_evecs.nii.gz")) -slice_evals, _ = load_nifti(read_viz_dmri("slice_evals.nii.gz")) -roi_evecs, _ = load_nifti(read_viz_dmri("roi_evecs.nii.gz")) -roi_evals, _ = load_nifti(read_viz_dmri("roi_evals.nii.gz")) -whole_brain_evecs, _ = load_nifti(read_viz_dmri("whole_brain_evecs.nii.gz")) -whole_brain_evals, _ = load_nifti(read_viz_dmri("whole_brain_evals.nii.gz")) +slice_evecs, _ = load_nifti(fury.data.read_viz_dmri("slice_evecs.nii.gz")) +slice_evals, _ = load_nifti(fury.data.read_viz_dmri("slice_evals.nii.gz")) +roi_evecs, _ = load_nifti(fury.data.read_viz_dmri("roi_evecs.nii.gz")) +roi_evals, _ = load_nifti(fury.data.read_viz_dmri("roi_evals.nii.gz")) +whole_brain_evecs, _ = load_nifti(fury.data.read_viz_dmri("whole_brain_evecs.nii.gz")) +whole_brain_evals, _ = load_nifti(fury.data.read_viz_dmri("whole_brain_evals.nii.gz")) ############################################################################### # Using tensor_slicer actor @@ -49,7 +46,7 @@ # vertices that made up the sphere, which have a standard number of 100, 200, # and 724 vertices. -vertices, faces = prim_sphere("repulsion100", True) +vertices, faces = fury.prim_sphere("repulsion100", True) ############################################################################### @@ -70,7 +67,7 @@ def __init__(self, vertices, faces): # brain slice. We also define the scale so that the tensors are not so large # and overlap each other. -tensor_slice = actor.tensor_slicer( +tensor_slice = fury.actor.tensor_slicer( evals=slice_evals, evecs=slice_evecs, sphere=sphere100, scale=0.3 ) @@ -78,12 +75,12 @@ def __init__(self, vertices, faces): # Next, we set up a new scene to add and visualize the tensor ellipsoids # created. -scene = window.Scene() +scene = fury.window.Scene() scene.background([255, 255, 255]) scene.add(tensor_slice) # Create show manager -showm = window.ShowManager(scene, size=(600, 600)) +showm = fury.window.ShowManager(scene, size=(600, 600)) # Enables/disables interactive visualization interactive = False @@ -91,7 +88,7 @@ def __init__(self, vertices, faces): if interactive: showm.start() -window.record(showm.scene, size=(600, 600), out_path="tensor_slice_100.png") +fury.window.record(showm.scene, size=(600, 600), out_path="tensor_slice_100.png") ############################################################################### # If we zoom in at the scene to see with detail the tensor ellipsoids displayed @@ -99,14 +96,14 @@ def __init__(self, vertices, faces): scene.roll(10) scene.pitch(90) -showm = window.ShowManager(scene, size=(600, 600), order_transparent=True) +showm = fury.window.ShowManager(scene, size=(600, 600), order_transparent=True) showm.scene.zoom(50) if interactive: showm.render() showm.start() -window.record( +fury.window.record( showm.scene, out_path="tensor_slice_100_zoom.png", size=(600, 300), @@ -151,7 +148,7 @@ def get_params(evecs, evals): # coloring in tensor_slicer that is uses _color_fa that is a way to map # colors to each tensor based on the fractional anisotropy (FA) of each # diffusion tensor. - colors = _color_fa(_fa(fevals), fevecs) + colors = fury.actor._color_fa(fury.actor._fa(fevals), fevecs) return centers, fevecs, fevals, colors @@ -166,7 +163,7 @@ def get_params(evecs, evals): # Now, we can use the ``ellipsoid`` actor to create the tensor ellipsoids as # follows. -tensors = actor.ellipsoid( +tensors = fury.actor.ellipsoid( centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6 ) showm.scene.add(tensors) @@ -174,7 +171,7 @@ def get_params(evecs, evals): if interactive: showm.start() -window.record(scene, size=(600, 600), out_path="tensor_slice_sdf.png") +fury.window.record(scene, size=(600, 600), out_path="tensor_slice_sdf.png") ############################################################################### # Thus, one can see that the same result is obtained, however there is a @@ -185,14 +182,14 @@ def get_params(evecs, evals): scene.roll(10) scene.pitch(90) -showm = window.ShowManager(scene, size=(600, 600), order_transparent=True) +showm = fury.window.ShowManager(scene, size=(600, 600), order_transparent=True) showm.scene.zoom(50) if interactive: showm.render() showm.start() -window.record( +fury.window.record( showm.scene, out_path="tensor_slice_sdf_zoom.png", size=(600, 300), @@ -224,17 +221,23 @@ def get_params(evecs, evals): evals[..., :] = mevals evecs[..., :, :] = mevecs -vertices, faces = prim_sphere("repulsion200", True) +vertices, faces = fury.prim_sphere("repulsion200", True) sphere200 = Sphere(vertices, faces) -vertices, faces = prim_sphere("repulsion724", True) +vertices, faces = fury.prim_sphere("repulsion724", True) sphere724 = Sphere(vertices, faces) -tensor_100 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere100, scale=1.0) -tensor_200 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere200, scale=1.0) -tensor_724 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere724, scale=1.0) +tensor_100 = fury.actor.tensor_slicer( + evals=evals, evecs=evecs, sphere=sphere100, scale=1.0 +) +tensor_200 = fury.actor.tensor_slicer( + evals=evals, evecs=evecs, sphere=sphere200, scale=1.0 +) +tensor_724 = fury.actor.tensor_slicer( + evals=evals, evecs=evecs, sphere=sphere724, scale=1.0 +) centers, evecs, evals, colors = get_params(evecs=evecs, evals=evals) -tensor_sdf = actor.ellipsoid( +tensor_sdf = fury.actor.ellipsoid( centers=centers, axes=evecs, lengths=evals, colors=colors, scales=2.0 ) @@ -244,13 +247,13 @@ def get_params(evecs, evals): objects = [tensor_100, tensor_200, tensor_724, tensor_sdf] text = [ - actor.vector_text("Tensor 100"), - actor.vector_text("Tensor 200"), - actor.vector_text("Tensor 724"), - actor.vector_text("Tensor SDF"), + fury.actor.vector_text("Tensor 100"), + fury.actor.vector_text("Tensor 200"), + fury.actor.vector_text("Tensor 724"), + fury.actor.vector_text("Tensor SDF"), ] -grid_ui = ui.GridUI( +grid_ui = fury.ui.GridUI( actors=objects, captions=text, cell_padding=0.1, @@ -258,17 +261,17 @@ def get_params(evecs, evals): dim=(1, 4), ) -scene = window.Scene() +scene = fury.window.Scene() scene.background([255, 255, 255]) scene.zoom(3.5) scene.set_camera(position=(3.2, -20, 12), focal_point=(3.2, 0.0, 0.0)) -showm = window.ShowManager(scene, size=(560, 200)) +showm = fury.window.ShowManager(scene, size=(560, 200)) showm.scene.add(grid_ui) if interactive: showm.start() -window.record( +fury.window.record( showm.scene, size=(560, 200), out_path="tensor_comparison.png", @@ -285,7 +288,7 @@ def get_params(evecs, evals): # ``display_extent()``. Here we can see an example of a region of interest # (ROI) using a sphere of 100 vertices. -tensor_roi = actor.tensor_slicer( +tensor_roi = fury.actor.tensor_slicer( evals=roi_evals, evecs=roi_evecs, sphere=sphere100, scale=0.3 ) @@ -300,7 +303,7 @@ def get_params(evecs, evals): if interactive: showm.start() -window.record(showm.scene, size=(600, 600), out_path="tensor_roi_100.png") +fury.window.record(showm.scene, size=(600, 600), out_path="tensor_roi_100.png") showm.scene.clear() @@ -312,7 +315,7 @@ def get_params(evecs, evals): centers, evecs, evals, colors = get_params(roi_evecs, roi_evals) -tensors = actor.ellipsoid( +tensors = fury.actor.ellipsoid( centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6 ) showm.scene.add(tensors) @@ -320,7 +323,7 @@ def get_params(evecs, evals): if interactive: showm.start() -window.record(showm.scene, size=(600, 600), out_path="tensor_roi_sdf.png") +fury.window.record(showm.scene, size=(600, 600), out_path="tensor_roi_sdf.png") showm.scene.clear() @@ -338,19 +341,19 @@ def get_params(evecs, evals): evecs = np.array(list(itertools.compress(evecs, fil))) evals = np.array(list(itertools.compress(evals, fil))) -tensors = actor.ellipsoid( +tensors = fury.actor.ellipsoid( centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6 ) -scene = window.Scene() +scene = fury.window.Scene() scene.add(tensors) scene.pitch(180) -showm = window.ShowManager(scene, size=(600, 600)) +showm = fury.window.ShowManager(scene, size=(600, 600)) if interactive: showm.start() -window.record( +fury.window.record( showm.scene, size=(600, 600), reset_camera=False, diff --git a/dev/_downloads/c703506e1bad097af06c1528197fdb2d/viz_tesseract.zip b/dev/_downloads/c703506e1bad097af06c1528197fdb2d/viz_tesseract.zip index 618da2804..2d31e8a32 100644 Binary files a/dev/_downloads/c703506e1bad097af06c1528197fdb2d/viz_tesseract.zip and b/dev/_downloads/c703506e1bad097af06c1528197fdb2d/viz_tesseract.zip differ diff --git a/dev/_downloads/c825ae147a5ad6b73c459b53773372f1/viz_network.py b/dev/_downloads/c825ae147a5ad6b73c459b53773372f1/viz_network.py index 13140a96f..c6189fb67 100644 --- a/dev/_downloads/c825ae147a5ad6b73c459b53773372f1/viz_network.py +++ b/dev/_downloads/c825ae147a5ad6b73c459b53773372f1/viz_network.py @@ -15,14 +15,12 @@ import numpy as np -from fury import actor, colormap as cmap, window -from fury.data import fetch_viz_wiki_nw +import fury ############################################################################### # Then let's download some available datasets. - -files, folder = fetch_viz_wiki_nw() +files, folder = fury.data.fetch_viz_wiki_nw() categories_file, edges_file, positions_file = sorted(files.keys()) ############################################################################### @@ -40,7 +38,7 @@ index2category = np.unique(categories) -categoryColors = cmap.distinguishable_colormap(nb_colors=len(index2category)) +categoryColors = fury.colormap.distinguishable_colormap(nb_colors=len(index2category)) colors = np.array([categoryColors[category2index[category]] for category in categories]) @@ -68,7 +66,7 @@ # build 2 actors that we represent our data : sphere_actor for the nodes and # lines_actor for the edges. -sphere_actor = actor.sphere( +sphere_actor = fury.actor.sphere( centers=positions, colors=colors, radii=radii * 0.5, @@ -76,7 +74,7 @@ phi=8, ) -lines_actor = actor.line( +lines_actor = fury.actor.line( edgesPositions, colors=edgesColors, opacity=0.1, @@ -86,7 +84,7 @@ # All actors need to be added in a scene, so we build one and add our # lines_actor and sphere_actor. -scene = window.Scene() +scene = fury.window.Scene() scene.add(lines_actor) scene.add(sphere_actor) @@ -98,9 +96,9 @@ interactive = False if interactive: - window.show(scene, size=(600, 600)) + fury.window.show(scene, size=(600, 600)) -window.record(scene, out_path="journal_networks.png", size=(600, 600)) +fury.window.record(scene, out_path="journal_networks.png", size=(600, 600)) ############################################################################### # This example can be improved by adding some interactivy with slider, diff --git a/dev/_downloads/c894f5ee1c5a9cf8916ac6e5321b055e/viz_helical_motion.zip b/dev/_downloads/c894f5ee1c5a9cf8916ac6e5321b055e/viz_helical_motion.zip index ef6c64d46..eabfb792a 100644 Binary files a/dev/_downloads/c894f5ee1c5a9cf8916ac6e5321b055e/viz_helical_motion.zip and b/dev/_downloads/c894f5ee1c5a9cf8916ac6e5321b055e/viz_helical_motion.zip differ diff --git a/dev/_downloads/ca23d044295b307e6e55c0617576e486/viz_picking.py b/dev/_downloads/ca23d044295b307e6e55c0617576e486/viz_picking.py index 772ca79d5..954cc9d5a 100644 --- a/dev/_downloads/ca23d044295b307e6e55c0617576e486/viz_picking.py +++ b/dev/_downloads/ca23d044295b307e6e55c0617576e486/viz_picking.py @@ -13,7 +13,7 @@ import numpy as np -from fury import actor, pick, ui, utils, window +import fury centers = 0.5 * np.array([[0, 0, 0], [100, 0, 0], [200, 0, 0.0]]) colors = np.array([[0.8, 0, 0], [0, 0.8, 0], [0, 0, 0.8]]) @@ -24,18 +24,18 @@ ############################################################################### # Let's create a panel to show what is picked -panel = ui.Panel2D(size=(400, 200), color=(1, 0.5, 0.0), align="right") +panel = fury.ui.Panel2D(size=(400, 200), color=(1, 0.5, 0.0), align="right") panel.center = (150, 200) -text_block = ui.TextBlock2D(text="Left click on object \n") +text_block = fury.ui.TextBlock2D(text="Left click on object \n") panel.add_element(text_block, (0.3, 0.3)) ############################################################################### # Build scene and add an actor with many objects. -scene = window.Scene() +scene = fury.window.Scene() -label_actor = actor.vector_text(text="Test") +label_actor = fury.actor.vector_text(text="Test") ############################################################################### # This actor is made with 3 cubes of different orientation @@ -47,23 +47,23 @@ [0, np.sqrt(2) / 2, np.sqrt(2) / 2], ] ) -fury_actor = actor.cube(centers, directions, colors, scales=radii) +fury_actor = fury.actor.cube(centers, directions, colors, scales=radii) ############################################################################### # Access the memory of the vertices of all the cubes -vertices = utils.vertices_from_actor(fury_actor) +vertices = fury.utils.vertices_from_actor(fury_actor) num_vertices = vertices.shape[0] num_objects = centers.shape[0] ############################################################################### # Access the memory of the colors of all the cubes -vcolors = utils.colors_from_actor(fury_actor, "colors") +vcolors = fury.utils.colors_from_actor(fury_actor, "colors") ############################################################################### # Adding an actor showing the axes of the world coordinates -ax = actor.axes(scale=(10, 10, 10)) +ax = fury.actor.axes(scale=(10, 10, 10)) scene.add(fury_actor) scene.add(label_actor) @@ -73,7 +73,7 @@ ############################################################################### # Create the Picking manager -pickm = pick.PickingManager() +pickm = fury.pick.PickingManager() ############################################################################### # Time to make the callback which will be called when we pick an object @@ -117,7 +117,7 @@ def left_click_callback(obj, event): vcolors[object_index * sec : object_index * sec + sec] += color_add # Tell actor that memory is modified - utils.update_actor(fury_actor) + fury.utils.update_actor(fury_actor) face_index = picked_info["face"] @@ -139,7 +139,7 @@ def left_click_callback(obj, event): ############################################################################### # Make the window appear -showm = window.ShowManager(scene, size=(1024, 768), order_transparent=True) +showm = fury.window.ShowManager(scene, size=(1024, 768), order_transparent=True) scene.add(panel) @@ -155,4 +155,4 @@ def left_click_callback(obj, event): ############################################################################### # Save the current framebuffer in a PNG file -window.record(showm.scene, size=(1024, 768), out_path="viz_picking.png") +fury.window.record(showm.scene, size=(1024, 768), out_path="viz_picking.png") diff --git a/dev/_downloads/caf4c43950f532b475434f7bc65da7ef/viz_drawpanel.py b/dev/_downloads/caf4c43950f532b475434f7bc65da7ef/viz_drawpanel.py index 6b5295ebe..3a0fe1d76 100644 --- a/dev/_downloads/caf4c43950f532b475434f7bc65da7ef/viz_drawpanel.py +++ b/dev/_downloads/caf4c43950f532b475434f7bc65da7ef/viz_drawpanel.py @@ -9,18 +9,17 @@ First, some imports. """ -from fury import ui, window -from fury.data import fetch_viz_new_icons +import fury ############################################################################## # First we need to fetch some icons that are needed for DrawPanel. -fetch_viz_new_icons() +fury.data.fetch_viz_new_icons() ######################################################################### # We then create a DrawPanel Object. -drawing_canvas = ui.DrawPanel(size=(560, 560), position=(40, 10)) +drawing_canvas = fury.ui.DrawPanel(size=(560, 560), position=(40, 10)) ############################################################################### # Show Manager @@ -29,7 +28,7 @@ # Now we add DrawPanel to the scene. current_size = (650, 650) -showm = window.ShowManager(size=current_size, title="DrawPanel UI Example") +showm = fury.window.ShowManager(size=current_size, title="DrawPanel UI Example") showm.scene.add(drawing_canvas) @@ -43,4 +42,4 @@ drawing_canvas.draw_shape(shape_type="circle", current_position=(275, 275)) drawing_canvas.shape_list[-1].resize((50, 50)) - window.record(showm.scene, size=current_size, out_path="viz_drawpanel.png") + fury.window.record(showm.scene, size=current_size, out_path="viz_drawpanel.png") diff --git a/dev/_downloads/cb4177d4bb01d8f67c38945d666f7fff/viz_solar_system.zip b/dev/_downloads/cb4177d4bb01d8f67c38945d666f7fff/viz_solar_system.zip index 954ccb1ed..786c7f4ff 100644 Binary files a/dev/_downloads/cb4177d4bb01d8f67c38945d666f7fff/viz_solar_system.zip and b/dev/_downloads/cb4177d4bb01d8f67c38945d666f7fff/viz_solar_system.zip differ diff --git a/dev/_downloads/cb7379ccde41afc5022ffdb11d613265/viz_spinbox.py b/dev/_downloads/cb7379ccde41afc5022ffdb11d613265/viz_spinbox.py index 1fbe02f97..d7b9fdfae 100644 --- a/dev/_downloads/cb7379ccde41afc5022ffdb11d613265/viz_spinbox.py +++ b/dev/_downloads/cb7379ccde41afc5022ffdb11d613265/viz_spinbox.py @@ -12,18 +12,17 @@ import numpy as np -from fury import actor, ui, utils, window -from fury.data import fetch_viz_icons +import fury ############################################################################## # First we need to fetch some icons that are included in FURY. -fetch_viz_icons() +fury.data.fetch_viz_icons() ############################################################################### # Let's create a Cone. -cone = actor.cone( +cone = fury.actor.cone( centers=np.random.rand(1, 3), directions=np.random.rand(1, 3), colors=(1, 1, 1), @@ -33,7 +32,7 @@ ############################################################################### # Creating the SpinBox UI. -spinbox = ui.SpinBox( +spinbox = fury.ui.SpinBox( position=(200, 100), size=(300, 100), min_val=0, @@ -47,7 +46,7 @@ # manager. current_size = (800, 800) -show_manager = window.ShowManager(size=current_size, title="FURY SpinBox Example") +show_manager = fury.window.ShowManager(size=current_size, title="FURY SpinBox Example") show_manager.scene.add(cone) show_manager.scene.add(spinbox) @@ -62,7 +61,7 @@ def rotate_cone(spinbox): global previous_value change_in_value = spinbox.value - previous_value - utils.rotate(cone, (change_in_value, 1, 0, 0)) + fury.utils.rotate(cone, (change_in_value, 1, 0, 0)) previous_value = spinbox.value @@ -76,4 +75,4 @@ def rotate_cone(spinbox): if interactive: show_manager.start() -window.record(show_manager.scene, size=current_size, out_path="viz_spinbox.png") +fury.window.record(show_manager.scene, size=current_size, out_path="viz_spinbox.png") diff --git a/dev/_downloads/cf61fbca4b19e13a2ec8a90db4c715c4/viz_sdfactor.zip b/dev/_downloads/cf61fbca4b19e13a2ec8a90db4c715c4/viz_sdfactor.zip index ffc8b3024..2951afe27 100644 Binary files a/dev/_downloads/cf61fbca4b19e13a2ec8a90db4c715c4/viz_sdfactor.zip and b/dev/_downloads/cf61fbca4b19e13a2ec8a90db4c715c4/viz_sdfactor.zip differ diff --git a/dev/_downloads/cfcb5d4d39a58e85f65d2637f4f0909b/viz_timers.ipynb b/dev/_downloads/cfcb5d4d39a58e85f65d2637f4f0909b/viz_timers.ipynb index f876e23a3..181a5f5d5 100644 --- a/dev/_downloads/cfcb5d4d39a58e85f65d2637f4f0909b/viz_timers.ipynb +++ b/dev/_downloads/cfcb5d4d39a58e85f65d2637f4f0909b/viz_timers.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\n\nfrom fury import actor, ui, window\n\nxyz = 10 * np.random.rand(100, 3)\ncolors = np.random.rand(100, 4)\nradii = np.random.rand(100) + 0.5\n\nscene = window.Scene()\n\nsphere_actor = actor.sphere(centers=xyz, colors=colors, radii=radii)\n\nscene.add(sphere_actor)\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n\ntb = ui.TextBlock2D(bold=True)\n\n# use itertools to avoid global variables\ncounter = itertools.count()\n\n\ndef timer_callback(_obj, _event):\n global timer_id\n cnt = next(counter)\n tb.message = \"Let's count up to 300 and exit :\" + str(cnt)\n showm.scene.azimuth(0.05 * cnt)\n sphere_actor.GetProperty().SetOpacity(cnt / 100.0)\n showm.render()\n\n if cnt == 10:\n # destroy the first timer and replace it with another faster timer\n showm.destroy_timer(timer_id)\n timer_id = showm.add_timer_callback(True, 10, timer_callback)\n\n if cnt == 300:\n # destroy the second timer and exit\n showm.destroy_timer(timer_id)\n showm.exit()\n\n\nscene.add(tb)\n\n# Run every 200 milliseconds\ntimer_id = showm.add_timer_callback(True, 200, timer_callback)\n\nshowm.start()\n\nwindow.record(showm.scene, size=(900, 768), out_path=\"viz_timer.png\")" + "import itertools\n\nimport numpy as np\n\nimport fury\n\nxyz = 10 * np.random.rand(100, 3)\ncolors = np.random.rand(100, 4)\nradii = np.random.rand(100) + 0.5\n\nscene = fury.window.Scene()\n\nsphere_actor = fury.actor.sphere(centers=xyz, colors=colors, radii=radii)\n\nscene.add(sphere_actor)\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n\ntb = fury.ui.TextBlock2D(bold=True)\n\n# use itertools to avoid global variables\ncounter = itertools.count()\n\n\ndef timer_callback(_obj, _event):\n global timer_id\n cnt = next(counter)\n tb.message = \"Let's count up to 300 and exit :\" + str(cnt)\n showm.scene.azimuth(0.05 * cnt)\n sphere_actor.GetProperty().SetOpacity(cnt / 100.0)\n showm.render()\n\n if cnt == 10:\n # destroy the first timer and replace it with another faster timer\n showm.destroy_timer(timer_id)\n timer_id = showm.add_timer_callback(True, 10, timer_callback)\n\n if cnt == 300:\n # destroy the second timer and exit\n showm.destroy_timer(timer_id)\n showm.exit()\n\n\nscene.add(tb)\n\n# Run every 200 milliseconds\ntimer_id = showm.add_timer_callback(True, 200, timer_callback)\n\nshowm.start()\n\nfury.window.record(showm.scene, size=(900, 768), out_path=\"viz_timer.png\")" ] } ], diff --git a/dev/_downloads/d0fe92f1570268989d4b00931b6d390c/viz_using_time_equations.py b/dev/_downloads/d0fe92f1570268989d4b00931b6d390c/viz_using_time_equations.py index baf680b2c..a4ae678fd 100644 --- a/dev/_downloads/d0fe92f1570268989d4b00931b6d390c/viz_using_time_equations.py +++ b/dev/_downloads/d0fe92f1570268989d4b00931b6d390c/viz_using_time_equations.py @@ -8,21 +8,20 @@ import numpy as np -from fury import actor, window -from fury.animation import Animation +import fury -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) -cube = actor.cube(np.array([[0, 0, 0]]), (0, 0, 0), (1, 0, 1), scales=6) +cube = fury.actor.cube(np.array([[0, 0, 0]]), (0, 0, 0), (1, 0, 1), scales=6) ############################################################################### # Creating an ``Animation`` to animate the actor and show its motion path. -anim = Animation(length=2 * np.pi, loop=True, motion_path_res=200) +anim = fury.animation.Animation(length=2 * np.pi, loop=True, motion_path_res=200) ############################################################################### # Adding the sphere actor to the timeline @@ -77,4 +76,6 @@ def scale_eval(t): if interactive: showm.start() -window.record(scene, out_path="viz_keyframe_animation_evaluators.png", size=(900, 768)) +fury.window.record( + scene, out_path="viz_keyframe_animation_evaluators.png", size=(900, 768) +) diff --git a/dev/_downloads/d18e69af9880ae2cf3636fac156c00dc/viz_morphing.ipynb b/dev/_downloads/d18e69af9880ae2cf3636fac156c00dc/viz_morphing.ipynb index 406319da8..4a400542d 100644 --- a/dev/_downloads/d18e69af9880ae2cf3636fac156c00dc/viz_morphing.ipynb +++ b/dev/_downloads/d18e69af9880ae2cf3636fac156c00dc/viz_morphing.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import window\nfrom fury.data import fetch_gltf, read_viz_gltf\nfrom fury.gltf import glTF" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_gltf(\"MorphStressTest\", \"glTF\")\nfilename = read_viz_gltf(\"MorphStressTest\")" + "fury.data.fetch_gltf(\"MorphStressTest\", \"glTF\")\nfilename = fury.data.read_viz_gltf(\"MorphStressTest\")" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "gltf_obj = glTF(filename, apply_normals=True)" + "gltf_obj = fury.gltf.glTF(filename, apply_normals=True)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=True, order_transparent=True\n)\n\nshowm.initialize()\nscene.add(animation)" + "scene = fury.window.Scene()\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=True, order_transparent=True\n)\n\nshowm.initialize()\nscene.add(animation)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "showm.add_timer_callback(True, 20, timer_callback)\nscene.reset_camera()\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_morphing.png\", size=(900, 768))" + "showm.add_timer_callback(True, 20, timer_callback)\nscene.reset_camera()\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_morphing.png\", size=(900, 768))" ] } ], diff --git a/dev/_downloads/d2b29025cdc7613168dc91a0ac9bbc1f/viz_play_video.zip b/dev/_downloads/d2b29025cdc7613168dc91a0ac9bbc1f/viz_play_video.zip index 7a050cecb..a63ed4370 100644 Binary files a/dev/_downloads/d2b29025cdc7613168dc91a0ac9bbc1f/viz_play_video.zip and b/dev/_downloads/d2b29025cdc7613168dc91a0ac9bbc1f/viz_play_video.zip differ diff --git a/dev/_downloads/d382633f4061b2697f332de205293aab/viz_hierarchical_animation.py b/dev/_downloads/d382633f4061b2697f332de205293aab/viz_hierarchical_animation.py index 8b727e708..5e0772493 100644 --- a/dev/_downloads/d382633f4061b2697f332de205293aab/viz_hierarchical_animation.py +++ b/dev/_downloads/d382633f4061b2697f332de205293aab/viz_hierarchical_animation.py @@ -8,26 +8,25 @@ import numpy as np -from fury import actor, window -from fury.animation import Animation +import fury -scene = window.Scene() +scene = fury.window.Scene() -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) showm.initialize() ############################################################################### # Creating the road -road = actor.box( +road = fury.actor.box( np.array([[0, 0, 0]]), colors=np.array([[1, 1, 1]]), scales=np.array([[22, 0.1, 5]]) ) ############################################################################### # Constructing the car geometry -body_actor = actor.box( +body_actor = fury.actor.box( np.array([[0, 0.5, 0], [-0.2, 1, 0]]), scales=((4, 1, 2), (2.5, 1.5, 1.8)), colors=(0.6, 0.3, 0.1), @@ -35,7 +34,7 @@ ############################################################################### # Adding the the car's body to an Animation to be able to animate it later. -car_anim = Animation(body_actor) +car_anim = fury.animation.Animation(body_actor) ############################################################################### # Creating the wheels of the car @@ -50,7 +49,7 @@ ] wheels = [ - actor.cylinder( + fury.actor.cylinder( wheel_center, wheel_direction, (0.1, 0.7, 0.3), @@ -66,7 +65,7 @@ # Animating each wheel and setting its position to the right position using a # single keyframe that will not change. -wheels_animations = [Animation(wheel) for wheel in wheels] +wheels_animations = [fury.animation.Animation(wheel) for wheel in wheels] for wheel_anim in wheels_animations: wheel_anim.set_position(0.0, wheel_positions.pop()) @@ -78,13 +77,13 @@ ############################################################################### # First we create the shaft holding and rotating the radar -radar_shaft = actor.cylinder( +radar_shaft = fury.actor.cylinder( np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), (0, 1, 0), heights=1 ) ############################################################################### # In order to animate the shaft actor we have to add it to an Animation -radar_shaft_anim = Animation(radar_shaft) +radar_shaft_anim = fury.animation.Animation(radar_shaft) ############################################################################### # Setting a single position keyframe will make sure the actor will be placed at @@ -99,11 +98,13 @@ ############################################################################### # Now we create the radar itself -radar = actor.cone(np.array([[0, 0, 0]]), directions=(0, 0, 0), colors=(0.2, 0.2, 0.9)) +radar = fury.actor.cone( + np.array([[0, 0, 0]]), directions=(0, 0, 0), colors=(0.2, 0.2, 0.9) +) ############################################################################### # Then add it to an animation in order to rotate it -radar_animation = Animation(radar) +radar_animation = fury.animation.Animation(radar) ############################################################################### # Set position and rotation as done above with the shaft. @@ -140,6 +141,6 @@ if interactive: showm.start() -window.record( +fury.window.record( scene, out_path="viz_keyframe_hierarchical_animation.png", size=(900, 768) ) diff --git a/dev/_downloads/d677ef2ce68ed65330a28804ebc75fd5/viz_card.zip b/dev/_downloads/d677ef2ce68ed65330a28804ebc75fd5/viz_card.zip index b338449b6..2594050c9 100644 Binary files a/dev/_downloads/d677ef2ce68ed65330a28804ebc75fd5/viz_card.zip and b/dev/_downloads/d677ef2ce68ed65330a28804ebc75fd5/viz_card.zip differ diff --git a/dev/_downloads/d6a9b61de8ef9d7ffa01717b4aeb804b/viz_markers.zip b/dev/_downloads/d6a9b61de8ef9d7ffa01717b4aeb804b/viz_markers.zip index a7cad4c81..44a72b58d 100644 Binary files a/dev/_downloads/d6a9b61de8ef9d7ffa01717b4aeb804b/viz_markers.zip and b/dev/_downloads/d6a9b61de8ef9d7ffa01717b4aeb804b/viz_markers.zip differ diff --git a/dev/_downloads/d6d579ab803716bc90cc4d828c04793e/viz_chain.zip b/dev/_downloads/d6d579ab803716bc90cc4d828c04793e/viz_chain.zip index 4d52c53fb..9820ccb93 100644 Binary files a/dev/_downloads/d6d579ab803716bc90cc4d828c04793e/viz_chain.zip and b/dev/_downloads/d6d579ab803716bc90cc4d828c04793e/viz_chain.zip differ diff --git a/dev/_downloads/d76da8f3e26537c0ef63589ec7058bc2/viz_spinbox.ipynb b/dev/_downloads/d76da8f3e26537c0ef63589ec7058bc2/viz_spinbox.ipynb index e3db47f76..5cc5c79f4 100644 --- a/dev/_downloads/d76da8f3e26537c0ef63589ec7058bc2/viz_spinbox.ipynb +++ b/dev/_downloads/d76da8f3e26537c0ef63589ec7058bc2/viz_spinbox.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, ui, utils, window\nfrom fury.data import fetch_viz_icons" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "cone = actor.cone(\n centers=np.random.rand(1, 3),\n directions=np.random.rand(1, 3),\n colors=(1, 1, 1),\n heights=np.random.rand(1),\n)" + "cone = fury.actor.cone(\n centers=np.random.rand(1, 3),\n directions=np.random.rand(1, 3),\n colors=(1, 1, 1),\n heights=np.random.rand(1),\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "spinbox = ui.SpinBox(\n position=(200, 100),\n size=(300, 100),\n min_val=0,\n max_val=360,\n initial_val=180,\n step=10,\n)" + "spinbox = fury.ui.SpinBox(\n position=(200, 100),\n size=(300, 100),\n min_val=0,\n max_val=360,\n initial_val=180,\n step=10,\n)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "current_size = (800, 800)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY SpinBox Example\")\n\nshow_manager.scene.add(cone)\nshow_manager.scene.add(spinbox)" + "current_size = (800, 800)\nshow_manager = fury.window.ShowManager(size=current_size, title=\"FURY SpinBox Example\")\n\nshow_manager.scene.add(cone)\nshow_manager.scene.add(spinbox)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "# Tracking previous value to check in/decrement.\nprevious_value = spinbox.value\n\n\ndef rotate_cone(spinbox):\n global previous_value\n change_in_value = spinbox.value - previous_value\n utils.rotate(cone, (change_in_value, 1, 0, 0))\n previous_value = spinbox.value\n\n\nspinbox.on_change = rotate_cone" + "# Tracking previous value to check in/decrement.\nprevious_value = spinbox.value\n\n\ndef rotate_cone(spinbox):\n global previous_value\n change_in_value = spinbox.value - previous_value\n fury.utils.rotate(cone, (change_in_value, 1, 0, 0))\n previous_value = spinbox.value\n\n\nspinbox.on_change = rotate_cone" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "interactive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, size=current_size, out_path=\"viz_spinbox.png\")" + "interactive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(show_manager.scene, size=current_size, out_path=\"viz_spinbox.png\")" ] } ], diff --git a/dev/_downloads/db8ea9730d7543ee2928686a3bce6b6a/viz_markers.py b/dev/_downloads/db8ea9730d7543ee2928686a3bce6b6a/viz_markers.py index 600296c2d..5a532598d 100644 --- a/dev/_downloads/db8ea9730d7543ee2928686a3bce6b6a/viz_markers.py +++ b/dev/_downloads/db8ea9730d7543ee2928686a3bce6b6a/viz_markers.py @@ -8,7 +8,7 @@ import numpy as np -from fury import actor, window +import fury n = 10000 @@ -26,7 +26,7 @@ ############################################################################ # You can control the edge color and edge width for each marker -nodes_actor = actor.markers( +nodes_actor = fury.actor.markers( centers, marker=markers, edge_width=0.1, @@ -38,14 +38,14 @@ ############################################################################ # In addition, an 3D sphere it's also a valid type of marker -nodes_3d_actor = actor.markers( +nodes_3d_actor = fury.actor.markers( centers + np.ones_like(centers) * 25, marker="3d", colors=colors, scales=0.5, ) -scene = window.Scene() +scene = fury.window.Scene() scene.add(nodes_actor) scene.add(nodes_3d_actor) @@ -53,6 +53,6 @@ interactive = False if interactive: - window.show(scene, size=(600, 600)) + fury.window.show(scene, size=(600, 600)) -window.record(scene, out_path="viz_markers.png", size=(600, 600)) +fury.window.record(scene, out_path="viz_markers.png", size=(600, 600)) diff --git a/dev/_downloads/e01488f2eb40ea48f5a103fea6e1e4e8/viz_gltf_export.zip b/dev/_downloads/e01488f2eb40ea48f5a103fea6e1e4e8/viz_gltf_export.zip index 1432ee91d..5aa8faf43 100644 Binary files a/dev/_downloads/e01488f2eb40ea48f5a103fea6e1e4e8/viz_gltf_export.zip and b/dev/_downloads/e01488f2eb40ea48f5a103fea6e1e4e8/viz_gltf_export.zip differ diff --git a/dev/_downloads/e1e6c372eb29cd003ddeed8cbb6a2f43/viz_robot_arm_animation.ipynb b/dev/_downloads/e1e6c372eb29cd003ddeed8cbb6a2f43/viz_robot_arm_animation.ipynb index 3101fa0d5..cdc63c66b 100644 --- a/dev/_downloads/e1e6c372eb29cd003ddeed8cbb6a2f43/viz_robot_arm_animation.ipynb +++ b/dev/_downloads/e1e6c372eb29cd003ddeed8cbb6a2f43/viz_robot_arm_animation.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window\nfrom fury.animation import Animation, Timeline\nfrom fury.utils import set_actor_origin\n\nscene = window.Scene()\n\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nshowm.initialize()" + "import numpy as np\n\nimport fury\n\nscene = fury.window.Scene()\n\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\nshowm.initialize()" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "base = actor.cylinder(\n np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), colors=(0, 1, 0), radius=1\n)\nmain_arm = actor.box(np.array([[0, 0, 0]]), colors=(1, 0.5, 0), scales=(12, 1, 1))\n\nsub_arm = actor.box(np.array([[0, 0, 0]]), colors=(0, 0.5, 0.8), scales=(8, 0.7, 0.7))\njoint_1 = actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]), radii=1.2)\njoint_2 = actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]))\n\nend = actor.cone(\n np.array([[0, 0, 0]]),\n np.array([[1, 0, 0]]),\n np.array([[1, 0, 0]]),\n heights=2.2,\n resolution=6,\n)" + "base = fury.actor.cylinder(\n np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), colors=(0, 1, 0), radius=1\n)\nmain_arm = fury.actor.box(np.array([[0, 0, 0]]), colors=(1, 0.5, 0), scales=(12, 1, 1))\n\nsub_arm = fury.actor.box(\n np.array([[0, 0, 0]]), colors=(0, 0.5, 0.8), scales=(8, 0.7, 0.7)\n)\njoint_1 = fury.actor.sphere(\n np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]), radii=1.2\n)\njoint_2 = fury.actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]))\n\nend = fury.actor.cone(\n np.array([[0, 0, 0]]),\n np.array([[1, 0, 0]]),\n np.array([[1, 0, 0]]),\n heights=2.2,\n resolution=6,\n)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "set_actor_origin(main_arm, np.array([-6, 0, 0]))\nset_actor_origin(sub_arm, np.array([-4, 0, 0]))" + "fury.utils.set_actor_origin(main_arm, np.array([-6, 0, 0]))\nfury.utils.set_actor_origin(sub_arm, np.array([-4, 0, 0]))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "timeline = Timeline(playback_panel=True)" + "timeline = fury.animation.Timeline(playback_panel=True)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "main_arm_animation = Animation([main_arm, joint_1], length=2 * np.pi)\nchild_arm_animation = Animation([sub_arm, joint_2])\ndrill_animation = Animation(end)" + "main_arm_animation = fury.animation.Animation([main_arm, joint_1], length=2 * np.pi)\nchild_arm_animation = fury.animation.Animation([sub_arm, joint_2])\ndrill_animation = fury.animation.Animation(end)" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "showm.add_animation(timeline)\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_robot_arm.png\", size=(900, 768))" + "showm.add_animation(timeline)\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_robot_arm.png\", size=(900, 768))" ] } ], diff --git a/dev/_downloads/e1e95fd074de6c909319935378baea6e/viz_sdf_cylinder.py b/dev/_downloads/e1e95fd074de6c909319935378baea6e/viz_sdf_cylinder.py index bebeb4f30..30cfa00db 100644 --- a/dev/_downloads/e1e95fd074de6c909319935378baea6e/viz_sdf_cylinder.py +++ b/dev/_downloads/e1e95fd074de6c909319935378baea6e/viz_sdf_cylinder.py @@ -19,13 +19,7 @@ import numpy as np -from fury import actor, window -from fury.shaders import ( - attribute_to_actor, - compose_shader, - import_fury_shader, - shader_to_actor, -) +import fury ############################################################################### # Cylinder using polygons @@ -87,7 +81,7 @@ # of sides used to define the bases of the cylinder) to see how it changes the # surface of the primitive. -cylinders_8 = actor.cylinder( +cylinders_8 = fury.actor.cylinder( centers[:3], dirs[:3], colors[:3], @@ -96,7 +90,7 @@ capped=True, resolution=8, ) -cylinders_16 = actor.cylinder( +cylinders_16 = fury.actor.cylinder( centers[3:6], dirs[3:6], colors[3:6], @@ -105,7 +99,7 @@ capped=True, resolution=16, ) -cylinders_32 = actor.cylinder( +cylinders_32 = fury.actor.cylinder( centers[6:9], dirs[6:9], colors[6:9], @@ -118,7 +112,7 @@ ############################################################################### # Next, we set up a new scene to add and visualize the actors created. -scene = window.Scene() +scene = fury.window.Scene() scene.add(cylinders_8) scene.add(cylinders_16) @@ -127,9 +121,9 @@ interactive = False if interactive: - window.show(scene) + fury.window.show(scene) -window.record(scene, size=(600, 600), out_path="viz_poly_cylinder.png") +fury.window.record(scene, size=(600, 600), out_path="viz_poly_cylinder.png") ############################################################################### # Visualize the surface geometry representation for the object. @@ -139,9 +133,9 @@ cylinders_32.GetProperty().SetRepresentationToWireframe() if interactive: - window.show(scene) + fury.window.show(scene) -window.record(scene, size=(600, 600), out_path="viz_poly_cylinder_geom.png") +fury.window.record(scene, size=(600, 600), out_path="viz_poly_cylinder_geom.png") ############################################################################### # Then we clean the scene to render the boxes we will use to render our @@ -167,7 +161,7 @@ # Now we create cylinders using box actor and SDF implementation on shaders. # For this, we first create a box actor. -box_actor = actor.box( +box_actor = fury.actor.box( centers=centers, directions=dirs, colors=colors, @@ -187,10 +181,10 @@ rep_radii = np.repeat(np.repeat(radius, 9), 8, axis=0) rep_heights = np.repeat(np.repeat(height, 9), 8, axis=0) -attribute_to_actor(box_actor, rep_centers, "center") -attribute_to_actor(box_actor, rep_directions, "direction") -attribute_to_actor(box_actor, rep_radii, "radius") -attribute_to_actor(box_actor, rep_heights, "height") +fury.shaders.attribute_to_actor(box_actor, rep_centers, "center") +fury.shaders.attribute_to_actor(box_actor, rep_directions, "direction") +fury.shaders.attribute_to_actor(box_actor, rep_radii, "radius") +fury.shaders.attribute_to_actor(box_actor, rep_heights, "height") ############################################################################### # Then we have the shader code implementation corresponding to vertex and @@ -225,7 +219,7 @@ # to apply our implementation to the shader creation process, this function # joins our code to the shader template that FURY has by default. -shader_to_actor(box_actor, "vertex", decl_code=vs_dec, impl_code=vs_impl) +fury.shaders.shader_to_actor(box_actor, "vertex", decl_code=vs_dec, impl_code=vs_impl) ############################################################################### # Fragment shaders are used to define the colors of each pixel being processed, @@ -252,14 +246,14 @@ # to transform our position vectors in order to align the direction of # cylinder with respect to the box. -vec_to_vec_rot_mat = import_fury_shader( +vec_to_vec_rot_mat = fury.shaders.import_fury_shader( os.path.join("utils", "vec_to_vec_rot_mat.glsl") ) ############################################################################### # We calculate the distance using the SDF function for the cylinder. -sd_cylinder = import_fury_shader(os.path.join("sdf", "sd_cylinder.frag")) +sd_cylinder = fury.shaders.import_fury_shader(os.path.join("sdf", "sd_cylinder.frag")) ############################################################################### # This is used on calculations for surface normals of the cylinder. @@ -283,24 +277,28 @@ ############################################################################### # We use central differences technique for computing surface normals. -central_diffs_normal = import_fury_shader(os.path.join("sdf", "central_diffs.frag")) +central_diffs_normal = fury.shaders.import_fury_shader( + os.path.join("sdf", "central_diffs.frag") +) ############################################################################### # We use cast_ray for the implementation of Ray Marching. -cast_ray = import_fury_shader(os.path.join("ray_marching", "cast_ray.frag")) +cast_ray = fury.shaders.import_fury_shader( + os.path.join("ray_marching", "cast_ray.frag") +) ############################################################################### # For the illumination of the scene we use the Blinn-Phong model. -blinn_phong_model = import_fury_shader( +blinn_phong_model = fury.shaders.import_fury_shader( os.path.join("lighting", "blinn_phong_model.frag") ) ############################################################################### # Now we use compose_shader to join our pieces of GLSL shader code. -fs_dec = compose_shader( +fs_dec = fury.shaders.compose_shader( [ fs_vars_dec, vec_to_vec_rot_mat, @@ -312,7 +310,7 @@ ] ) -shader_to_actor(box_actor, "fragment", decl_code=fs_dec) +fury.shaders.shader_to_actor(box_actor, "fragment", decl_code=fs_dec) ############################################################################### # Here we have the implementation of all the previous code with all the @@ -350,7 +348,9 @@ } """ -shader_to_actor(box_actor, "fragment", impl_code=sdf_cylinder_frag_impl, block="light") +fury.shaders.shader_to_actor( + box_actor, "fragment", impl_code=sdf_cylinder_frag_impl, block="light" +) ############################################################################### # Finally, we visualize the cylinders made using ray marching and SDFs. @@ -358,9 +358,9 @@ scene.add(box_actor) if interactive: - window.show(scene) + fury.window.show(scene) -window.record(scene, size=(600, 600), out_path="viz_sdf_cylinder.png") +fury.window.record(scene, size=(600, 600), out_path="viz_sdf_cylinder.png") ############################################################################### # References diff --git a/dev/_downloads/e1f57a2229a86d1b9868d9f5fd1ca494/viz_fiber_odf.py b/dev/_downloads/e1f57a2229a86d1b9868d9f5fd1ca494/viz_fiber_odf.py index ac327aa7f..dcc078762 100644 --- a/dev/_downloads/e1f57a2229a86d1b9868d9f5fd1ca494/viz_fiber_odf.py +++ b/dev/_downloads/e1f57a2229a86d1b9868d9f5fd1ca494/viz_fiber_odf.py @@ -14,17 +14,15 @@ # First, we import some useful modules and methods. import numpy as np -from fury import actor, ui, window -from fury.data import fetch_viz_dmri, fetch_viz_icons, read_viz_dmri -from fury.utils import fix_winding_order +import fury ############################################################################### # Here, we fetch and load the fiber ODF volume to display. The ODF are # expressed as spherical harmonics (SH) coefficients in a 3D grid. -fetch_viz_dmri() -fetch_viz_icons() +fury.data.fetch_viz_dmri() +fury.data.fetch_viz_icons() -fodf_img = nib.load(read_viz_dmri("fodf.nii.gz")) +fodf_img = nib.load(fury.data.read_viz_dmri("fodf.nii.gz")) sh = fodf_img.get_fdata() affine = fodf_img.affine grid_shape = sh.shape[:-1] @@ -49,7 +47,7 @@ global_cm = False # ODF slicer for axial slice -odf_actor_z = actor.odf_slicer( +odf_actor_z = fury.actor.odf_slicer( sh, affine=affine, sphere=sphere_low, @@ -63,7 +61,7 @@ ) # ODF slicer for coronal slice -odf_actor_y = actor.odf_slicer( +odf_actor_y = fury.actor.odf_slicer( sh, affine=affine, sphere=sphere_low, @@ -80,7 +78,7 @@ ) # ODF slicer for sagittal slice -odf_actor_x = actor.odf_slicer( +odf_actor_x = fury.actor.odf_slicer( sh, affine=affine, sphere=sphere_low, @@ -96,18 +94,18 @@ grid_shape[0] // 2, grid_shape[0] // 2, 0, grid_shape[1] - 1, 0, grid_shape[2] - 1 ) -scene = window.Scene() +scene = fury.window.Scene() scene.add(odf_actor_z) scene.add(odf_actor_y) scene.add(odf_actor_x) -show_m = window.ShowManager(scene, reset_camera=True, size=(1200, 900)) +show_m = fury.window.ShowManager(scene, reset_camera=True, size=(1200, 900)) ############################################################################### # Now that we have a `ShowManager` containing our slicer, we can go on and # configure our UI for changing the slices to visualize. -line_slider_z = ui.LineSlider2D( +line_slider_z = fury.ui.LineSlider2D( min_value=0, max_value=grid_shape[2] - 1, initial_value=grid_shape[2] / 2, @@ -115,7 +113,7 @@ length=140, ) -line_slider_y = ui.LineSlider2D( +line_slider_y = fury.ui.LineSlider2D( min_value=0, max_value=grid_shape[1] - 1, initial_value=grid_shape[1] / 2, @@ -123,7 +121,7 @@ length=140, ) -line_slider_x = ui.LineSlider2D( +line_slider_x = fury.ui.LineSlider2D( min_value=0, max_value=grid_shape[0] - 1, initial_value=grid_shape[0] / 2, @@ -138,7 +136,9 @@ # We fix the order of the faces' three vertices to a clockwise winding. This # ensures all faces have a normal going away from the center of the sphere. -sphere_high.faces = fix_winding_order(sphere_high.vertices, sphere_high.faces, True) +sphere_high.faces = fury.utils.fix_winding_order( + sphere_high.vertices, sphere_high.faces, True +) B_high = sh_to_sf_matrix(sphere_high, 8, return_inv=False) ############################################################################### @@ -147,7 +147,7 @@ "Low resolution": (sphere_low, B_low), "High resolution": (sphere_high, B_high), } -combobox = ui.ComboBox2D(items=list(sphere_dict)) +combobox = fury.ui.ComboBox2D(items=list(sphere_dict)) scene.add(combobox) ############################################################################### @@ -186,7 +186,7 @@ def change_sphere(combobox): def build_label(text): - label = ui.TextBlock2D() + label = fury.ui.TextBlock2D() label.message = text label.font_size = 18 label.font_family = "Arial" @@ -204,7 +204,7 @@ def build_label(text): line_slider_label_y = build_label(text="Y Slice") line_slider_label_x = build_label(text="X Slice") -panel = ui.Panel2D(size=(300, 200), color=(1, 1, 1), opacity=0.1, align="right") +panel = fury.ui.Panel2D(size=(300, 200), color=(1, 1, 1), opacity=0.1, align="right") panel.center = (1030, 120) panel.add_element(line_slider_label_x, (0.1, 0.75)) @@ -245,7 +245,7 @@ def win_callback(obj, _event): show_m.render() show_m.start() else: - window.record( + fury.window.record( scene, out_path="odf_slicer_3D.png", size=(1200, 900), reset_camera=False ) diff --git a/dev/_downloads/e22a09689bdb9d1c7847fe275f1e83ba/viz_pbr_interactive.ipynb b/dev/_downloads/e22a09689bdb9d1c7847fe275f1e83ba/viz_pbr_interactive.ipynb index 5ee3f3066..09cb7ac62 100644 --- a/dev/_downloads/e22a09689bdb9d1c7847fe275f1e83ba/viz_pbr_interactive.ipynb +++ b/dev/_downloads/e22a09689bdb9d1c7847fe275f1e83ba/viz_pbr_interactive.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import actor, material, ui, window\nfrom fury.data import fetch_viz_cubemaps, read_viz_cubemap\nfrom fury.io import load_cubemap_texture\nfrom fury.utils import (\n normals_from_actor,\n tangents_from_direction_of_anisotropy,\n tangents_to_actor,\n)" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "def change_slice_metallic(slider):\n global pbr_params\n pbr_params.metallic = slider.value\n\n\ndef change_slice_roughness(slider):\n global pbr_params\n pbr_params.roughness = slider.value\n\n\ndef change_slice_anisotropy(slider):\n global pbr_params\n pbr_params.anisotropy = slider.value\n\n\ndef change_slice_anisotropy_direction_x(slider):\n global doa, normals, sphere\n doa[0] = slider.value\n tangents = tangents_from_direction_of_anisotropy(normals, doa)\n tangents_to_actor(sphere, tangents)\n\n\ndef change_slice_anisotropy_direction_y(slider):\n global doa, normals, sphere\n doa[1] = slider.value\n tangents = tangents_from_direction_of_anisotropy(normals, doa)\n tangents_to_actor(sphere, tangents)\n\n\ndef change_slice_anisotropy_direction_z(slider):\n global doa, normals, sphere\n doa[2] = slider.value\n tangents = tangents_from_direction_of_anisotropy(normals, doa)\n tangents_to_actor(sphere, tangents)\n\n\ndef change_slice_anisotropy_rotation(slider):\n global pbr_params\n pbr_params.anisotropy_rotation = slider.value\n\n\ndef change_slice_coat_strength(slider):\n global pbr_params\n pbr_params.coat_strength = slider.value\n\n\ndef change_slice_coat_roughness(slider):\n global pbr_params\n pbr_params.coat_roughness = slider.value\n\n\ndef change_slice_base_ior(slider):\n global pbr_params\n pbr_params.base_ior = slider.value\n\n\ndef change_slice_coat_ior(slider):\n global pbr_params\n pbr_params.coat_ior = slider.value" + "def change_slice_metallic(slider):\n global pbr_params\n pbr_params.metallic = slider.value\n\n\ndef change_slice_roughness(slider):\n global pbr_params\n pbr_params.roughness = slider.value\n\n\ndef change_slice_anisotropy(slider):\n global pbr_params\n pbr_params.anisotropy = slider.value\n\n\ndef change_slice_anisotropy_direction_x(slider):\n global doa, normals, sphere\n doa[0] = slider.value\n tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)\n fury.utils.tangents_to_actor(sphere, tangents)\n\n\ndef change_slice_anisotropy_direction_y(slider):\n global doa, normals, sphere\n doa[1] = slider.value\n tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)\n fury.utils.tangents_to_actor(sphere, tangents)\n\n\ndef change_slice_anisotropy_direction_z(slider):\n global doa, normals, sphere\n doa[2] = slider.value\n tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)\n fury.utils.tangents_to_actor(sphere, tangents)\n\n\ndef change_slice_anisotropy_rotation(slider):\n global pbr_params\n pbr_params.anisotropy_rotation = slider.value\n\n\ndef change_slice_coat_strength(slider):\n global pbr_params\n pbr_params.coat_strength = slider.value\n\n\ndef change_slice_coat_roughness(slider):\n global pbr_params\n pbr_params.coat_roughness = slider.value\n\n\ndef change_slice_base_ior(slider):\n global pbr_params\n pbr_params.base_ior = slider.value\n\n\ndef change_slice_coat_ior(slider):\n global pbr_params\n pbr_params.coat_ior = slider.value" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "fetch_viz_cubemaps()" + "fury.data.fetch_viz_cubemaps()" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "textures = read_viz_cubemap(\"skybox\")" + "textures = fury.data.read_viz_cubemap(\"skybox\")" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "cubemap = load_cubemap_texture(textures)" + "cubemap = fury.io.load_cubemap_texture(textures)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene(skybox=cubemap)" + "scene = fury.window.Scene(skybox=cubemap)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "sphere = actor.sphere([[0, 0, 0]], (0.7, 0.7, 0.7), radii=2, theta=64, phi=64)" + "sphere = fury.actor.sphere([[0, 0, 0]], (0.7, 0.7, 0.7), radii=2, theta=64, phi=64)" ] }, { @@ -166,7 +166,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The following process gets the normals of the actor and computes the tangents\nthat are aligned to the provided DoA. Then it registers those tangents to the\nactor.\n\n" + "The following process gets the normals of the actor and computes the tangents\nthat are aligned to the provided DoA. Then it registers those tangents to the\nfury.actor.\n\n" ] }, { @@ -177,7 +177,7 @@ }, "outputs": [], "source": [ - "normals = normals_from_actor(sphere)\ntangents = tangents_from_direction_of_anisotropy(normals, doa)\ntangents_to_actor(sphere, tangents)" + "normals = fury.utils.normals_from_actor(sphere)\ntangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)\nfury.utils.tangents_to_actor(sphere, tangents)" ] }, { @@ -195,7 +195,7 @@ }, "outputs": [], "source": [ - "pbr_params = material.manifest_pbr(sphere)" + "pbr_params = fury.material.manifest_pbr(sphere)" ] }, { @@ -231,7 +231,7 @@ }, "outputs": [], "source": [ - "show_m = window.ShowManager(\n scene=scene, size=(1920, 1080), reset_camera=False, order_transparent=True\n)" + "show_m = fury.window.ShowManager(\n scene=scene, size=(1920, 1080), reset_camera=False, order_transparent=True\n)" ] }, { @@ -249,7 +249,7 @@ }, "outputs": [], "source": [ - "control_panel = ui.Panel2D(\n (400, 500), position=(5, 5), color=(0.25, 0.25, 0.25), opacity=0.75, align=\"right\"\n)" + "control_panel = fury.ui.Panel2D(\n (400, 500), position=(5, 5), color=(0.25, 0.25, 0.25), opacity=0.75, align=\"right\"\n)" ] }, { @@ -267,7 +267,7 @@ }, "outputs": [], "source": [ - "slider_label_metallic = ui.TextBlock2D(text=\"Metallic\", font_size=16)\nslider_label_roughness = ui.TextBlock2D(text=\"Roughness\", font_size=16)\nslider_label_anisotropy = ui.TextBlock2D(text=\"Anisotropy\", font_size=16)\nslider_label_anisotropy_rotation = ui.TextBlock2D(\n text=\"Anisotropy Rotation\", font_size=16\n)\nslider_label_anisotropy_direction_x = ui.TextBlock2D(\n text=\"Anisotropy Direction X\", font_size=16\n)\nslider_label_anisotropy_direction_y = ui.TextBlock2D(\n text=\"Anisotropy Direction Y\", font_size=16\n)\nslider_label_anisotropy_direction_z = ui.TextBlock2D(\n text=\"Anisotropy Direction Z\", font_size=16\n)\nslider_label_coat_strength = ui.TextBlock2D(text=\"Coat Strength\", font_size=16)\nslider_label_coat_roughness = ui.TextBlock2D(text=\"Coat Roughness\", font_size=16)\nslider_label_base_ior = ui.TextBlock2D(text=\"Base IoR\", font_size=16)\nslider_label_coat_ior = ui.TextBlock2D(text=\"Coat IoR\", font_size=16)\n\ncontrol_panel.add_element(slider_label_metallic, (0.01, 0.95))\ncontrol_panel.add_element(slider_label_roughness, (0.01, 0.86))\ncontrol_panel.add_element(slider_label_anisotropy, (0.01, 0.77))\ncontrol_panel.add_element(slider_label_anisotropy_rotation, (0.01, 0.68))\ncontrol_panel.add_element(slider_label_anisotropy_direction_x, (0.01, 0.59))\ncontrol_panel.add_element(slider_label_anisotropy_direction_y, (0.01, 0.5))\ncontrol_panel.add_element(slider_label_anisotropy_direction_z, (0.01, 0.41))\ncontrol_panel.add_element(slider_label_coat_strength, (0.01, 0.32))\ncontrol_panel.add_element(slider_label_coat_roughness, (0.01, 0.23))\ncontrol_panel.add_element(slider_label_base_ior, (0.01, 0.14))\ncontrol_panel.add_element(slider_label_coat_ior, (0.01, 0.05))" + "slider_label_metallic = fury.ui.TextBlock2D(text=\"Metallic\", font_size=16)\nslider_label_roughness = fury.ui.TextBlock2D(text=\"Roughness\", font_size=16)\nslider_label_anisotropy = fury.ui.TextBlock2D(text=\"Anisotropy\", font_size=16)\nslider_label_anisotropy_rotation = fury.ui.TextBlock2D(\n text=\"Anisotropy Rotation\", font_size=16\n)\nslider_label_anisotropy_direction_x = fury.ui.TextBlock2D(\n text=\"Anisotropy Direction X\", font_size=16\n)\nslider_label_anisotropy_direction_y = fury.ui.TextBlock2D(\n text=\"Anisotropy Direction Y\", font_size=16\n)\nslider_label_anisotropy_direction_z = fury.ui.TextBlock2D(\n text=\"Anisotropy Direction Z\", font_size=16\n)\nslider_label_coat_strength = fury.ui.TextBlock2D(text=\"Coat Strength\", font_size=16)\nslider_label_coat_roughness = fury.ui.TextBlock2D(text=\"Coat Roughness\", font_size=16)\nslider_label_base_ior = fury.ui.TextBlock2D(text=\"Base IoR\", font_size=16)\nslider_label_coat_ior = fury.ui.TextBlock2D(text=\"Coat IoR\", font_size=16)\n\ncontrol_panel.add_element(slider_label_metallic, (0.01, 0.95))\ncontrol_panel.add_element(slider_label_roughness, (0.01, 0.86))\ncontrol_panel.add_element(slider_label_anisotropy, (0.01, 0.77))\ncontrol_panel.add_element(slider_label_anisotropy_rotation, (0.01, 0.68))\ncontrol_panel.add_element(slider_label_anisotropy_direction_x, (0.01, 0.59))\ncontrol_panel.add_element(slider_label_anisotropy_direction_y, (0.01, 0.5))\ncontrol_panel.add_element(slider_label_anisotropy_direction_z, (0.01, 0.41))\ncontrol_panel.add_element(slider_label_coat_strength, (0.01, 0.32))\ncontrol_panel.add_element(slider_label_coat_roughness, (0.01, 0.23))\ncontrol_panel.add_element(slider_label_base_ior, (0.01, 0.14))\ncontrol_panel.add_element(slider_label_coat_ior, (0.01, 0.05))" ] }, { @@ -285,7 +285,7 @@ }, "outputs": [], "source": [ - "slider_slice_metallic = ui.LineSlider2D(\n initial_value=pbr_params.metallic,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_roughness = ui.LineSlider2D(\n initial_value=pbr_params.roughness,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy = ui.LineSlider2D(\n initial_value=pbr_params.anisotropy,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy_rotation = ui.LineSlider2D(\n initial_value=pbr_params.anisotropy_rotation,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_coat_strength = ui.LineSlider2D(\n initial_value=pbr_params.coat_strength,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_coat_roughness = ui.LineSlider2D(\n initial_value=pbr_params.coat_roughness,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)" + "slider_slice_metallic = fury.ui.LineSlider2D(\n initial_value=pbr_params.metallic,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_roughness = fury.ui.LineSlider2D(\n initial_value=pbr_params.roughness,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy = fury.ui.LineSlider2D(\n initial_value=pbr_params.anisotropy,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy_rotation = fury.ui.LineSlider2D(\n initial_value=pbr_params.anisotropy_rotation,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_coat_strength = fury.ui.LineSlider2D(\n initial_value=pbr_params.coat_strength,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_coat_roughness = fury.ui.LineSlider2D(\n initial_value=pbr_params.coat_roughness,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)" ] }, { @@ -303,7 +303,7 @@ }, "outputs": [], "source": [ - "slider_slice_anisotropy_direction_x = ui.LineSlider2D(\n initial_value=doa[0],\n min_value=-1,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy_direction_y = ui.LineSlider2D(\n initial_value=doa[1],\n min_value=-1,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy_direction_z = ui.LineSlider2D(\n initial_value=doa[2],\n min_value=-1,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)" + "slider_slice_anisotropy_direction_x = fury.ui.LineSlider2D(\n initial_value=doa[0],\n min_value=-1,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy_direction_y = fury.ui.LineSlider2D(\n initial_value=doa[1],\n min_value=-1,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)\nslider_slice_anisotropy_direction_z = fury.ui.LineSlider2D(\n initial_value=doa[2],\n min_value=-1,\n max_value=1,\n length=195,\n text_template=\"{value:.1f}\",\n)" ] }, { @@ -321,7 +321,7 @@ }, "outputs": [], "source": [ - "slider_slice_base_ior = ui.LineSlider2D(\n initial_value=pbr_params.base_ior,\n min_value=1,\n max_value=2.3,\n length=195,\n text_template=\"{value:.02f}\",\n)\nslider_slice_coat_ior = ui.LineSlider2D(\n initial_value=pbr_params.coat_ior,\n min_value=1,\n max_value=2.3,\n length=195,\n text_template=\"{value:.02f}\",\n)" + "slider_slice_base_ior = fury.ui.LineSlider2D(\n initial_value=pbr_params.base_ior,\n min_value=1,\n max_value=2.3,\n length=195,\n text_template=\"{value:.02f}\",\n)\nslider_slice_coat_ior = fury.ui.LineSlider2D(\n initial_value=pbr_params.coat_ior,\n min_value=1,\n max_value=2.3,\n length=195,\n text_template=\"{value:.02f}\",\n)" ] }, { @@ -411,7 +411,7 @@ }, "outputs": [], "source": [ - "interactive = False\nif interactive:\n show_m.start()\n\nwindow.record(scene, size=(1920, 1080), out_path=\"viz_pbr_interactive.png\")" + "interactive = False\nif interactive:\n show_m.start()\n\nfury.window.record(scene, size=(1920, 1080), out_path=\"viz_pbr_interactive.png\")" ] } ], diff --git a/dev/_downloads/e23bfcec8d867b7ad34707395cebc46b/viz_sphere.ipynb b/dev/_downloads/e23bfcec8d867b7ad34707395cebc46b/viz_sphere.ipynb index db5ca9936..77ac7b5f8 100644 --- a/dev/_downloads/e23bfcec8d867b7ad34707395cebc46b/viz_sphere.ipynb +++ b/dev/_downloads/e23bfcec8d867b7ad34707395cebc46b/viz_sphere.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window" + "import numpy as np\n\nimport fury" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "prim_sphere_actor = actor.sphere(centers, colors=colors, radii=5)" + "prim_sphere_actor = fury.actor.sphere(centers, colors=colors, radii=5)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "cen2 = np.add(centers, np.array([12, 0, 0]))\ncols2 = np.array([1, 0, 0])\n\nvtk_sphere_actor = actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False)\n\nscene = window.Scene()" + "cen2 = np.add(centers, np.array([12, 0, 0]))\ncols2 = np.array([1, 0, 0])\n\nvtk_sphere_actor = fury.actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False)\n\nscene = fury.window.Scene()" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "scene.add(prim_sphere_actor)\nscene.add(vtk_sphere_actor)\n\ninteractive = False\n\nif interactive:\n window.show(scene, size=(600, 600))\n\nwindow.record(scene, out_path=\"viz_sphere.png\", size=(600, 600))" + "scene.add(prim_sphere_actor)\nscene.add(vtk_sphere_actor)\n\ninteractive = False\n\nif interactive:\n fury.window.show(scene, size=(600, 600))\n\nfury.window.record(scene, out_path=\"viz_sphere.png\", size=(600, 600))" ] } ], diff --git a/dev/_downloads/e3982d04e01e684a5ec690e9fd696fe2/viz_ui_listbox.zip b/dev/_downloads/e3982d04e01e684a5ec690e9fd696fe2/viz_ui_listbox.zip index 9546ffdb8..d4f72eca5 100644 Binary files a/dev/_downloads/e3982d04e01e684a5ec690e9fd696fe2/viz_ui_listbox.zip and b/dev/_downloads/e3982d04e01e684a5ec690e9fd696fe2/viz_ui_listbox.zip differ diff --git a/dev/_downloads/e7cb7957a976e27572ba592e1f2ea214/viz_bezier_interpolator.zip b/dev/_downloads/e7cb7957a976e27572ba592e1f2ea214/viz_bezier_interpolator.zip index f12142fad..828ba5bc0 100644 Binary files a/dev/_downloads/e7cb7957a976e27572ba592e1f2ea214/viz_bezier_interpolator.zip and b/dev/_downloads/e7cb7957a976e27572ba592e1f2ea214/viz_bezier_interpolator.zip differ diff --git a/dev/_downloads/e999b22bbd0e40cb805df5bd6e5d97dd/viz_earth_animation.py b/dev/_downloads/e999b22bbd0e40cb805df5bd6e5d97dd/viz_earth_animation.py index ff430a31b..38675c595 100644 --- a/dev/_downloads/e999b22bbd0e40cb805df5bd6e5d97dd/viz_earth_animation.py +++ b/dev/_downloads/e999b22bbd0e40cb805df5bd6e5d97dd/viz_earth_animation.py @@ -9,18 +9,12 @@ import numpy as np -from fury import actor, io, utils, window -from fury.data import ( - fetch_viz_models, - fetch_viz_textures, - read_viz_models, - read_viz_textures, -) +import fury ############################################################################## # Create a scene to start. -scene = window.Scene() +scene = fury.window.Scene() ############################################################################## # Next, load in a texture for each of the actors. For this tutorial, we will @@ -29,23 +23,23 @@ # and ``read_viz_textures``, then use ``io.load_image`` to load in the # image. -fetch_viz_textures() -earth_filename = read_viz_textures("1_earth_8k.jpg") -earth_image = io.load_image(earth_filename) +fury.data.fetch_viz_textures() +earth_filename = fury.data.read_viz_textures("1_earth_8k.jpg") +earth_image = fury.io.load_image(earth_filename) ############################################################################## # Using ``actor.texture_on_sphere()``, create an earth_actor with your newly # loaded texture. -earth_actor = actor.texture_on_sphere(earth_image) +earth_actor = fury.actor.texture_on_sphere(earth_image) ############################################################################## # Then, do the same for the moon. -moon_filename = read_viz_textures("moon-8k.jpg") -moon_image = io.load_image(moon_filename) +moon_filename = fury.data.read_viz_textures("moon-8k.jpg") +moon_image = fury.io.load_image(moon_filename) -moon_actor = actor.texture_on_sphere(moon_image) +moon_actor = fury.actor.texture_on_sphere(moon_image) ############################################################################## # Add both actors to the already existing scene. @@ -61,13 +55,13 @@ moon_actor.SetPosition(1, 0.1, 0.5) moon_actor.SetScale(0.25, 0.25, 0.25) -utils.rotate(earth_actor, (-90, 1, 0, 0)) +fury.utils.rotate(earth_actor, (-90, 1, 0, 0)) ############################################################################## # The ShowManager class is the interface between the scene, the window and the # interactor. -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) @@ -94,23 +88,23 @@ center = np.array([[-0.39, 0.3175, 0.025]]) radius = 0.002 -sphere_actor = actor.sphere(center, window.colors.blue_medium, radius) +sphere_actor = fury.actor.sphere(center, fury.window.colors.blue_medium, radius) ############################################################################## # Also creating a text actor to add below the sphere. -text_actor = actor.text_3d( - "Bloomington, Indiana", (-0.42, 0.31, 0.03), window.colors.white, 0.004 +text_actor = fury.actor.text_3d( + "Bloomington, Indiana", (-0.42, 0.31, 0.03), fury.window.colors.white, 0.004 ) -utils.rotate(text_actor, (-90, 0, 1, 0)) +fury.utils.rotate(text_actor, (-90, 0, 1, 0)) ############################################################################## # Let's also import a model of a satellite to visualize circling the moon. -fetch_viz_models() -satellite_filename = read_viz_models("satellite_obj.obj") -satellite = io.load_polydata(satellite_filename) -satellite_actor = utils.get_actor_from_polydata(satellite) +fury.data.fetch_viz_models() +satellite_filename = fury.data.read_viz_models("satellite_obj.obj") +satellite = fury.io.load_polydata(satellite_filename) +satellite_actor = fury.utils.get_actor_from_polydata(satellite) satellite_actor.SetPosition(-0.75, 0.1, 0.4) satellite_actor.SetScale(0.005, 0.005, 0.005) @@ -127,7 +121,7 @@ def timer_callback(_obj, _event): cnt = next(counter) showm.render() if cnt < 450: - utils.rotate(earth_actor, (1, 0, 1, 0)) + fury.utils.rotate(earth_actor, (1, 0, 1, 0)) if cnt % 5 == 0 and cnt < 450: showm.scene.azimuth(-1) if cnt == 300: @@ -152,15 +146,15 @@ def timer_callback(_obj, _event): ) scene.zoom(0.03) scene.add(satellite_actor) - utils.rotate(satellite_actor, (180, 0, 1, 0)) + fury.utils.rotate(satellite_actor, (180, 0, 1, 0)) scene.rm(earth_actor) if cnt > 575 and cnt < 750: showm.scene.azimuth(-2) - utils.rotate(moon_actor, (-2, 0, 1, 0)) + fury.utils.rotate(moon_actor, (-2, 0, 1, 0)) satellite_actor.SetPosition(-0.8, 0.1 - cnt / 10000, 0.4) if cnt >= 750 and cnt < 1100: showm.scene.azimuth(-2) - utils.rotate(moon_actor, (-2, 0, 1, 0)) + fury.utils.rotate(moon_actor, (-2, 0, 1, 0)) satellite_actor.SetPosition(-0.8, -0.07 + cnt / 10000, 0.4) if cnt == 1100: showm.exit() @@ -172,4 +166,4 @@ def timer_callback(_obj, _event): showm.add_timer_callback(True, 35, timer_callback) showm.start() -window.record(showm.scene, size=(900, 768), out_path="viz_earth_animation.png") +fury.window.record(showm.scene, size=(900, 768), out_path="viz_earth_animation.png") diff --git a/dev/_downloads/ea42b6e1d50eac5b2d3d01d0757008ef/viz_pbr_interactive.py b/dev/_downloads/ea42b6e1d50eac5b2d3d01d0757008ef/viz_pbr_interactive.py index 3238e8ac5..768363919 100644 --- a/dev/_downloads/ea42b6e1d50eac5b2d3d01d0757008ef/viz_pbr_interactive.py +++ b/dev/_downloads/ea42b6e1d50eac5b2d3d01d0757008ef/viz_pbr_interactive.py @@ -9,14 +9,7 @@ Let's start by importing the necessary modules: """ -from fury import actor, material, ui, window -from fury.data import fetch_viz_cubemaps, read_viz_cubemap -from fury.io import load_cubemap_texture -from fury.utils import ( - normals_from_actor, - tangents_from_direction_of_anisotropy, - tangents_to_actor, -) +import fury ############################################################################### # The following functions will help us to manage the sliders events. @@ -40,22 +33,22 @@ def change_slice_anisotropy(slider): def change_slice_anisotropy_direction_x(slider): global doa, normals, sphere doa[0] = slider.value - tangents = tangents_from_direction_of_anisotropy(normals, doa) - tangents_to_actor(sphere, tangents) + tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa) + fury.utils.tangents_to_actor(sphere, tangents) def change_slice_anisotropy_direction_y(slider): global doa, normals, sphere doa[1] = slider.value - tangents = tangents_from_direction_of_anisotropy(normals, doa) - tangents_to_actor(sphere, tangents) + tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa) + fury.utils.tangents_to_actor(sphere, tangents) def change_slice_anisotropy_direction_z(slider): global doa, normals, sphere doa[2] = slider.value - tangents = tangents_from_direction_of_anisotropy(normals, doa) - tangents_to_actor(sphere, tangents) + tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa) + fury.utils.tangents_to_actor(sphere, tangents) def change_slice_anisotropy_rotation(slider): @@ -100,19 +93,19 @@ def win_callback(obj, event): ############################################################################### # Let's fetch a skybox texture from the FURY data repository. -fetch_viz_cubemaps() +fury.data.fetch_viz_cubemaps() ############################################################################### # The following function returns the full path of the 6 images composing the # skybox. -textures = read_viz_cubemap("skybox") +textures = fury.data.read_viz_cubemap("skybox") ############################################################################### # Now that we have the location of the textures, let's load them and create a # Cube Map Texture object. -cubemap = load_cubemap_texture(textures) +cubemap = fury.io.load_cubemap_texture(textures) ############################################################################### # The Scene object in FURY can handle cube map textures and extract light @@ -120,13 +113,13 @@ def win_callback(obj, event): # interactions. The ``skybox`` parameter takes as input a cube map texture and # performs the previously described process. -scene = window.Scene(skybox=cubemap) +scene = fury.window.Scene(skybox=cubemap) ############################################################################### # With the scene created, we can then populate it. In this demo we will only # add a sphere actor. -sphere = actor.sphere([[0, 0, 0]], (0.7, 0.7, 0.7), radii=2, theta=64, phi=64) +sphere = fury.actor.sphere([[0, 0, 0]], (0.7, 0.7, 0.7), radii=2, theta=64, phi=64) ############################################################################### # The direction of anisotropy (DoA) defines the direction at which all the @@ -137,17 +130,17 @@ def win_callback(obj, event): ############################################################################### # The following process gets the normals of the actor and computes the tangents # that are aligned to the provided DoA. Then it registers those tangents to the -# actor. +# fury.actor. -normals = normals_from_actor(sphere) -tangents = tangents_from_direction_of_anisotropy(normals, doa) -tangents_to_actor(sphere, tangents) +normals = fury.utils.normals_from_actor(sphere) +tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa) +fury.utils.tangents_to_actor(sphere, tangents) ############################################################################### # With the tangents computed and in place, we have all the elements needed to # add some material properties to the actor. -pbr_params = material.manifest_pbr(sphere) +pbr_params = fury.material.manifest_pbr(sphere) ############################################################################### # Our actor is now ready to be added to the scene. @@ -157,7 +150,7 @@ def win_callback(obj, event): ############################################################################### # Let's setup now the window and the UI. -show_m = window.ShowManager( +show_m = fury.window.ShowManager( scene=scene, size=(1920, 1080), reset_camera=False, order_transparent=True ) @@ -165,7 +158,7 @@ def win_callback(obj, event): ############################################################################### # We will create one single panel with all of our labels and sliders. -control_panel = ui.Panel2D( +control_panel = fury.ui.Panel2D( (400, 500), position=(5, 5), color=(0.25, 0.25, 0.25), opacity=0.75, align="right" ) @@ -173,25 +166,25 @@ def win_callback(obj, event): # By using our previously defined function, we can easily create all the labels # we need for this demo. And then add them to the panel. -slider_label_metallic = ui.TextBlock2D(text="Metallic", font_size=16) -slider_label_roughness = ui.TextBlock2D(text="Roughness", font_size=16) -slider_label_anisotropy = ui.TextBlock2D(text="Anisotropy", font_size=16) -slider_label_anisotropy_rotation = ui.TextBlock2D( +slider_label_metallic = fury.ui.TextBlock2D(text="Metallic", font_size=16) +slider_label_roughness = fury.ui.TextBlock2D(text="Roughness", font_size=16) +slider_label_anisotropy = fury.ui.TextBlock2D(text="Anisotropy", font_size=16) +slider_label_anisotropy_rotation = fury.ui.TextBlock2D( text="Anisotropy Rotation", font_size=16 ) -slider_label_anisotropy_direction_x = ui.TextBlock2D( +slider_label_anisotropy_direction_x = fury.ui.TextBlock2D( text="Anisotropy Direction X", font_size=16 ) -slider_label_anisotropy_direction_y = ui.TextBlock2D( +slider_label_anisotropy_direction_y = fury.ui.TextBlock2D( text="Anisotropy Direction Y", font_size=16 ) -slider_label_anisotropy_direction_z = ui.TextBlock2D( +slider_label_anisotropy_direction_z = fury.ui.TextBlock2D( text="Anisotropy Direction Z", font_size=16 ) -slider_label_coat_strength = ui.TextBlock2D(text="Coat Strength", font_size=16) -slider_label_coat_roughness = ui.TextBlock2D(text="Coat Roughness", font_size=16) -slider_label_base_ior = ui.TextBlock2D(text="Base IoR", font_size=16) -slider_label_coat_ior = ui.TextBlock2D(text="Coat IoR", font_size=16) +slider_label_coat_strength = fury.ui.TextBlock2D(text="Coat Strength", font_size=16) +slider_label_coat_roughness = fury.ui.TextBlock2D(text="Coat Roughness", font_size=16) +slider_label_base_ior = fury.ui.TextBlock2D(text="Base IoR", font_size=16) +slider_label_coat_ior = fury.ui.TextBlock2D(text="Coat IoR", font_size=16) control_panel.add_element(slider_label_metallic, (0.01, 0.95)) control_panel.add_element(slider_label_roughness, (0.01, 0.86)) @@ -208,37 +201,37 @@ def win_callback(obj, event): ############################################################################### # Our sliders are created and added to the panel in the following way. -slider_slice_metallic = ui.LineSlider2D( +slider_slice_metallic = fury.ui.LineSlider2D( initial_value=pbr_params.metallic, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_roughness = ui.LineSlider2D( +slider_slice_roughness = fury.ui.LineSlider2D( initial_value=pbr_params.roughness, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_anisotropy = ui.LineSlider2D( +slider_slice_anisotropy = fury.ui.LineSlider2D( initial_value=pbr_params.anisotropy, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_anisotropy_rotation = ui.LineSlider2D( +slider_slice_anisotropy_rotation = fury.ui.LineSlider2D( initial_value=pbr_params.anisotropy_rotation, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_coat_strength = ui.LineSlider2D( +slider_slice_coat_strength = fury.ui.LineSlider2D( initial_value=pbr_params.coat_strength, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_coat_roughness = ui.LineSlider2D( +slider_slice_coat_roughness = fury.ui.LineSlider2D( initial_value=pbr_params.coat_roughness, max_value=1, length=195, @@ -250,21 +243,21 @@ def win_callback(obj, event): # within that range we cover all the possible 3D directions needed to align the # tangents. -slider_slice_anisotropy_direction_x = ui.LineSlider2D( +slider_slice_anisotropy_direction_x = fury.ui.LineSlider2D( initial_value=doa[0], min_value=-1, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_anisotropy_direction_y = ui.LineSlider2D( +slider_slice_anisotropy_direction_y = fury.ui.LineSlider2D( initial_value=doa[1], min_value=-1, max_value=1, length=195, text_template="{value:.1f}", ) -slider_slice_anisotropy_direction_z = ui.LineSlider2D( +slider_slice_anisotropy_direction_z = fury.ui.LineSlider2D( initial_value=doa[2], min_value=-1, max_value=1, @@ -277,14 +270,14 @@ def win_callback(obj, event): # cases, the values are defined in the range [1, 2.3] according to the # documentation of the material. -slider_slice_base_ior = ui.LineSlider2D( +slider_slice_base_ior = fury.ui.LineSlider2D( initial_value=pbr_params.base_ior, min_value=1, max_value=2.3, length=195, text_template="{value:.02f}", ) -slider_slice_coat_ior = ui.LineSlider2D( +slider_slice_coat_ior = fury.ui.LineSlider2D( initial_value=pbr_params.coat_ior, min_value=1, max_value=2.3, @@ -343,4 +336,4 @@ def win_callback(obj, event): if interactive: show_m.start() -window.record(scene, size=(1920, 1080), out_path="viz_pbr_interactive.png") +fury.window.record(scene, size=(1920, 1080), out_path="viz_pbr_interactive.png") diff --git a/dev/_downloads/ed25feb190d28892577f2b94ad0ba829/viz_pbr_spheres.ipynb b/dev/_downloads/ed25feb190d28892577f2b94ad0ba829/viz_pbr_spheres.ipynb index af750f904..9682ceac3 100644 --- a/dev/_downloads/ed25feb190d28892577f2b94ad0ba829/viz_pbr_spheres.ipynb +++ b/dev/_downloads/ed25feb190d28892577f2b94ad0ba829/viz_pbr_spheres.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, material, window\nfrom fury.utils import (\n normals_from_actor,\n tangents_from_direction_of_anisotropy,\n tangents_to_actor,\n)" + "import numpy as np\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.background((0.9, 0.9, 0.9))" + "scene = fury.window.Scene()\nscene.background((0.9, 0.9, 0.9))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "num_values = 11\n\nfor i, mp in enumerate(material_params):\n color = mp[0]\n params = mp[1]\n center = [[0, -5 * i, 0]]\n for j in range(num_values):\n center[0][0] = -25 + 5 * j\n sphere = actor.sphere(center, color, radii=2, theta=32, phi=32)\n normals = normals_from_actor(sphere)\n tangents = tangents_from_direction_of_anisotropy(normals, (0, 1, 0.5))\n tangents_to_actor(sphere, tangents)\n keys = list(params)\n params[keys[0]] = np.round(0.1 * j, decimals=1)\n material.manifest_pbr(sphere, **params)\n scene.add(sphere)" + "num_values = 11\n\nfor i, mp in enumerate(material_params):\n color = mp[0]\n params = mp[1]\n center = [[0, -5 * i, 0]]\n for j in range(num_values):\n center[0][0] = -25 + 5 * j\n sphere = fury.actor.sphere(center, color, radii=2, theta=32, phi=32)\n normals = fury.utils.normals_from_actor(sphere)\n tangents = fury.utils.tangents_from_direction_of_anisotropy(\n normals, (0, 1, 0.5)\n )\n fury.utils.tangents_to_actor(sphere, tangents)\n keys = list(params)\n params[keys[0]] = np.round(0.1 * j, decimals=1)\n fury.material.manifest_pbr(sphere, **params)\n scene.add(sphere)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "labels = [\n \"Metallic\",\n \"Roughness\",\n \"Anisotropy\",\n \"Anisotropy Rotation\",\n \"Coat Strength\",\n \"Coat Roughness\",\n]\n\nfor i, name in enumerate(labels):\n pos = [-40, -5 * i, 0]\n label = actor.vector_text(name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0))\n scene.add(label)\n\nfor j in range(num_values):\n pos = [-26 + 5 * j, 3, 0]\n label = actor.vector_text(\n str(np.round(j * 0.1, decimals=1)),\n pos=pos,\n scale=(0.8, 0.8, 0.8),\n color=(0, 0, 0),\n )\n scene.add(label)" + "labels = [\n \"Metallic\",\n \"Roughness\",\n \"Anisotropy\",\n \"Anisotropy Rotation\",\n \"Coat Strength\",\n \"Coat Roughness\",\n]\n\nfor i, name in enumerate(labels):\n pos = [-40, -5 * i, 0]\n label = fury.actor.vector_text(\n name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)\n )\n scene.add(label)\n\nfor j in range(num_values):\n pos = [-26 + 5 * j, 3, 0]\n label = fury.actor.vector_text(\n str(np.round(j * 0.1, decimals=1)),\n pos=pos,\n scale=(0.8, 0.8, 0.8),\n color=(0, 0, 0),\n )\n scene.add(label)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "iors = np.round(np.linspace(1, 2.3, num=num_values), decimals=2)\n\nior_params = [\n [(0, 1, 1), {\"base_ior\": iors[0], \"roughness\": 0}],\n [\n (0, 1, 1),\n {\n \"coat_ior\": iors[0],\n \"coat_roughness\": 0.1,\n \"coat_strength\": 1,\n \"roughness\": 0,\n },\n ],\n]\n\nfor i, iorp in enumerate(ior_params):\n color = iorp[0]\n params = iorp[1]\n center = [[0, -35 - (5 * i), 0]]\n for j in range(num_values):\n center[0][0] = -25 + 5 * j\n sphere = actor.sphere(center, color, radii=2, theta=32, phi=32)\n keys = list(params)\n params[keys[0]] = iors[j]\n material.manifest_pbr(sphere, **params)\n scene.add(sphere)" + "iors = np.round(np.linspace(1, 2.3, num=num_values), decimals=2)\n\nior_params = [\n [(0, 1, 1), {\"base_ior\": iors[0], \"roughness\": 0}],\n [\n (0, 1, 1),\n {\n \"coat_ior\": iors[0],\n \"coat_roughness\": 0.1,\n \"coat_strength\": 1,\n \"roughness\": 0,\n },\n ],\n]\n\nfor i, iorp in enumerate(ior_params):\n color = iorp[0]\n params = iorp[1]\n center = [[0, -35 - (5 * i), 0]]\n for j in range(num_values):\n center[0][0] = -25 + 5 * j\n sphere = fury.actor.sphere(center, color, radii=2, theta=32, phi=32)\n keys = list(params)\n params[keys[0]] = iors[j]\n fury.material.manifest_pbr(sphere, **params)\n scene.add(sphere)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "labels = [\"Base IoR\", \"Coat IoR\"]\n\nfor i, name in enumerate(labels):\n pos = [-40, -35 - (5 * i), 0]\n label = actor.vector_text(name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0))\n scene.add(label)\n\nfor j in range(num_values):\n pos = [-26 + 5 * j, -32, 0]\n label = actor.vector_text(\n \"{:.02f}\".format(iors[j]), pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)\n )\n scene.add(label)" + "labels = [\"Base IoR\", \"Coat IoR\"]\n\nfor i, name in enumerate(labels):\n pos = [-40, -35 - (5 * i), 0]\n label = fury.actor.vector_text(\n name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)\n )\n scene.add(label)\n\nfor j in range(num_values):\n pos = [-26 + 5 * j, -32, 0]\n label = fury.actor.vector_text(\n \"{:.02f}\".format(iors[j]), pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)\n )\n scene.add(label)" ] }, { @@ -141,7 +141,7 @@ }, "outputs": [], "source": [ - "interactive = False\nif interactive:\n window.show(scene)\n\nwindow.record(scene, size=(600, 600), out_path=\"viz_pbr_spheres.png\")" + "interactive = False\nif interactive:\n fury.window.show(scene)\n\nfury.window.record(scene, size=(600, 600), out_path=\"viz_pbr_spheres.png\")" ] } ], diff --git a/dev/_downloads/ed99262b8dc9297dcfb48d0a134bec54/viz_network.ipynb b/dev/_downloads/ed99262b8dc9297dcfb48d0a134bec54/viz_network.ipynb index b3e249c06..4e3fba34d 100644 --- a/dev/_downloads/ed99262b8dc9297dcfb48d0a134bec54/viz_network.ipynb +++ b/dev/_downloads/ed99262b8dc9297dcfb48d0a134bec54/viz_network.ipynb @@ -22,7 +22,7 @@ }, "outputs": [], "source": [ - "from os.path import join as pjoin\n\nimport numpy as np\n\nfrom fury import actor, colormap as cmap, window\nfrom fury.data import fetch_viz_wiki_nw" + "from os.path import join as pjoin\n\nimport numpy as np\n\nimport fury" ] }, { @@ -40,7 +40,7 @@ }, "outputs": [], "source": [ - "files, folder = fetch_viz_wiki_nw()\ncategories_file, edges_file, positions_file = sorted(files.keys())" + "files, folder = fury.data.fetch_viz_wiki_nw()\ncategories_file, edges_file, positions_file = sorted(files.keys())" ] }, { @@ -76,7 +76,7 @@ }, "outputs": [], "source": [ - "category2index = {category: i for i, category in enumerate(np.unique(categories))}\n\nindex2category = np.unique(categories)\n\ncategoryColors = cmap.distinguishable_colormap(nb_colors=len(index2category))\n\ncolors = np.array([categoryColors[category2index[category]] for category in categories])" + "category2index = {category: i for i, category in enumerate(np.unique(categories))}\n\nindex2category = np.unique(categories)\n\ncategoryColors = fury.colormap.distinguishable_colormap(nb_colors=len(index2category))\n\ncolors = np.array([categoryColors[category2index[category]] for category in categories])" ] }, { @@ -130,7 +130,7 @@ }, "outputs": [], "source": [ - "sphere_actor = actor.sphere(\n centers=positions,\n colors=colors,\n radii=radii * 0.5,\n theta=8,\n phi=8,\n)\n\nlines_actor = actor.line(\n edgesPositions,\n colors=edgesColors,\n opacity=0.1,\n)" + "sphere_actor = fury.actor.sphere(\n centers=positions,\n colors=colors,\n radii=radii * 0.5,\n theta=8,\n phi=8,\n)\n\nlines_actor = fury.actor.line(\n edgesPositions,\n colors=edgesColors,\n opacity=0.1,\n)" ] }, { @@ -148,7 +148,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\n\nscene.add(lines_actor)\nscene.add(sphere_actor)" + "scene = fury.window.Scene()\n\nscene.add(lines_actor)\nscene.add(sphere_actor)" ] }, { @@ -166,7 +166,7 @@ }, "outputs": [], "source": [ - "interactive = False\n\nif interactive:\n window.show(scene, size=(600, 600))\n\nwindow.record(scene, out_path=\"journal_networks.png\", size=(600, 600))" + "interactive = False\n\nif interactive:\n fury.window.show(scene, size=(600, 600))\n\nfury.window.record(scene, out_path=\"journal_networks.png\", size=(600, 600))" ] }, { diff --git a/dev/_downloads/edb95e013adc4d6a38a4673686c7cfc1/viz_shader.py b/dev/_downloads/edb95e013adc4d6a38a4673686c7cfc1/viz_shader.py index 19b1a36ba..479b42289 100644 --- a/dev/_downloads/edb95e013adc4d6a38a4673686c7cfc1/viz_shader.py +++ b/dev/_downloads/edb95e013adc4d6a38a4673686c7cfc1/viz_shader.py @@ -7,19 +7,17 @@ This example shows how to use shaders to generate a shaded output. We will demonstrate how to load polydata then use a custom shader calls to render a custom shaded model. -First, a bunch of imports. +First, let's import FURY """ -from fury import io, ui, utils, window -from fury.data.fetcher import fetch_viz_models, read_viz_models -from fury.shaders import add_shader_callback, shader_to_actor +import fury ############################################################################### # Let's download and load the model -fetch_viz_models() -model = read_viz_models("utah.obj") +fury.data.fetch_viz_models() +model = fury.data.read_viz_models("utah.obj") ############################################################################### @@ -28,9 +26,9 @@ # For this example we use the standard utah teapot model. # currently supported formats include OBJ, VTK, FIB, PLY, STL and XML -utah = io.load_polydata(model) -utah = utils.get_polymapper_from_polydata(utah) -utah = utils.get_actor_from_polymapper(utah) +utah = fury.io.load_polydata(model) +utah = fury.utils.get_polymapper_from_polydata(utah) +utah = fury.utils.get_actor_from_polymapper(utah) mapper = utah.GetMapper() @@ -58,16 +56,18 @@ fragOutput0 = vec4(col, fragOutput0.a); """ -shader_to_actor( +fury.shaders.shader_to_actor( utah, "vertex", impl_code=vertex_shader_code_impl, decl_code=vertex_shader_code_decl ) -shader_to_actor(utah, "fragment", decl_code=fragment_shader_code_decl) -shader_to_actor(utah, "fragment", impl_code=fragment_shader_code_impl, block="light") +fury.shaders.shader_to_actor(utah, "fragment", decl_code=fragment_shader_code_decl) +fury.shaders.shader_to_actor( + utah, "fragment", impl_code=fragment_shader_code_impl, block="light" +) ############################################################################### # Let's create a scene. -scene = window.Scene() +scene = fury.window.Scene() global timer timer = 0 @@ -98,11 +98,11 @@ def shader_callback(_caller, _event, calldata=None): pass -add_shader_callback(utah, shader_callback) +fury.shaders.add_shader_callback(utah, shader_callback) ############################################################################### # Let's add a textblock to the scene with a custom message -tb = ui.TextBlock2D() +tb = fury.ui.TextBlock2D() tb.message = "Hello Shaders" ############################################################################### @@ -112,7 +112,7 @@ def shader_callback(_caller, _event, calldata=None): # manager. current_size = (1024, 720) -showm = window.ShowManager(scene, size=current_size, reset_camera=False) +showm = fury.window.ShowManager(scene, size=current_size, reset_camera=False) showm.add_timer_callback(True, 30, timer_callback) @@ -124,4 +124,4 @@ def shader_callback(_caller, _event, calldata=None): if interactive: showm.start() -window.record(showm.scene, size=current_size, out_path="viz_shader.png") +fury.window.record(showm.scene, size=current_size, out_path="viz_shader.png") diff --git a/dev/_downloads/eec6c7e397f6bb2f6b871a05aa32751a/viz_sdfactor.ipynb b/dev/_downloads/eec6c7e397f6bb2f6b871a05aa32751a/viz_sdfactor.ipynb index de69cd9c0..d2bf10a8c 100644 --- a/dev/_downloads/eec6c7e397f6bb2f6b871a05aa32751a/viz_sdfactor.ipynb +++ b/dev/_downloads/eec6c7e397f6bb2f6b871a05aa32751a/viz_sdfactor.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import actor, window" + "import numpy as np\n\nimport fury" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "sdfactor = actor.sdf(\n centers=centers,\n directions=dirs,\n colors=colors,\n primitives=[\"sphere\", \"torus\", \"ellipsoid\", \"capsule\"],\n scales=scales,\n)" + "sdfactor = fury.actor.sdf(\n centers=centers,\n directions=dirs,\n colors=colors,\n primitives=[\"sphere\", \"torus\", \"ellipsoid\", \"capsule\"],\n scales=scales,\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.background((1.0, 0.8, 0.8))\nscene.add(sdfactor)" + "scene = fury.window.Scene()\nscene.background((1.0, 0.8, 0.8))\nscene.add(sdfactor)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "current_size = (1024, 720)\nshowm = window.ShowManager(scene, size=current_size, title=\"Visualize SDF Actor\")\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_sdfactor.png\", size=current_size)" + "current_size = (1024, 720)\nshowm = fury.window.ShowManager(scene, size=current_size, title=\"Visualize SDF Actor\")\n\ninteractive = False\n\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_sdfactor.png\", size=current_size)" ] } ], diff --git a/dev/_downloads/ef81dbce7a8fdf5d5ce02e1cdb7f5529/viz_domino.ipynb b/dev/_downloads/ef81dbce7a8fdf5d5ce02e1cdb7f5529/viz_domino.ipynb index d20a1f437..72f401c44 100644 --- a/dev/_downloads/ef81dbce7a8fdf5d5ce02e1cdb7f5529/viz_domino.ipynb +++ b/dev/_downloads/ef81dbce7a8fdf5d5ce02e1cdb7f5529/viz_domino.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import itertools\n\nimport numpy as np\nimport pybullet as p\n\nfrom fury import actor, ui, utils, window\n\n# Next, we initialize a pybullet client to render the physics.\n# We use `DIRECT` mode to initialize pybullet without a GUI.\nclient = p.connect(p.DIRECT)\n\n# Apply gravity to the scene.\np.setGravity(0, 0, -10, physicsClientId=client)" + "import itertools\n\nimport numpy as np\nimport pybullet as p\n\nimport fury\n\n# Next, we initialize a pybullet client to render the physics.\n# We use `DIRECT` mode to initialize pybullet without a GUI.\nclient = p.connect(p.DIRECT)\n\n# Apply gravity to the scene.\np.setGravity(0, 0, -10, physicsClientId=client)" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "number_of_dominoes = 10\n\n# Base Plane Parameters\nbase_size = np.array([number_of_dominoes * 2, number_of_dominoes * 2, 0.2])\nbase_color = np.array([1, 1, 1])\nbase_position = np.array([0, 0, -0.1])\nbase_orientation = np.array([0, 0, 0, 1])\n\n# Render a BASE plane to support the Dominoes.\nbase_actor = actor.box(\n centers=np.array([[0, 0, 0]]),\n directions=[0, 0, 0],\n scales=base_size,\n colors=base_color,\n)\n\n# half of the actual size.\nbase_coll = p.createCollisionShape(p.GEOM_BOX, halfExtents=base_size / 2)\n\nbase = p.createMultiBody(\n baseCollisionShapeIndex=base_coll,\n basePosition=base_position,\n baseOrientation=base_orientation,\n)\n\np.changeDynamics(base, -1, lateralFriction=1, restitution=0.5)" + "number_of_dominoes = 10\n\n# Base Plane Parameters\nbase_size = np.array([number_of_dominoes * 2, number_of_dominoes * 2, 0.2])\nbase_color = np.array([1, 1, 1])\nbase_position = np.array([0, 0, -0.1])\nbase_orientation = np.array([0, 0, 0, 1])\n\n# Render a BASE plane to support the Dominoes.\nbase_actor = fury.actor.box(\n centers=np.array([[0, 0, 0]]),\n directions=[0, 0, 0],\n scales=base_size,\n colors=base_color,\n)\n\n# half of the actual size.\nbase_coll = p.createCollisionShape(p.GEOM_BOX, halfExtents=base_size / 2)\n\nbase = p.createMultiBody(\n baseCollisionShapeIndex=base_coll,\n basePosition=base_position,\n baseOrientation=base_orientation,\n)\n\np.changeDynamics(base, -1, lateralFriction=1, restitution=0.5)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "domino_mass = 0.5\ndomino_size = np.array([0.1, 1, 2])\n\ndomino_centers = np.zeros((number_of_dominoes, 3))\n\n# Keeping all the dominos Parallel\ndomino_directions = np.zeros((number_of_dominoes, 3))\ndomino_directions[:] = np.array([1.57, 0, 0])\n\ndomino_orns = np.zeros((number_of_dominoes, 4))\n\ndomino_sizes = np.zeros((number_of_dominoes, 3))\ndomino_sizes[:] = domino_size\n\ndomino_colors = np.random.rand(number_of_dominoes, 3)\n\ndomino_coll = p.createCollisionShape(p.GEOM_BOX, halfExtents=domino_size / 2)\n\n# We use this array to store the reference of domino objects in pybullet world.\ndominos = np.zeros(number_of_dominoes, dtype=np.int8)\n\ncenters_list = np.zeros((number_of_dominoes, 3))\n\n# Adding the dominoes\nfor i in range(number_of_dominoes):\n center_pos = np.array([(i * 0.99) - 5.5, 0.4, 1])\n domino_centers[i] = center_pos\n domino_orns[i] = np.array([0, 0, 0, 1])\n dominos[i] = p.createMultiBody(\n baseMass=domino_mass,\n baseCollisionShapeIndex=domino_coll,\n basePosition=center_pos,\n baseOrientation=domino_orns[i],\n )\n p.changeDynamics(dominos[i], -1, lateralFriction=0.2, restitution=0.1)\n\n\ndomino_actor = actor.box(\n centers=domino_centers,\n directions=domino_directions,\n scales=domino_sizes,\n colors=domino_colors,\n)" + "domino_mass = 0.5\ndomino_size = np.array([0.1, 1, 2])\n\ndomino_centers = np.zeros((number_of_dominoes, 3))\n\n# Keeping all the dominos Parallel\ndomino_directions = np.zeros((number_of_dominoes, 3))\ndomino_directions[:] = np.array([1.57, 0, 0])\n\ndomino_orns = np.zeros((number_of_dominoes, 4))\n\ndomino_sizes = np.zeros((number_of_dominoes, 3))\ndomino_sizes[:] = domino_size\n\ndomino_colors = np.random.rand(number_of_dominoes, 3)\n\ndomino_coll = p.createCollisionShape(p.GEOM_BOX, halfExtents=domino_size / 2)\n\n# We use this array to store the reference of domino objects in pybullet world.\ndominos = np.zeros(number_of_dominoes, dtype=np.int8)\n\ncenters_list = np.zeros((number_of_dominoes, 3))\n\n# Adding the dominoes\nfor i in range(number_of_dominoes):\n center_pos = np.array([(i * 0.99) - 5.5, 0.4, 1])\n domino_centers[i] = center_pos\n domino_orns[i] = np.array([0, 0, 0, 1])\n dominos[i] = p.createMultiBody(\n baseMass=domino_mass,\n baseCollisionShapeIndex=domino_coll,\n basePosition=center_pos,\n baseOrientation=domino_orns[i],\n )\n p.changeDynamics(dominos[i], -1, lateralFriction=0.2, restitution=0.1)\n\n\ndomino_actor = fury.actor.box(\n centers=domino_centers,\n directions=domino_directions,\n scales=domino_sizes,\n colors=domino_colors,\n)" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.add(actor.axes())\nscene.add(base_actor)\nscene.add(domino_actor)\n\n# Create show manager.\nshowm = window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n\n# Counter iterator for tracking simulation steps.\ncounter = itertools.count()\n\n# Variable for tracking applied force.\napply_force = True" + "scene = fury.window.Scene()\nscene.add(fury.actor.axes())\nscene.add(base_actor)\nscene.add(domino_actor)\n\n# Create show manager.\nshowm = fury.window.ShowManager(\n scene, size=(900, 768), reset_camera=False, order_transparent=True\n)\n\n\n# Counter iterator for tracking simulation steps.\ncounter = itertools.count()\n\n# Variable for tracking applied force.\napply_force = True" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "# Get the position of base and set it.\nbase_pos, _ = p.getBasePositionAndOrientation(base)\nbase_actor.SetPosition(*base_pos)\n\n\n# Calculate the vertices of the dominos.\nvertices = utils.vertices_from_actor(domino_actor)\nnum_vertices = vertices.shape[0]\nnum_objects = domino_centers.shape[0]\nsec = int(num_vertices / num_objects)" + "# Get the position of base and set it.\nbase_pos, _ = p.getBasePositionAndOrientation(base)\nbase_actor.SetPosition(*base_pos)\n\n\n# Calculate the vertices of the dominos.\nvertices = fury.utils.vertices_from_actor(domino_actor)\nnum_vertices = vertices.shape[0]\nnum_objects = domino_centers.shape[0]\nsec = int(num_vertices / num_objects)" ] }, { @@ -123,7 +123,7 @@ }, "outputs": [], "source": [ - "fpss = np.array([])\ntb = ui.TextBlock2D(\n text=\"Avg. FPS: \\nSim Steps: \", position=(0, 680), font_size=30, color=(1, 0.5, 0)\n)\nscene.add(tb)" + "fpss = np.array([])\ntb = fury.ui.TextBlock2D(\n text=\"Avg. FPS: \\nSim Steps: \", position=(0, 680), font_size=30, color=(1, 0.5, 0)\n)\nscene.add(tb)" ] }, { @@ -159,7 +159,7 @@ }, "outputs": [], "source": [ - "# Create timer callback which will execute at each step of simulation.\ndef timer_callback(_obj, _event):\n global apply_force, fpss\n cnt = next(counter)\n showm.render()\n\n if cnt % 1 == 0:\n fps = showm.frame_rate\n fpss = np.append(fpss, fps)\n tb.message = (\n \"Avg. FPS: \" + str(np.round(np.mean(fpss), 0)) + \"\\nSim Steps: \" + str(cnt)\n )\n\n # Get the position and orientation of the first domino.\n domino1_pos, domino1_orn = p.getBasePositionAndOrientation(dominos[0])\n\n # Apply force on the First Domino (domino) above the Center of Mass.\n if apply_force:\n # Apply the force.\n p.applyExternalForce(\n dominos[0],\n -1,\n forceObj=[100, 0, 0],\n posObj=domino1_pos + np.array([0, 0, 1.7]),\n flags=p.WORLD_FRAME,\n )\n apply_force = False\n\n # Updating the position and orientation of individual dominos.\n for idx, domino in enumerate(dominos):\n sync_domino(idx, domino)\n utils.update_actor(domino_actor)\n\n # Simulate a step.\n p.stepSimulation()\n\n # Exit after 300 steps of simulation.\n if cnt == 300:\n showm.exit()\n\n\n# Add the timer callback to showmanager.\n# Increasing the duration value will slow down the simulation.\nshowm.add_timer_callback(True, 1, timer_callback)\n\ninteractive = False\n\n# start simulation\nif interactive:\n showm.start()\n\nwindow.record(scene, out_path=\"viz_domino.png\", size=(900, 768))" + "# Create timer callback which will execute at each step of simulation.\ndef timer_callback(_obj, _event):\n global apply_force, fpss\n cnt = next(counter)\n showm.render()\n\n if cnt % 1 == 0:\n fps = showm.frame_rate\n fpss = np.append(fpss, fps)\n tb.message = (\n \"Avg. FPS: \" + str(np.round(np.mean(fpss), 0)) + \"\\nSim Steps: \" + str(cnt)\n )\n\n # Get the position and orientation of the first domino.\n domino1_pos, domino1_orn = p.getBasePositionAndOrientation(dominos[0])\n\n # Apply force on the First Domino (domino) above the Center of Mass.\n if apply_force:\n # Apply the force.\n p.applyExternalForce(\n dominos[0],\n -1,\n forceObj=[100, 0, 0],\n posObj=domino1_pos + np.array([0, 0, 1.7]),\n flags=p.WORLD_FRAME,\n )\n apply_force = False\n\n # Updating the position and orientation of individual dominos.\n for idx, domino in enumerate(dominos):\n sync_domino(idx, domino)\n fury.utils.update_actor(domino_actor)\n\n # Simulate a step.\n p.stepSimulation()\n\n # Exit after 300 steps of simulation.\n if cnt == 300:\n showm.exit()\n\n\n# Add the timer callback to showmanager.\n# Increasing the duration value will slow down the simulation.\nshowm.add_timer_callback(True, 1, timer_callback)\n\ninteractive = False\n\n# start simulation\nif interactive:\n showm.start()\n\nfury.window.record(scene, out_path=\"viz_domino.png\", size=(900, 768))" ] } ], diff --git a/dev/_downloads/f04511f11775c06091bec37717652f01/viz_shapes.ipynb b/dev/_downloads/f04511f11775c06091bec37717652f01/viz_shapes.ipynb index 986ef6d7f..ffc3e2bfd 100644 --- a/dev/_downloads/f04511f11775c06091bec37717652f01/viz_shapes.ipynb +++ b/dev/_downloads/f04511f11775c06091bec37717652f01/viz_shapes.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from fury import ui, window\nfrom fury.data import fetch_viz_icons" + "import fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "fetch_viz_icons()" + "fury.data.fetch_viz_icons()" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "rect = ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1))" + "rect = fury.ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "disk = ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0))" + "disk = fury.ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0))" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1))" + "ring = fury.ui.Disk2D(\n outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1)\n)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "current_size = (800, 800)\nshow_manager = window.ShowManager(size=current_size, title=\"FURY Shapes Example\")\n\nshow_manager.scene.add(rect)\nshow_manager.scene.add(disk)\nshow_manager.scene.add(ring)\n\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nwindow.record(show_manager.scene, size=current_size, out_path=\"viz_shapes.png\")" + "current_size = (800, 800)\nshow_manager = fury.window.ShowManager(size=current_size, title=\"FURY Shapes Example\")\n\nshow_manager.scene.add(rect)\nshow_manager.scene.add(disk)\nshow_manager.scene.add(ring)\n\ninteractive = False\n\nif interactive:\n show_manager.start()\n\nfury.window.record(show_manager.scene, size=current_size, out_path=\"viz_shapes.png\")" ] } ], diff --git a/dev/_downloads/f3c12cee7268b7b98cd3da9316478888/viz_interaction.ipynb b/dev/_downloads/f3c12cee7268b7b98cd3da9316478888/viz_interaction.ipynb index 7491faa84..1bfaf31fd 100644 --- a/dev/_downloads/f3c12cee7268b7b98cd3da9316478888/viz_interaction.ipynb +++ b/dev/_downloads/f3c12cee7268b7b98cd3da9316478888/viz_interaction.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import multiprocessing\nimport sys\n\nimport numpy as np\n\nfrom fury import actor, window\nfrom fury.stream.client import FuryStreamClient, FuryStreamInteraction\n\n# if this example it's not working for you and you're using MacOs\n# uncomment the following line\n# multiprocessing.set_start_method('spawn')\nfrom fury.stream.server.main import WEBRTC_AVAILABLE, web_server, web_server_raw_array\n\nif __name__ == \"__main__\":\n interactive = False\n # `use_raw_array` is a flag to tell the server to use python RawArray\n # instead of SharedMemory which is a new feature in python 3.8\n # https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array\n # https://docs.python.org/3/library/multiprocessing.html#shared-memory-objects\n\n use_raw_array = sys.version_info < (3, 8)\n window_size = (300, 300)\n # `max_window_size` are the maximum size of the window that will be\n # allowed to be sent to the browser. For example, if you set\n # `max_window_size=(800, 800)` then the browser will be limited to\n # a window of size (800, 800).\n\n max_window_size = (400, 400)\n # 0 ms_stream means that the frame will be sent to the server\n # right after the rendering\n\n # `ms_interaction` is the time in milliseconds that the user will have\n # to interact with the visualization\n\n ms_interaction = 1\n # `ms_stream` is the number of milliseconds that the server will\n # wait before sending a new frame to the browser. If `ms_stream=0`\n # then the server will send the frame right after the rendering.\n\n ms_stream = 0\n # max number of interactions to be stored inside the queue\n max_queue_size = 17\n ######################################################################\n centers = np.array([[0, 0, 0], [-1, 0, 0], [1, 0, 0]])\n colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n\n actors = actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)\n scene = window.Scene()\n\n scene.add(actors)\n\n showm = window.ShowManager(scene, size=(window_size[0], window_size[1]))\n\n stream = FuryStreamClient(\n showm, max_window_size=max_window_size, use_raw_array=use_raw_array\n )\n stream_interaction = FuryStreamInteraction(\n showm, max_queue_size=max_queue_size, use_raw_array=use_raw_array\n )\n\n if use_raw_array:\n p = multiprocessing.Process(\n target=web_server_raw_array,\n args=(\n stream.img_manager.image_buffers,\n stream.img_manager.info_buffer,\n stream_interaction.circular_queue.head_tail_buffer,\n stream_interaction.circular_queue.buffer._buffer,\n 8000,\n \"localhost\",\n True,\n WEBRTC_AVAILABLE,\n ),\n )\n\n else:\n p = multiprocessing.Process(\n target=web_server,\n args=(\n stream.img_manager.image_buffer_names,\n stream.img_manager.info_buffer_name,\n stream_interaction.circular_queue.head_tail_buffer_name,\n stream_interaction.circular_queue.buffer.buffer_name,\n 8000,\n \"localhost\",\n True,\n WEBRTC_AVAILABLE,\n ),\n )\n p.start()\n stream_interaction.start(ms=ms_interaction)\n stream.start(\n ms_stream,\n )\n ###########################################################################\n # If you have aiortc in your system, you can see your live streaming\n # through the following url: htttp://localhost:8000/?encoding=webrtc\n # Other wise, you can use the following url:\n # http://localhost:8000/?encoding=mjpeg\n\n if interactive:\n showm.start()\n\n # We need to close the server after the show is over\n p.kill()\n ###########################################################################\n # We release the resources and stop the interactive mode\n stream.stop()\n stream_interaction.stop()\n stream.cleanup()\n stream_interaction.cleanup()\n\n window.record(showm.scene, size=window_size, out_path=\"viz_interaction.png\")" + "import multiprocessing\nimport sys\n\nimport numpy as np\n\nimport fury\n\n# if this example it's not working for you and you're using MacOs\n# uncomment the following line\n# multiprocessing.set_start_method('spawn')\n\nif __name__ == \"__main__\":\n interactive = False\n # `use_raw_array` is a flag to tell the server to use python RawArray\n # instead of SharedMemory which is a new feature in python 3.8\n # https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array\n # https://docs.python.org/3/library/multiprocessing.html#shared-memory-objects\n\n use_raw_array = sys.version_info < (3, 8)\n window_size = (300, 300)\n # `max_window_size` are the maximum size of the window that will be\n # allowed to be sent to the browser. For example, if you set\n # `max_window_size=(800, 800)` then the browser will be limited to\n # a window of size (800, 800).\n\n max_window_size = (400, 400)\n # 0 ms_stream means that the frame will be sent to the server\n # right after the rendering\n\n # `ms_interaction` is the time in milliseconds that the user will have\n # to interact with the visualization\n\n ms_interaction = 1\n # `ms_stream` is the number of milliseconds that the server will\n # wait before sending a new frame to the browser. If `ms_stream=0`\n # then the server will send the frame right after the rendering.\n\n ms_stream = 0\n # max number of interactions to be stored inside the queue\n max_queue_size = 17\n ######################################################################\n centers = np.array([[0, 0, 0], [-1, 0, 0], [1, 0, 0]])\n colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n\n actors = fury.actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)\n scene = fury.window.Scene()\n\n scene.add(actors)\n\n showm = fury.window.ShowManager(scene, size=(window_size[0], window_size[1]))\n\n stream = fury.stream.FuryStreamClient(\n showm, max_window_size=max_window_size, use_raw_array=use_raw_array\n )\n stream_interaction = fury.stream.client.FuryStreamInteraction(\n showm, max_queue_size=max_queue_size, use_raw_array=use_raw_array\n )\n\n if use_raw_array:\n p = multiprocessing.Process(\n target=fury.stream.server.web_server_raw_array,\n args=(\n stream.img_manager.image_buffers,\n stream.img_manager.info_buffer,\n stream_interaction.circular_queue.head_tail_buffer,\n stream_interaction.circular_queue.buffer._buffer,\n 8000,\n \"localhost\",\n True,\n fury.stream.server.main.WEBRTC_AVAILABLE,\n ),\n )\n\n else:\n p = multiprocessing.Process(\n target=fury.stream.server.web_server,\n args=(\n stream.img_manager.image_buffer_names,\n stream.img_manager.info_buffer_name,\n stream_interaction.circular_queue.head_tail_buffer_name,\n stream_interaction.circular_queue.buffer.buffer_name,\n 8000,\n \"localhost\",\n True,\n fury.stream.server.main.WEBRTC_AVAILABLE,\n ),\n )\n p.start()\n stream_interaction.start(ms=ms_interaction)\n stream.start(\n ms_stream,\n )\n ###########################################################################\n # If you have aiortc in your system, you can see your live streaming\n # through the following url: htttp://localhost:8000/?encoding=webrtc\n # Other wise, you can use the following url:\n # http://localhost:8000/?encoding=mjpeg\n\n if interactive:\n showm.start()\n\n # We need to close the server after the show is over\n p.kill()\n ###########################################################################\n # We release the resources and stop the interactive mode\n stream.stop()\n stream_interaction.stop()\n stream.cleanup()\n stream_interaction.cleanup()\n\n fury.window.record(showm.scene, size=window_size, out_path=\"viz_interaction.png\")" ] } ], diff --git a/dev/_downloads/f4c4ff3a5276191c800c59f6da1b84df/viz_no_interaction.ipynb b/dev/_downloads/f4c4ff3a5276191c800c59f6da1b84df/viz_no_interaction.ipynb index 3e40b920f..24f8990ca 100644 --- a/dev/_downloads/f4c4ff3a5276191c800c59f6da1b84df/viz_no_interaction.ipynb +++ b/dev/_downloads/f4c4ff3a5276191c800c59f6da1b84df/viz_no_interaction.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import multiprocessing\nfrom os.path import join as pjoin\n\n# if this example it's not working for you and you're using MacOs\n# uncomment the following line\n# multiprocessing.set_start_method('spawn')\nimport numpy as np\n\nfrom fury import actor, colormap as cmap, window\nfrom fury.data.fetcher import fetch_viz_wiki_nw\nfrom fury.stream.client import FuryStreamClient\nfrom fury.stream.server.main import web_server_raw_array\n\nif __name__ == \"__main__\":\n interactive = False\n ###########################################################################\n # First we will set the resolution which it'll be used by the streamer\n\n window_size = (400, 400)\n\n files, folder = fetch_viz_wiki_nw()\n categories_file, edges_file, positions_file = sorted(files.keys())\n positions = np.loadtxt(pjoin(folder, positions_file))\n categories = np.loadtxt(pjoin(folder, categories_file), dtype=str)\n edges = np.loadtxt(pjoin(folder, edges_file), dtype=int)\n category2index = {category: i for i, category in enumerate(np.unique(categories))}\n\n index2category = np.unique(categories)\n\n categoryColors = cmap.distinguishable_colormap(nb_colors=len(index2category))\n\n colors = np.array(\n [categoryColors[category2index[category]] for category in categories]\n )\n radii = 1 + np.random.rand(len(positions))\n\n edgesPositions = []\n edgesColors = []\n for source, target in edges:\n edgesPositions.append(np.array([positions[source], positions[target]]))\n edgesColors.append(np.array([colors[source], colors[target]]))\n\n edgesPositions = np.array(edgesPositions)\n edgesColors = np.average(np.array(edgesColors), axis=1)\n\n sphere_actor = actor.sdf(\n centers=positions,\n colors=colors,\n primitives=\"sphere\",\n scales=radii * 0.5,\n )\n\n lines_actor = actor.line(\n edgesPositions,\n colors=edgesColors,\n opacity=0.1,\n )\n scene = window.Scene()\n\n scene.add(lines_actor)\n scene.add(sphere_actor)\n\n scene.set_camera(\n position=(0, 0, 1000), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n )\n\n showm = window.ShowManager(\n scene,\n reset_camera=False,\n size=(window_size[0], window_size[1]),\n order_transparent=False,\n )\n\n ###########################################################################\n # ms define the amount of mileseconds that will be used in the timer event.\n\n ms = 0\n\n stream = FuryStreamClient(showm, use_raw_array=True)\n p = multiprocessing.Process(\n target=web_server_raw_array,\n args=(\n stream.img_manager.image_buffers,\n stream.img_manager.info_buffer,\n ),\n )\n p.start()\n\n stream.start(\n ms,\n )\n if interactive:\n showm.start()\n stream.stop()\n stream.cleanup()\n\n window.record(showm.scene, size=window_size, out_path=\"viz_no_interaction.png\")" + "import multiprocessing\nfrom os.path import join as pjoin\n\n# if this example it's not working for you and you're using MacOs\n# uncomment the following line\n# multiprocessing.set_start_method('spawn')\nimport numpy as np\n\nimport fury\n\nif __name__ == \"__main__\":\n interactive = False\n ###########################################################################\n # First we will set the resolution which it'll be used by the streamer\n\n window_size = (400, 400)\n\n files, folder = fury.data.fetch_viz_wiki_nw()\n categories_file, edges_file, positions_file = sorted(files.keys())\n positions = np.loadtxt(pjoin(folder, positions_file))\n categories = np.loadtxt(pjoin(folder, categories_file), dtype=str)\n edges = np.loadtxt(pjoin(folder, edges_file), dtype=int)\n category2index = {category: i for i, category in enumerate(np.unique(categories))}\n\n index2category = np.unique(categories)\n\n categoryColors = fury.colormap.distinguishable_colormap(\n nb_colors=len(index2category)\n )\n\n colors = np.array(\n [categoryColors[category2index[category]] for category in categories]\n )\n radii = 1 + np.random.rand(len(positions))\n\n edgesPositions = []\n edgesColors = []\n for source, target in edges:\n edgesPositions.append(np.array([positions[source], positions[target]]))\n edgesColors.append(np.array([colors[source], colors[target]]))\n\n edgesPositions = np.array(edgesPositions)\n edgesColors = np.average(np.array(edgesColors), axis=1)\n\n sphere_actor = fury.actor.sdf(\n centers=positions,\n colors=colors,\n primitives=\"sphere\",\n scales=radii * 0.5,\n )\n\n lines_actor = fury.actor.line(\n edgesPositions,\n colors=edgesColors,\n opacity=0.1,\n )\n scene = fury.window.Scene()\n\n scene.add(lines_actor)\n scene.add(sphere_actor)\n\n scene.set_camera(\n position=(0, 0, 1000), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)\n )\n\n showm = fury.window.ShowManager(\n scene,\n reset_camera=False,\n size=(window_size[0], window_size[1]),\n order_transparent=False,\n )\n\n ###########################################################################\n # ms define the amount of mileseconds that will be used in the timer event.\n\n ms = 0\n\n stream = fury.stream.FuryStreamClient(showm, use_raw_array=True)\n p = multiprocessing.Process(\n target=fury.stream.server.web_server_raw_array,\n args=(\n stream.img_manager.image_buffers,\n stream.img_manager.info_buffer,\n ),\n )\n p.start()\n\n stream.start(\n ms,\n )\n if interactive:\n showm.start()\n stream.stop()\n stream.cleanup()\n\n fury.window.record(showm.scene, size=window_size, out_path=\"viz_no_interaction.png\")" ] } ], diff --git a/dev/_downloads/f54a755b14024717d17d6061e7b4328c/viz_widget.zip b/dev/_downloads/f54a755b14024717d17d6061e7b4328c/viz_widget.zip index ee06c940f..65b8d13ce 100644 Binary files a/dev/_downloads/f54a755b14024717d17d6061e7b4328c/viz_widget.zip and b/dev/_downloads/f54a755b14024717d17d6061e7b4328c/viz_widget.zip differ diff --git a/dev/_downloads/f5e1926c83f933b9b5ab0716ab98ddc6/viz_roi_contour.ipynb b/dev/_downloads/f5e1926c83f933b9b5ab0716ab98ddc6/viz_roi_contour.ipynb index 0b400bcbe..d2c21f815 100644 --- a/dev/_downloads/f5e1926c83f933b9b5ab0716ab98ddc6/viz_roi_contour.ipynb +++ b/dev/_downloads/f5e1926c83f933b9b5ab0716ab98ddc6/viz_roi_contour.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from dipy.data import default_sphere, read_stanford_labels\nfrom dipy.direction import peaks_from_model\nfrom dipy.reconst.shm import CsaOdfModel\n\ntry:\n from dipy.tracking.local import (\n LocalTracking,\n ThresholdTissueClassifier as ThresholdStoppingCriterion,\n )\nexcept ImportError:\n from dipy.tracking.local_tracking import LocalTracking\n from dipy.tracking.stopping_criterion import ThresholdStoppingCriterion\n\nfrom dipy.tracking import utils\nfrom dipy.tracking.streamline import Streamlines\n\nfrom fury import actor, window\nfrom fury.colormap import line_colors" + "from dipy.data import default_sphere, read_stanford_labels\nfrom dipy.direction import peaks_from_model\nfrom dipy.reconst.shm import CsaOdfModel\n\ntry:\n from dipy.tracking.local import (\n LocalTracking,\n ThresholdTissueClassifier as ThresholdStoppingCriterion,\n )\nexcept ImportError:\n from dipy.tracking.local_tracking import LocalTracking\n from dipy.tracking.stopping_criterion import ThresholdStoppingCriterion\n\nfrom dipy.tracking import utils\nfrom dipy.tracking.streamline import Streamlines\n\nimport fury" ] }, { @@ -33,7 +33,7 @@ }, "outputs": [], "source": [ - "hardi_img, gtab, labels_img = read_stanford_labels()\ndata = hardi_img.get_fdata()\nlabels = labels_img.get_fdata()\naffine = hardi_img.affine\n\nwhite_matter = (labels == 1) | (labels == 2)\n\ncsa_model = CsaOdfModel(gtab, sh_order=6)\ncsa_peaks = peaks_from_model(\n csa_model,\n data,\n default_sphere,\n relative_peak_threshold=0.8,\n min_separation_angle=45,\n mask=white_matter,\n)\n\nclassifier = ThresholdStoppingCriterion(csa_peaks.gfa, 0.25)\n\nseed_mask = labels == 2\nseeds = utils.seeds_from_mask(seed_mask, density=[1, 1, 1], affine=affine)\n\n# Initialization of LocalTracking. The computation happens in the next step.\nstreamlines = LocalTracking(csa_peaks, classifier, seeds, affine, step_size=2)\n\n# Compute streamlines and store as a list.\nstreamlines = Streamlines(streamlines)" + "hardi_img, gtab, labels_img = read_stanford_labels()\ndata = hardi_img.get_fdata()\nlabels = labels_img.get_fdata()\naffine = hardi_img.affine\n\nwhite_matter = (labels == 1) | (labels == 2)\n\ncsa_model = CsaOdfModel(gtab, sh_order_max=6)\ncsa_peaks = peaks_from_model(\n csa_model,\n data,\n default_sphere,\n relative_peak_threshold=0.8,\n min_separation_angle=45,\n mask=white_matter,\n)\n\nclassifier = ThresholdStoppingCriterion(csa_peaks.gfa, 0.25)\n\nseed_mask = labels == 2\nseeds = utils.seeds_from_mask(seed_mask, density=[1, 1, 1], affine=affine)\n\n# Initialization of LocalTracking. The computation happens in the next step.\nstreamlines = LocalTracking(csa_peaks, classifier, seeds, affine, step_size=2)\n\n# Compute streamlines and store as a list.\nstreamlines = Streamlines(streamlines)" ] }, { @@ -51,7 +51,7 @@ }, "outputs": [], "source": [ - "streamlines_actor = actor.line(streamlines, line_colors(streamlines))" + "streamlines_actor = fury.actor.line(streamlines, fury.colormap.line_colors(streamlines))" ] }, { @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "surface_opacity = 0.5\nsurface_color = [0, 1, 1]\n\nseedroi_actor = actor.contour_from_roi(\n seed_mask, affine, surface_color, surface_opacity\n)" + "surface_opacity = 0.5\nsurface_color = [0, 1, 1]\n\nseedroi_actor = fury.actor.contour_from_roi(\n seed_mask, affine, surface_color, surface_opacity\n)" ] }, { @@ -87,7 +87,7 @@ }, "outputs": [], "source": [ - "scene = window.Scene()\nscene.add(streamlines_actor)\nscene.add(seedroi_actor)" + "scene = fury.window.Scene()\nscene.add(streamlines_actor)\nscene.add(seedroi_actor)" ] }, { @@ -105,7 +105,7 @@ }, "outputs": [], "source": [ - "interactive = False\nif interactive:\n window.show(scene)\n\n# scene.zoom(1.5)\n# scene.reset_clipping_range()\n\nwindow.record(scene, out_path=\"contour_from_roi_tutorial.png\", size=(600, 600))" + "interactive = False\nif interactive:\n fury.window.show(scene)\n\n# scene.zoom(1.5)\n# scene.reset_clipping_range()\n\nfury.window.record(scene, out_path=\"contour_from_roi_tutorial.png\", size=(600, 600))" ] } ], diff --git a/dev/_downloads/f6c74ed2b80a42dbcfd21ad12baaf70e/viz_color_interpolators.zip b/dev/_downloads/f6c74ed2b80a42dbcfd21ad12baaf70e/viz_color_interpolators.zip index 27a97eff1..6b81edd22 100644 Binary files a/dev/_downloads/f6c74ed2b80a42dbcfd21ad12baaf70e/viz_color_interpolators.zip and b/dev/_downloads/f6c74ed2b80a42dbcfd21ad12baaf70e/viz_color_interpolators.zip differ diff --git a/dev/_downloads/f9f62a24481b5d20bf43c8d281622e69/viz_ui_slider.zip b/dev/_downloads/f9f62a24481b5d20bf43c8d281622e69/viz_ui_slider.zip index ffe5c11d9..1696aa609 100644 Binary files a/dev/_downloads/f9f62a24481b5d20bf43c8d281622e69/viz_ui_slider.zip and b/dev/_downloads/f9f62a24481b5d20bf43c8d281622e69/viz_ui_slider.zip differ diff --git a/dev/_downloads/fa55619f2d90539d7973ba4b4718f670/viz_brownian_motion.zip b/dev/_downloads/fa55619f2d90539d7973ba4b4718f670/viz_brownian_motion.zip index e49845bf9..1a785efdc 100644 Binary files a/dev/_downloads/fa55619f2d90539d7973ba4b4718f670/viz_brownian_motion.zip and b/dev/_downloads/fa55619f2d90539d7973ba4b4718f670/viz_brownian_motion.zip differ diff --git a/dev/_downloads/fc9197994069181d3183d289ea25d40c/viz_spiky.py b/dev/_downloads/fc9197994069181d3183d289ea25d40c/viz_spiky.py index 3ab10c87c..a8de7e3ca 100644 --- a/dev/_downloads/fc9197994069181d3183d289ea25d40c/viz_spiky.py +++ b/dev/_downloads/fc9197994069181d3183d289ea25d40c/viz_spiky.py @@ -9,7 +9,7 @@ import numpy as np -from fury import actor, primitive, utils, window +import fury ############################################################################## # Create a sphere actor. Define the center, radius and color of a sphere. @@ -17,27 +17,27 @@ # sphere. # Let's create a scene. -scene = window.Scene() +scene = fury.window.Scene() ############################################################################## # The vertices are connected with triangles in order to specify the direction # of the surface normal. # ``prim_sphere`` provides a sphere with evenly distributed points -vertices, triangles = primitive.prim_sphere(name="symmetric362", gen_faces=False) +vertices, triangles = fury.primitive.prim_sphere(name="symmetric362", gen_faces=False) ############################################################################## # To be able to visualize the vertices, let's define a point actor with # green color. -point_actor = actor.point(vertices, point_radius=0.01, colors=(0, 1, 0)) +point_actor = fury.actor.point(vertices, point_radius=0.01, colors=(0, 1, 0)) ############################################################################## # Normals are the vectors that are perpendicular to the surface at each # vertex. We specify the normals at the vertices to tell the system # whether triangles represent curved surfaces. -normals = utils.normals_from_v_f(vertices, triangles) +normals = fury.utils.normals_from_v_f(vertices, triangles) ############################################################################## # The normals are usually used to calculate how the light will bounce on @@ -45,7 +45,7 @@ # spikes (represented with arrows). # So, let's create an arrow actor at the center of each vertex. -arrow_actor = actor.arrow( +arrow_actor = fury.actor.arrow( centers=vertices, directions=normals, colors=(1, 0, 0), @@ -61,7 +61,7 @@ primitive_colors = np.zeros(vertices.shape) primitive_colors[:, 2] = 180 -primitive_actor = utils.get_actor_from_primitive( +primitive_actor = fury.utils.get_actor_from_primitive( vertices=vertices, triangles=triangles, colors=primitive_colors, @@ -75,13 +75,13 @@ scene.add(point_actor) scene.add(arrow_actor) scene.add(primitive_actor) -scene.add(actor.axes()) +scene.add(fury.actor.axes()) ############################################################################## # The ShowManager class is the interface between the scene, the window and the # interactor. -showm = window.ShowManager( +showm = fury.window.ShowManager( scene, size=(900, 768), reset_camera=False, order_transparent=True ) @@ -108,7 +108,7 @@ def timer_callback(_obj, _event): showm.add_timer_callback(True, 200, timer_callback) showm.start() -window.record(showm.scene, size=(900, 768), out_path="viz_spiky.png") +fury.window.record(showm.scene, size=(900, 768), out_path="viz_spiky.png") ############################################################################## # Instead of arrows, you can choose other geometrical objects diff --git a/dev/_downloads/fe1f98d7a39804ac8d327e9dc5f3deeb/viz_surfaces.zip b/dev/_downloads/fe1f98d7a39804ac8d327e9dc5f3deeb/viz_surfaces.zip index 03c02483d..aef57dded 100644 Binary files a/dev/_downloads/fe1f98d7a39804ac8d327e9dc5f3deeb/viz_surfaces.zip and b/dev/_downloads/fe1f98d7a39804ac8d327e9dc5f3deeb/viz_surfaces.zip differ diff --git a/dev/_downloads/ff3034e7477e72f293a2b90710745b59/viz_surfaces.ipynb b/dev/_downloads/ff3034e7477e72f293a2b90710745b59/viz_surfaces.ipynb index e6f3a640b..983bebecd 100644 --- a/dev/_downloads/ff3034e7477e72f293a2b90710745b59/viz_surfaces.ipynb +++ b/dev/_downloads/ff3034e7477e72f293a2b90710745b59/viz_surfaces.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "import numpy as np\n\nfrom fury import utils, window\nfrom fury.io import load_polydata, save_polydata\nfrom fury.lib import PolyData" + "import numpy as np\n\nimport fury" ] }, { @@ -40,7 +40,7 @@ }, "outputs": [], "source": [ - "my_polydata = PolyData()" + "my_polydata = fury.lib.PolyData()" ] }, { @@ -76,7 +76,7 @@ }, "outputs": [], "source": [ - "utils.set_polydata_vertices(my_polydata, my_vertices)\nutils.set_polydata_triangles(my_polydata, my_triangles)" + "fury.utils.set_polydata_vertices(my_polydata, my_vertices)\nfury.utils.set_polydata_triangles(my_polydata, my_triangles)" ] }, { @@ -94,7 +94,7 @@ }, "outputs": [], "source": [ - "file_name = \"my_cube.vtk\"\nsave_polydata(my_polydata, file_name)\nprint(\"Surface saved in \" + file_name)" + "file_name = \"my_cube.vtk\"\nfury.io.save_polydata(my_polydata, file_name)\nprint(\"Surface saved in \" + file_name)" ] }, { @@ -112,7 +112,7 @@ }, "outputs": [], "source": [ - "cube_polydata = load_polydata(file_name)" + "cube_polydata = fury.io.load_polydata(file_name)" ] }, { @@ -130,7 +130,7 @@ }, "outputs": [], "source": [ - "cube_vertices = utils.get_polydata_vertices(cube_polydata)\ncolors = cube_vertices * 255\nutils.set_polydata_colors(cube_polydata, colors)\n\nprint(\"new surface colors\")\nprint(utils.get_polydata_colors(cube_polydata))" + "cube_vertices = fury.utils.get_polydata_vertices(cube_polydata)\ncolors = cube_vertices * 255\nfury.utils.set_polydata_colors(cube_polydata, colors)\n\nprint(\"new surface colors\")\nprint(fury.utils.get_polydata_colors(cube_polydata))" ] }, { @@ -148,7 +148,7 @@ }, "outputs": [], "source": [ - "# get Actor\ncube_actor = utils.get_actor_from_polydata(cube_polydata)\n\n# Create a scene\nscene = window.Scene()\nscene.add(cube_actor)\nscene.set_camera(position=(10, 5, 7), focal_point=(0.5, 0.5, 0.5))\nscene.zoom(3)\n\n# display\n# window.show(scene, size=(600, 600), reset_camera=False)\nwindow.record(scene, out_path=\"cube.png\", size=(600, 600))" + "# get Actor\ncube_actor = fury.utils.get_actor_from_polydata(cube_polydata)\n\n# Create a scene\nscene = fury.window.Scene()\nscene.add(cube_actor)\nscene.set_camera(position=(10, 5, 7), focal_point=(0.5, 0.5, 0.5))\nscene.zoom(3)\n\n# display\n# fury.window.show(scene, size=(600, 600), reset_camera=False)\nfury.window.record(scene, out_path=\"cube.png\", size=(600, 600))" ] } ], diff --git a/dev/_downloads/ffa4e0d820db0e3014fe671edf8578ac/viz_fiber_odf.zip b/dev/_downloads/ffa4e0d820db0e3014fe671edf8578ac/viz_fiber_odf.zip index 37c12f9e7..9f11e7745 100644 Binary files a/dev/_downloads/ffa4e0d820db0e3014fe671edf8578ac/viz_fiber_odf.zip and b/dev/_downloads/ffa4e0d820db0e3014fe671edf8578ac/viz_fiber_odf.zip differ diff --git a/dev/_modules/fury.html b/dev/_modules/fury.html index 7c0acb15f..916df6824 100644 --- a/dev/_modules/fury.html +++ b/dev/_modules/fury.html @@ -7,7 +7,7 @@
-
from functools import partial
import os
-from fury import enable_warnings
+import fury
from fury.decorators import warn_on_args_to_kwargs
from fury.deprecator import deprecate_with_version
from fury.io import load_text
@@ -628,7 +628,7 @@ Source code for fury.shaders.base
impl_code = block_impl + "\n" + impl_code
if debug:
- enable_warnings()
+ fury.enable_warnings()
error_msg = "\n\n--- DEBUG: THIS LINE GENERATES AN ERROR ---\n\n"
impl_code += error_msg
diff --git a/dev/_modules/fury/stream/client.html b/dev/_modules/fury/stream/client.html
index 06f399103..1e7ab9bc0 100644
--- a/dev/_modules/fury/stream/client.html
+++ b/dev/_modules/fury/stream/client.html
@@ -7,7 +7,7 @@
- fury.stream.client — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.stream.client — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/stream/server/async_app.html b/dev/_modules/fury/stream/server/async_app.html
index b1cd99d98..3d30c57e9 100644
--- a/dev/_modules/fury/stream/server/async_app.html
+++ b/dev/_modules/fury/stream/server/async_app.html
@@ -7,7 +7,7 @@
- fury.stream.server.async_app — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.stream.server.async_app — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/stream/server/main.html b/dev/_modules/fury/stream/server/main.html
index cbf93de24..8b71de8f9 100644
--- a/dev/_modules/fury/stream/server/main.html
+++ b/dev/_modules/fury/stream/server/main.html
@@ -7,7 +7,7 @@
- fury.stream.server.main — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.stream.server.main — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/stream/tools.html b/dev/_modules/fury/stream/tools.html
index 154308777..76e2d3b2a 100644
--- a/dev/_modules/fury/stream/tools.html
+++ b/dev/_modules/fury/stream/tools.html
@@ -7,7 +7,7 @@
- fury.stream.tools — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.stream.tools — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/stream/widget.html b/dev/_modules/fury/stream/widget.html
index 0f66e10cd..bc9f49801 100644
--- a/dev/_modules/fury/stream/widget.html
+++ b/dev/_modules/fury/stream/widget.html
@@ -7,7 +7,7 @@
- fury.stream.widget — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.stream.widget — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/transform.html b/dev/_modules/fury/transform.html
index e28d1e63d..0be107f57 100644
--- a/dev/_modules/fury/transform.html
+++ b/dev/_modules/fury/transform.html
@@ -7,7 +7,7 @@
- fury.transform — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.transform — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/ui/containers.html b/dev/_modules/fury/ui/containers.html
index 2ee3e4dd1..02714923e 100644
--- a/dev/_modules/fury/ui/containers.html
+++ b/dev/_modules/fury/ui/containers.html
@@ -7,7 +7,7 @@
- fury.ui.containers — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.ui.containers — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/ui/core.html b/dev/_modules/fury/ui/core.html
index 708d84b90..5d425535a 100644
--- a/dev/_modules/fury/ui/core.html
+++ b/dev/_modules/fury/ui/core.html
@@ -7,7 +7,7 @@
- fury.ui.core — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.ui.core — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/ui/elements.html b/dev/_modules/fury/ui/elements.html
index 1f77cab73..532bf7dcf 100644
--- a/dev/_modules/fury/ui/elements.html
+++ b/dev/_modules/fury/ui/elements.html
@@ -7,7 +7,7 @@
- fury.ui.elements — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.ui.elements — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/ui/helpers.html b/dev/_modules/fury/ui/helpers.html
index 75c2163e5..56a387cbb 100644
--- a/dev/_modules/fury/ui/helpers.html
+++ b/dev/_modules/fury/ui/helpers.html
@@ -7,7 +7,7 @@
- fury.ui.helpers — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.ui.helpers — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/utils.html b/dev/_modules/fury/utils.html
index d7ba79cab..2899fc9fc 100644
--- a/dev/_modules/fury/utils.html
+++ b/dev/_modules/fury/utils.html
@@ -7,7 +7,7 @@
- fury.utils — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.utils — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/fury/window.html b/dev/_modules/fury/window.html
index 884d7b04e..1426e48ed 100644
--- a/dev/_modules/fury/window.html
+++ b/dev/_modules/fury/window.html
@@ -7,7 +7,7 @@
- fury.window — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ fury.window — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_modules/index.html b/dev/_modules/index.html
index 9228017e6..2582e2917 100644
--- a/dev/_modules/index.html
+++ b/dev/_modules/index.html
@@ -7,7 +7,7 @@
- Overview: module code — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ Overview: module code — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -43,7 +43,7 @@
-
+
diff --git a/dev/_sources/auto_examples/01_introductory/viz_earth_animation.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_earth_animation.rst.txt
index f2fbd21ca..d5c220f6d 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_earth_animation.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_earth_animation.rst.txt
@@ -23,7 +23,7 @@ Texture Sphere Animation
=========================
In this tutorial, we will show how to animate a textured sphere.
-.. GENERATED FROM PYTHON SOURCE LINES 7-20
+.. GENERATED FROM PYTHON SOURCE LINES 7-14
.. code-block:: Python
@@ -32,28 +32,22 @@ In this tutorial, we will show how to animate a textured sphere.
import numpy as np
- from fury import actor, io, utils, window
- from fury.data import (
- fetch_viz_models,
- fetch_viz_textures,
- read_viz_models,
- read_viz_textures,
- )
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 21-22
+.. GENERATED FROM PYTHON SOURCE LINES 15-16
Create a scene to start.
-.. GENERATED FROM PYTHON SOURCE LINES 22-25
+.. GENERATED FROM PYTHON SOURCE LINES 16-19
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
-.. GENERATED FROM PYTHON SOURCE LINES 26-31
+.. GENERATED FROM PYTHON SOURCE LINES 20-25
Next, load in a texture for each of the actors. For this tutorial, we will
be creating one textured sphere for the Earth, and another for the moon.
@@ -61,49 +55,49 @@ Collect the Earth texture from the FURY github using ``fetch_viz_textures``
and ``read_viz_textures``, then use ``io.load_image`` to load in the
image.
-.. GENERATED FROM PYTHON SOURCE LINES 31-36
+.. GENERATED FROM PYTHON SOURCE LINES 25-30
.. code-block:: Python
- fetch_viz_textures()
- earth_filename = read_viz_textures("1_earth_8k.jpg")
- earth_image = io.load_image(earth_filename)
+ fury.data.fetch_viz_textures()
+ earth_filename = fury.data.read_viz_textures("1_earth_8k.jpg")
+ earth_image = fury.io.load_image(earth_filename)
-.. GENERATED FROM PYTHON SOURCE LINES 37-39
+.. GENERATED FROM PYTHON SOURCE LINES 31-33
Using ``actor.texture_on_sphere()``, create an earth_actor with your newly
loaded texture.
-.. GENERATED FROM PYTHON SOURCE LINES 39-42
+.. GENERATED FROM PYTHON SOURCE LINES 33-36
.. code-block:: Python
- earth_actor = actor.texture_on_sphere(earth_image)
+ earth_actor = fury.actor.texture_on_sphere(earth_image)
-.. GENERATED FROM PYTHON SOURCE LINES 43-44
+.. GENERATED FROM PYTHON SOURCE LINES 37-38
Then, do the same for the moon.
-.. GENERATED FROM PYTHON SOURCE LINES 44-50
+.. GENERATED FROM PYTHON SOURCE LINES 38-44
.. code-block:: Python
- moon_filename = read_viz_textures("moon-8k.jpg")
- moon_image = io.load_image(moon_filename)
+ moon_filename = fury.data.read_viz_textures("moon-8k.jpg")
+ moon_image = fury.io.load_image(moon_filename)
- moon_actor = actor.texture_on_sphere(moon_image)
+ moon_actor = fury.actor.texture_on_sphere(moon_image)
-.. GENERATED FROM PYTHON SOURCE LINES 51-52
+.. GENERATED FROM PYTHON SOURCE LINES 45-46
Add both actors to the already existing scene.
-.. GENERATED FROM PYTHON SOURCE LINES 52-56
+.. GENERATED FROM PYTHON SOURCE LINES 46-50
.. code-block:: Python
@@ -112,45 +106,45 @@ Add both actors to the already existing scene.
scene.add(moon_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 57-61
+.. GENERATED FROM PYTHON SOURCE LINES 51-55
Next, alter the position and scale of the moon to correctly size it in
comparison to the Earth using ``actor.SetPosition()`` and
``actor.SetScale()``, and rotate the Earth using ``utils.rotate`` to
correctly align the texture.
-.. GENERATED FROM PYTHON SOURCE LINES 61-66
+.. GENERATED FROM PYTHON SOURCE LINES 55-60
.. code-block:: Python
moon_actor.SetPosition(1, 0.1, 0.5)
moon_actor.SetScale(0.25, 0.25, 0.25)
- utils.rotate(earth_actor, (-90, 1, 0, 0))
+ fury.utils.rotate(earth_actor, (-90, 1, 0, 0))
-.. GENERATED FROM PYTHON SOURCE LINES 67-69
+.. GENERATED FROM PYTHON SOURCE LINES 61-63
The ShowManager class is the interface between the scene, the window and the
interactor.
-.. GENERATED FROM PYTHON SOURCE LINES 69-74
+.. GENERATED FROM PYTHON SOURCE LINES 63-68
.. code-block:: Python
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
-.. GENERATED FROM PYTHON SOURCE LINES 75-78
+.. GENERATED FROM PYTHON SOURCE LINES 69-72
Next, let's focus on creating the animation.
We can determine the duration of animation with using the ``counter``.
Use itertools to avoid global variables.
-.. GENERATED FROM PYTHON SOURCE LINES 78-81
+.. GENERATED FROM PYTHON SOURCE LINES 72-75
.. code-block:: Python
@@ -158,12 +152,12 @@ Use itertools to avoid global variables.
counter = itertools.count()
-.. GENERATED FROM PYTHON SOURCE LINES 82-84
+.. GENERATED FROM PYTHON SOURCE LINES 76-78
Use ``set_camera`` to ensure the camera is in the optimal position for the
scene.
-.. GENERATED FROM PYTHON SOURCE LINES 84-91
+.. GENERATED FROM PYTHON SOURCE LINES 78-85
.. code-block:: Python
@@ -175,63 +169,63 @@ scene.
)
-.. GENERATED FROM PYTHON SOURCE LINES 92-94
+.. GENERATED FROM PYTHON SOURCE LINES 86-88
Let's create a sphere actor to add to the Earth. We will place this sphere
on the Earth's surface on Bloomington, IN, home of FURY's headquarters!
-.. GENERATED FROM PYTHON SOURCE LINES 94-99
+.. GENERATED FROM PYTHON SOURCE LINES 88-93
.. code-block:: Python
center = np.array([[-0.39, 0.3175, 0.025]])
radius = 0.002
- sphere_actor = actor.sphere(center, window.colors.blue_medium, radius)
+ sphere_actor = fury.actor.sphere(center, fury.window.colors.blue_medium, radius)
-.. GENERATED FROM PYTHON SOURCE LINES 100-101
+.. GENERATED FROM PYTHON SOURCE LINES 94-95
Also creating a text actor to add below the sphere.
-.. GENERATED FROM PYTHON SOURCE LINES 101-107
+.. GENERATED FROM PYTHON SOURCE LINES 95-101
.. code-block:: Python
- text_actor = actor.text_3d(
- "Bloomington, Indiana", (-0.42, 0.31, 0.03), window.colors.white, 0.004
+ text_actor = fury.actor.text_3d(
+ "Bloomington, Indiana", (-0.42, 0.31, 0.03), fury.window.colors.white, 0.004
)
- utils.rotate(text_actor, (-90, 0, 1, 0))
+ fury.utils.rotate(text_actor, (-90, 0, 1, 0))
-.. GENERATED FROM PYTHON SOURCE LINES 108-109
+.. GENERATED FROM PYTHON SOURCE LINES 102-103
Let's also import a model of a satellite to visualize circling the moon.
-.. GENERATED FROM PYTHON SOURCE LINES 109-119
+.. GENERATED FROM PYTHON SOURCE LINES 103-113
.. code-block:: Python
- fetch_viz_models()
- satellite_filename = read_viz_models("satellite_obj.obj")
- satellite = io.load_polydata(satellite_filename)
- satellite_actor = utils.get_actor_from_polydata(satellite)
+ fury.data.fetch_viz_models()
+ satellite_filename = fury.data.read_viz_models("satellite_obj.obj")
+ satellite = fury.io.load_polydata(satellite_filename)
+ satellite_actor = fury.utils.get_actor_from_polydata(satellite)
satellite_actor.SetPosition(-0.75, 0.1, 0.4)
satellite_actor.SetScale(0.005, 0.005, 0.005)
-.. GENERATED FROM PYTHON SOURCE LINES 120-124
+.. GENERATED FROM PYTHON SOURCE LINES 114-118
In the ``timer_callback`` function, use if statements to specify when
certain events will happen in the animation, based on the position that
the counter is at. So, for example, the earth actor will continue to
rotate while the count is less than 450.
-.. GENERATED FROM PYTHON SOURCE LINES 124-169
+.. GENERATED FROM PYTHON SOURCE LINES 118-163
.. code-block:: Python
@@ -241,7 +235,7 @@ rotate while the count is less than 450.
cnt = next(counter)
showm.render()
if cnt < 450:
- utils.rotate(earth_actor, (1, 0, 1, 0))
+ fury.utils.rotate(earth_actor, (1, 0, 1, 0))
if cnt % 5 == 0 and cnt < 450:
showm.scene.azimuth(-1)
if cnt == 300:
@@ -266,26 +260,26 @@ rotate while the count is less than 450.
)
scene.zoom(0.03)
scene.add(satellite_actor)
- utils.rotate(satellite_actor, (180, 0, 1, 0))
+ fury.utils.rotate(satellite_actor, (180, 0, 1, 0))
scene.rm(earth_actor)
if cnt > 575 and cnt < 750:
showm.scene.azimuth(-2)
- utils.rotate(moon_actor, (-2, 0, 1, 0))
+ fury.utils.rotate(moon_actor, (-2, 0, 1, 0))
satellite_actor.SetPosition(-0.8, 0.1 - cnt / 10000, 0.4)
if cnt >= 750 and cnt < 1100:
showm.scene.azimuth(-2)
- utils.rotate(moon_actor, (-2, 0, 1, 0))
+ fury.utils.rotate(moon_actor, (-2, 0, 1, 0))
satellite_actor.SetPosition(-0.8, -0.07 + cnt / 10000, 0.4)
if cnt == 1100:
showm.exit()
-.. GENERATED FROM PYTHON SOURCE LINES 170-171
+.. GENERATED FROM PYTHON SOURCE LINES 164-165
Watch your new animation take place!
-.. GENERATED FROM PYTHON SOURCE LINES 171-176
+.. GENERATED FROM PYTHON SOURCE LINES 165-170
.. code-block:: Python
@@ -293,7 +287,7 @@ Watch your new animation take place!
showm.add_timer_callback(True, 35, timer_callback)
showm.start()
- window.record(showm.scene, size=(900, 768), out_path="viz_earth_animation.png")
+ fury.window.record(showm.scene, size=(900, 768), out_path="viz_earth_animation.png")
.. _sphx_glr_download_auto_examples_01_introductory_viz_earth_animation.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_earth_coordinates.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_earth_coordinates.rst.txt
index 25b57bc3b..6f190780c 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_earth_coordinates.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_earth_coordinates.rst.txt
@@ -25,7 +25,7 @@ Earth Coordinate Conversion
In this tutorial, we will show how to place actors on specific locations
on the surface of the Earth using a new function.
-.. GENERATED FROM PYTHON SOURCE LINES 9-18
+.. GENERATED FROM PYTHON SOURCE LINES 9-17
.. code-block:: Python
@@ -35,53 +35,52 @@ on the surface of the Earth using a new function.
import numpy as np
- from fury import actor, io, utils, window
- from fury.data import fetch_viz_textures, read_viz_textures
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 19-22
+.. GENERATED FROM PYTHON SOURCE LINES 18-21
Create a new scene, and load in the image of the Earth using
``fetch_viz_textures`` and ``read_viz_textures``. We will use a 16k
resolution texture for maximum detail.
-.. GENERATED FROM PYTHON SOURCE LINES 22-31
+.. GENERATED FROM PYTHON SOURCE LINES 21-30
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
- fetch_viz_textures()
- earth_file = read_viz_textures("1_earth_16k.jpg")
- earth_image = io.load_image(earth_file)
- earth_actor = actor.texture_on_sphere(earth_image)
+ fury.data.fetch_viz_textures()
+ earth_file = fury.data.read_viz_textures("1_earth_16k.jpg")
+ earth_image = fury.io.load_image(earth_file)
+ earth_actor = fury.actor.texture_on_sphere(earth_image)
scene.add(earth_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 32-34
+.. GENERATED FROM PYTHON SOURCE LINES 31-33
Rotate the Earth to make sure the texture is correctly oriented. Change it's
scale using ``actor.SetScale()``.
-.. GENERATED FROM PYTHON SOURCE LINES 34-39
+.. GENERATED FROM PYTHON SOURCE LINES 33-38
.. code-block:: Python
- utils.rotate(earth_actor, (-90, 1, 0, 0))
- utils.rotate(earth_actor, (180, 0, 1, 0))
+ fury.utils.rotate(earth_actor, (-90, 1, 0, 0))
+ fury.utils.rotate(earth_actor, (180, 0, 1, 0))
earth_actor.SetScale(2, 2, 2)
-.. GENERATED FROM PYTHON SOURCE LINES 40-44
+.. GENERATED FROM PYTHON SOURCE LINES 39-43
Define the function to convert geographical coordinates of a location in
latitude and longitude degrees to coordinates on the ``earth_actor`` surface.
In this function, convert to radians, then to spherical coordinates, and
lastly, to cartesian coordinates.
-.. GENERATED FROM PYTHON SOURCE LINES 44-61
+.. GENERATED FROM PYTHON SOURCE LINES 43-60
.. code-block:: Python
@@ -103,12 +102,12 @@ lastly, to cartesian coordinates.
-.. GENERATED FROM PYTHON SOURCE LINES 62-64
+.. GENERATED FROM PYTHON SOURCE LINES 61-63
Use this new function to place some sphere actors on several big cities
around the Earth.
-.. GENERATED FROM PYTHON SOURCE LINES 64-69
+.. GENERATED FROM PYTHON SOURCE LINES 63-68
.. code-block:: Python
@@ -118,12 +117,12 @@ around the Earth.
locationthree = latlong_coordinates(48.864716, 2.349014) # paris, france
-.. GENERATED FROM PYTHON SOURCE LINES 70-72
+.. GENERATED FROM PYTHON SOURCE LINES 69-71
Set the centers, radii, and colors of these spheres, and create a new
``sphere_actor`` for each location to add to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 72-79
+.. GENERATED FROM PYTHON SOURCE LINES 71-78
.. code-block:: Python
@@ -131,65 +130,65 @@ Set the centers, radii, and colors of these spheres, and create a new
centers = np.array([[*locationone], [*locationtwo], [*locationthree]])
colors = np.random.rand(3, 3)
radii = np.array([0.005, 0.005, 0.005])
- sphere_actor = actor.sphere(centers, colors, radii)
+ sphere_actor = fury.actor.sphere(centers, colors, radii)
scene.add(sphere_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 80-82
+.. GENERATED FROM PYTHON SOURCE LINES 79-81
Create some text actors to add to the scene indicating each location and its
geographical coordinates.
-.. GENERATED FROM PYTHON SOURCE LINES 82-105
+.. GENERATED FROM PYTHON SOURCE LINES 81-104
.. code-block:: Python
- nyc_actor = actor.text_3d(
+ nyc_actor = fury.actor.text_3d(
"New York City, New York\n40.7128° N, 74.0060° W",
(locationone[0] - 0.04, locationone[1], locationone[2] + 0.07),
- window.colors.white,
+ fury.window.colors.white,
0.01,
)
- paris_actor = actor.text_3d(
+ paris_actor = fury.actor.text_3d(
"Paris, France\n48.8566° N, 2.3522° E",
(locationthree[0] - 0.04, locationthree[1], locationthree[2] - 0.07),
- window.colors.white,
+ fury.window.colors.white,
0.01,
)
- beijing_actor = actor.text_3d(
+ beijing_actor = fury.actor.text_3d(
"Beijing, China\n39.9042° N, 116.4074° E",
(locationtwo[0] - 0.06, locationtwo[1], locationtwo[2] - 0.07),
- window.colors.white,
+ fury.window.colors.white,
0.01,
)
- utils.rotate(paris_actor, (85, 0, 1, 0))
- utils.rotate(beijing_actor, (180, 0, 1, 0))
- utils.rotate(nyc_actor, (5, 1, 0, 0))
+ fury.utils.rotate(paris_actor, (85, 0, 1, 0))
+ fury.utils.rotate(beijing_actor, (180, 0, 1, 0))
+ fury.utils.rotate(nyc_actor, (5, 1, 0, 0))
-.. GENERATED FROM PYTHON SOURCE LINES 106-108
+.. GENERATED FROM PYTHON SOURCE LINES 105-107
Create a ShowManager object, which acts as the interface between the scene,
the window and the interactor.
-.. GENERATED FROM PYTHON SOURCE LINES 108-113
+.. GENERATED FROM PYTHON SOURCE LINES 107-112
.. code-block:: Python
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
-.. GENERATED FROM PYTHON SOURCE LINES 114-117
+.. GENERATED FROM PYTHON SOURCE LINES 113-116
Let's create a ``timer_callback`` function to add some animation to the
Earth. Change the camera position and angle to fly over and zoom in on each
new location.
-.. GENERATED FROM PYTHON SOURCE LINES 117-152
+.. GENERATED FROM PYTHON SOURCE LINES 116-151
.. code-block:: Python
@@ -229,12 +228,12 @@ new location.
-.. GENERATED FROM PYTHON SOURCE LINES 153-155
+.. GENERATED FROM PYTHON SOURCE LINES 152-154
Initialize the ShowManager object, add the timer_callback, and watch the
new animation take place!
-.. GENERATED FROM PYTHON SOURCE LINES 155-161
+.. GENERATED FROM PYTHON SOURCE LINES 154-160
.. code-block:: Python
@@ -243,7 +242,7 @@ new animation take place!
showm.add_timer_callback(True, 25, timer_callback)
showm.start()
- window.record(showm.scene, size=(900, 768), out_path="viz_earth_coordinates.png")
+ fury.window.record(showm.scene, size=(900, 768), out_path="viz_earth_coordinates.png")
.. _sphx_glr_download_auto_examples_01_introductory_viz_earth_coordinates.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_gltf.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_gltf.rst.txt
index 0cddef6ff..aff6aecf4 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_gltf.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_gltf.rst.txt
@@ -23,62 +23,60 @@ Visualizing a glTF file
=======================
In this tutorial, we will show how to display a glTF file in a scene.
-.. GENERATED FROM PYTHON SOURCE LINES 7-12
+.. GENERATED FROM PYTHON SOURCE LINES 7-10
.. code-block:: Python
- from fury import window
- from fury.data import fetch_gltf, read_viz_gltf
- from fury.gltf import glTF
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 13-14
+.. GENERATED FROM PYTHON SOURCE LINES 11-12
Create a scene.
-.. GENERATED FROM PYTHON SOURCE LINES 14-18
+.. GENERATED FROM PYTHON SOURCE LINES 12-16
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.SetBackground(0.1, 0.1, 0.4)
-.. GENERATED FROM PYTHON SOURCE LINES 19-20
+.. GENERATED FROM PYTHON SOURCE LINES 17-18
Retrieving the gltf model.
-.. GENERATED FROM PYTHON SOURCE LINES 20-23
+.. GENERATED FROM PYTHON SOURCE LINES 18-21
.. code-block:: Python
- fetch_gltf("Duck", "glTF")
- filename = read_viz_gltf("Duck")
+ fury.data.fetch_gltf("Duck", "glTF")
+ filename = fury.data.read_viz_gltf("Duck")
-.. GENERATED FROM PYTHON SOURCE LINES 24-28
+.. GENERATED FROM PYTHON SOURCE LINES 22-26
Initialize the glTF object and get actors using `actors` method.
Note: You can always manually create actor from polydata, and apply texture
or materials manually afterwards.
Experimental: For smooth mesh/actor you can set `apply_normals=True`.
-.. GENERATED FROM PYTHON SOURCE LINES 28-32
+.. GENERATED FROM PYTHON SOURCE LINES 26-30
.. code-block:: Python
- gltf_obj = glTF(filename, apply_normals=False)
+ gltf_obj = fury.gltf.glTF(filename, apply_normals=False)
actors = gltf_obj.actors()
-.. GENERATED FROM PYTHON SOURCE LINES 33-34
+.. GENERATED FROM PYTHON SOURCE LINES 31-32
Add all the actor from list of actors to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 34-37
+.. GENERATED FROM PYTHON SOURCE LINES 32-35
.. code-block:: Python
@@ -86,11 +84,11 @@ Add all the actor from list of actors to the scene.
scene.add(*actors)
-.. GENERATED FROM PYTHON SOURCE LINES 38-39
+.. GENERATED FROM PYTHON SOURCE LINES 36-37
Applying camera
-.. GENERATED FROM PYTHON SOURCE LINES 39-50
+.. GENERATED FROM PYTHON SOURCE LINES 37-48
.. code-block:: Python
@@ -102,9 +100,9 @@ Applying camera
interactive = False
if interactive:
- window.show(scene, size=(1280, 720))
+ fury.window.show(scene, size=(1280, 720))
- window.record(scene, out_path="viz_gltf.png", size=(1280, 720))
+ fury.window.record(scene, out_path="viz_gltf.png", size=(1280, 720))
.. _sphx_glr_download_auto_examples_01_introductory_viz_gltf.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_gltf_animated.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_gltf_animated.rst.txt
index 69a9b4c59..81a5369dc 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_gltf_animated.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_gltf_animated.rst.txt
@@ -24,65 +24,63 @@ Visualizing a glTF file
In this tutorial, we will show how to display a simple animated glTF in a
scene.
-.. GENERATED FROM PYTHON SOURCE LINES 8-13
+.. GENERATED FROM PYTHON SOURCE LINES 8-11
.. code-block:: Python
- from fury import window
- from fury.data import fetch_gltf, read_viz_gltf
- from fury.gltf import glTF
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 14-15
+.. GENERATED FROM PYTHON SOURCE LINES 12-13
Create a scene.
-.. GENERATED FROM PYTHON SOURCE LINES 15-24
+.. GENERATED FROM PYTHON SOURCE LINES 13-22
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
showm.initialize()
-.. GENERATED FROM PYTHON SOURCE LINES 25-26
+.. GENERATED FROM PYTHON SOURCE LINES 23-24
Retrieving the gltf model.
-.. GENERATED FROM PYTHON SOURCE LINES 26-29
+.. GENERATED FROM PYTHON SOURCE LINES 24-27
.. code-block:: Python
- fetch_gltf("InterpolationTest", "glTF")
- filename = read_viz_gltf("InterpolationTest")
+ fury.data.fetch_gltf("InterpolationTest", "glTF")
+ filename = fury.data.read_viz_gltf("InterpolationTest")
-.. GENERATED FROM PYTHON SOURCE LINES 30-32
+.. GENERATED FROM PYTHON SOURCE LINES 28-30
Initialize the glTF object and get actors using `actors` method.
Get the main_timeline (which contains multiple Timeline objects).
-.. GENERATED FROM PYTHON SOURCE LINES 32-36
+.. GENERATED FROM PYTHON SOURCE LINES 30-34
.. code-block:: Python
- gltf_obj = glTF(filename)
+ gltf_obj = fury.gltf.glTF(filename)
timeline = gltf_obj.main_animation()
-.. GENERATED FROM PYTHON SOURCE LINES 37-38
+.. GENERATED FROM PYTHON SOURCE LINES 35-36
Add the timeline to the scene (No need to add actors separately).
-.. GENERATED FROM PYTHON SOURCE LINES 38-41
+.. GENERATED FROM PYTHON SOURCE LINES 36-39
.. code-block:: Python
@@ -90,11 +88,11 @@ Add the timeline to the scene (No need to add actors separately).
scene.add(timeline)
-.. GENERATED FROM PYTHON SOURCE LINES 42-43
+.. GENERATED FROM PYTHON SOURCE LINES 40-41
define a timer_callback that updates the timeline.
-.. GENERATED FROM PYTHON SOURCE LINES 43-58
+.. GENERATED FROM PYTHON SOURCE LINES 41-56
.. code-block:: Python
@@ -112,7 +110,7 @@ define a timer_callback that updates the timeline.
if interactive:
showm.start()
- window.record(scene, out_path="viz_gltf_animated.png", size=(900, 768))
+ fury.window.record(scene, out_path="viz_gltf_animated.png", size=(900, 768))
.. _sphx_glr_download_auto_examples_01_introductory_viz_gltf_animated.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_gltf_export.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_gltf_export.rst.txt
index 388fe4e9c..0d340b209 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_gltf_export.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_gltf_export.rst.txt
@@ -23,23 +23,22 @@ Exporting scene as a glTF file
==============================
In this tutorial, we will show how to create a glTF file for a scene.
-.. GENERATED FROM PYTHON SOURCE LINES 7-13
+.. GENERATED FROM PYTHON SOURCE LINES 7-12
.. code-block:: Python
import numpy as np
- from fury import actor, gltf, window
- from fury.data import fetch_gltf, read_viz_gltf
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 14-16
+.. GENERATED FROM PYTHON SOURCE LINES 13-15
Specifying centers and colors for actors. We will use these parameters
later.
-.. GENERATED FROM PYTHON SOURCE LINES 16-20
+.. GENERATED FROM PYTHON SOURCE LINES 15-19
.. code-block:: Python
@@ -48,45 +47,45 @@ later.
colors = np.array([1, 1, 1])
-.. GENERATED FROM PYTHON SOURCE LINES 21-22
+.. GENERATED FROM PYTHON SOURCE LINES 20-21
Create a scene.
-.. GENERATED FROM PYTHON SOURCE LINES 22-25
+.. GENERATED FROM PYTHON SOURCE LINES 21-24
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
-.. GENERATED FROM PYTHON SOURCE LINES 26-27
+.. GENERATED FROM PYTHON SOURCE LINES 25-26
Creating actors and adding to scene.
-.. GENERATED FROM PYTHON SOURCE LINES 27-40
+.. GENERATED FROM PYTHON SOURCE LINES 26-39
.. code-block:: Python
- cube = actor.cube(np.add(centers, np.array([2, 0, 0])), colors=colors / 2)
+ cube = fury.actor.cube(np.add(centers, np.array([2, 0, 0])), colors=colors / 2)
scene.add(cube)
- sphere = actor.sphere(np.add(centers, np.array([0, 2, 0])), colors=colors)
+ sphere = fury.actor.sphere(np.add(centers, np.array([0, 2, 0])), colors=colors)
scene.add(sphere)
- fetch_gltf("BoxTextured", "glTF")
- filename = read_viz_gltf("BoxTextured")
- gltf_obj = gltf.glTF(filename)
+ fury.data.fetch_gltf("BoxTextured", "glTF")
+ filename = fury.data.read_viz_gltf("BoxTextured")
+ gltf_obj = fury.gltf.glTF(filename)
box_actor = gltf_obj.actors()
scene.add(box_actor[0])
-.. GENERATED FROM PYTHON SOURCE LINES 41-42
+.. GENERATED FROM PYTHON SOURCE LINES 40-41
Setting camera to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 42-47
+.. GENERATED FROM PYTHON SOURCE LINES 41-46
.. code-block:: Python
@@ -96,36 +95,36 @@ Setting camera to the scene.
)
-.. GENERATED FROM PYTHON SOURCE LINES 48-49
+.. GENERATED FROM PYTHON SOURCE LINES 47-48
Exporting scene as a glTF file
-.. GENERATED FROM PYTHON SOURCE LINES 49-52
+.. GENERATED FROM PYTHON SOURCE LINES 48-51
.. code-block:: Python
- gltf.export_scene(scene, filename="viz_gltf_export.gltf")
+ fury.gltf.export_scene(scene, filename="viz_gltf_export.gltf")
-.. GENERATED FROM PYTHON SOURCE LINES 53-54
+.. GENERATED FROM PYTHON SOURCE LINES 52-53
Reading the newly created glTF file and get actors.
-.. GENERATED FROM PYTHON SOURCE LINES 54-58
+.. GENERATED FROM PYTHON SOURCE LINES 53-57
.. code-block:: Python
- gltf_obj = gltf.glTF("viz_gltf_export.gltf")
+ gltf_obj = fury.gltf.glTF("viz_gltf_export.gltf")
actors = gltf_obj.actors()
-.. GENERATED FROM PYTHON SOURCE LINES 59-60
+.. GENERATED FROM PYTHON SOURCE LINES 58-59
Add all the actor from list of actors to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 60-69
+.. GENERATED FROM PYTHON SOURCE LINES 59-68
.. code-block:: Python
@@ -135,9 +134,9 @@ Add all the actor from list of actors to the scene.
interactive = False
if interactive:
- window.show(scene, size=(1280, 720))
+ fury.window.show(scene, size=(1280, 720))
- window.record(scene, out_path="viz_gltf_export.png", size=(1280, 720))
+ fury.window.record(scene, out_path="viz_gltf_export.png", size=(1280, 720))
.. _sphx_glr_download_auto_examples_01_introductory_viz_gltf_export.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_morphing.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_morphing.rst.txt
index 458c4aa92..77c01a029 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_morphing.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_morphing.rst.txt
@@ -23,50 +23,48 @@ Morphing Animation in a glTF
============================
In this tutorial, we will show how to use morphing in a glTF model in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 7-12
+.. GENERATED FROM PYTHON SOURCE LINES 7-10
.. code-block:: Python
- from fury import window
- from fury.data import fetch_gltf, read_viz_gltf
- from fury.gltf import glTF
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 13-15
+.. GENERATED FROM PYTHON SOURCE LINES 11-13
Retrieving the model with morphing in it (look at Khronoos samples).
We're choosing the `MorphStressTest` model here.
-.. GENERATED FROM PYTHON SOURCE LINES 15-19
+.. GENERATED FROM PYTHON SOURCE LINES 13-17
.. code-block:: Python
- fetch_gltf("MorphStressTest", "glTF")
- filename = read_viz_gltf("MorphStressTest")
+ fury.data.fetch_gltf("MorphStressTest", "glTF")
+ filename = fury.data.read_viz_gltf("MorphStressTest")
-.. GENERATED FROM PYTHON SOURCE LINES 20-22
+.. GENERATED FROM PYTHON SOURCE LINES 18-20
Initializing the glTF object, You can additionally set `apply_normals=True`.
Note: Normals might not work as intended with morphing.
-.. GENERATED FROM PYTHON SOURCE LINES 22-25
+.. GENERATED FROM PYTHON SOURCE LINES 20-23
.. code-block:: Python
- gltf_obj = glTF(filename, apply_normals=True)
+ gltf_obj = fury.gltf.glTF(filename, apply_normals=True)
-.. GENERATED FROM PYTHON SOURCE LINES 26-29
+.. GENERATED FROM PYTHON SOURCE LINES 24-27
Get the morph timeline using `morph_timeline` method, Choose the animation
name you want to visualize.
Note: If there's no name for animation, It's stored as `anim_0`, `anim_1` etc
-.. GENERATED FROM PYTHON SOURCE LINES 29-32
+.. GENERATED FROM PYTHON SOURCE LINES 27-30
.. code-block:: Python
@@ -74,12 +72,12 @@ Note: If there's no name for animation, It's stored as `anim_0`, `anim_1` etc
animation = gltf_obj.morph_animation()["TheWave"]
-.. GENERATED FROM PYTHON SOURCE LINES 33-35
+.. GENERATED FROM PYTHON SOURCE LINES 31-33
Call the `update_morph` method once, This moves initialise the morphing at
timestamp 0.0 seconds and ensures that camera fits all the actors perfectly.
-.. GENERATED FROM PYTHON SOURCE LINES 35-38
+.. GENERATED FROM PYTHON SOURCE LINES 33-36
.. code-block:: Python
@@ -87,19 +85,19 @@ timestamp 0.0 seconds and ensures that camera fits all the actors perfectly.
gltf_obj.update_morph(animation)
-.. GENERATED FROM PYTHON SOURCE LINES 39-42
+.. GENERATED FROM PYTHON SOURCE LINES 37-40
Create a scene, and show manager.
Initialize the show manager and add timeline to the scene (No need to add
actors to the scene separately).
-.. GENERATED FROM PYTHON SOURCE LINES 42-51
+.. GENERATED FROM PYTHON SOURCE LINES 40-49
.. code-block:: Python
- scene = window.Scene()
- showm = window.ShowManager(
+ scene = fury.window.Scene()
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=True, order_transparent=True
)
@@ -107,13 +105,13 @@ actors to the scene separately).
scene.add(animation)
-.. GENERATED FROM PYTHON SOURCE LINES 52-55
+.. GENERATED FROM PYTHON SOURCE LINES 50-53
define a timer_callback.
Use the `update_morph` method again, It updates the timeline and applies
morphing).
-.. GENERATED FROM PYTHON SOURCE LINES 55-62
+.. GENERATED FROM PYTHON SOURCE LINES 53-60
.. code-block:: Python
@@ -125,11 +123,11 @@ morphing).
-.. GENERATED FROM PYTHON SOURCE LINES 63-64
+.. GENERATED FROM PYTHON SOURCE LINES 61-62
Optional: `timeline.play()` auto plays the animations.
-.. GENERATED FROM PYTHON SOURCE LINES 64-75
+.. GENERATED FROM PYTHON SOURCE LINES 62-73
.. code-block:: Python
@@ -143,7 +141,7 @@ Optional: `timeline.play()` auto plays the animations.
if interactive:
showm.start()
- window.record(scene, out_path="viz_morphing.png", size=(900, 768))
+ fury.window.record(scene, out_path="viz_morphing.png", size=(900, 768))
.. _sphx_glr_download_auto_examples_01_introductory_viz_morphing.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_multithread.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_multithread.rst.txt
index 0fa8e2c8f..098ffa0f8 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_multithread.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_multithread.rst.txt
@@ -38,29 +38,29 @@ adds and removes elements from the scene.
import numpy as np
- from fury import actor, ui, window
+ import fury
# Preparing to draw some spheres
xyz = 10 * (np.random.random((100, 3)) - 0.5)
colors = np.random.random((100, 4))
radii = np.random.random(100) + 0.5
- scene = window.Scene()
- sphere_actor = actor.sphere(
+ scene = fury.window.Scene()
+ sphere_actor = fury.actor.sphere(
centers=xyz, colors=colors, radii=radii, use_primitive=False
)
scene.add(sphere_actor)
# Preparing the show manager as usual
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
# showm.initialize()
# Creating a text block to show a message and reset the camera
- tb = ui.TextBlock2D(bold=True)
+ tb = fury.ui.TextBlock2D(bold=True)
scene.add(tb)
scene.ResetCamera()
@@ -100,7 +100,7 @@ adds and removes elements from the scene.
for i in range(100):
if showm.lock_current():
if current_axes is None:
- current_axes = actor.axes(scale=(0.20 * i, 0.20 * i, 0.20 * i))
+ current_axes = fury.actor.axes(scale=(0.20 * i, 0.20 * i, 0.20 * i))
scene.add(current_axes)
pass
else:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_picking.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_picking.rst.txt
index bc2461386..5181a1cd0 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_picking.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_picking.rst.txt
@@ -36,7 +36,7 @@ When the objects are picked they will change size and color.
import numpy as np
- from fury import actor, pick, ui, utils, window
+ import fury
centers = 0.5 * np.array([[0, 0, 0], [100, 0, 0], [200, 0, 0.0]])
colors = np.array([[0.8, 0, 0], [0, 0.8, 0], [0, 0, 0.8]])
@@ -54,10 +54,10 @@ Let's create a panel to show what is picked
.. code-block:: Python
- panel = ui.Panel2D(size=(400, 200), color=(1, 0.5, 0.0), align="right")
+ panel = fury.ui.Panel2D(size=(400, 200), color=(1, 0.5, 0.0), align="right")
panel.center = (150, 200)
- text_block = ui.TextBlock2D(text="Left click on object \n")
+ text_block = fury.ui.TextBlock2D(text="Left click on object \n")
panel.add_element(text_block, (0.3, 0.3))
@@ -70,9 +70,9 @@ Build scene and add an actor with many objects.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
- label_actor = actor.vector_text(text="Test")
+ label_actor = fury.actor.vector_text(text="Test")
.. GENERATED FROM PYTHON SOURCE LINES 41-42
@@ -91,7 +91,7 @@ This actor is made with 3 cubes of different orientation
[0, np.sqrt(2) / 2, np.sqrt(2) / 2],
]
)
- fury_actor = actor.cube(centers, directions, colors, scales=radii)
+ fury_actor = fury.actor.cube(centers, directions, colors, scales=radii)
.. GENERATED FROM PYTHON SOURCE LINES 53-54
@@ -103,7 +103,7 @@ Access the memory of the vertices of all the cubes
.. code-block:: Python
- vertices = utils.vertices_from_actor(fury_actor)
+ vertices = fury.utils.vertices_from_actor(fury_actor)
num_vertices = vertices.shape[0]
num_objects = centers.shape[0]
@@ -117,7 +117,7 @@ Access the memory of the colors of all the cubes
.. code-block:: Python
- vcolors = utils.colors_from_actor(fury_actor, "colors")
+ vcolors = fury.utils.colors_from_actor(fury_actor, "colors")
.. GENERATED FROM PYTHON SOURCE LINES 65-66
@@ -128,7 +128,7 @@ Adding an actor showing the axes of the world coordinates
.. code-block:: Python
- ax = actor.axes(scale=(10, 10, 10))
+ ax = fury.actor.axes(scale=(10, 10, 10))
scene.add(fury_actor)
scene.add(label_actor)
@@ -145,7 +145,7 @@ Create the Picking manager
.. code-block:: Python
- pickm = pick.PickingManager()
+ pickm = fury.pick.PickingManager()
.. GENERATED FROM PYTHON SOURCE LINES 79-80
@@ -196,7 +196,7 @@ Time to make the callback which will be called when we pick an object
vcolors[object_index * sec : object_index * sec + sec] += color_add
# Tell actor that memory is modified
- utils.update_actor(fury_actor)
+ fury.utils.update_actor(fury_actor)
face_index = picked_info["face"]
@@ -232,7 +232,7 @@ Make the window appear
.. code-block:: Python
- showm = window.ShowManager(scene, size=(1024, 768), order_transparent=True)
+ showm = fury.window.ShowManager(scene, size=(1024, 768), order_transparent=True)
scene.add(panel)
@@ -262,7 +262,7 @@ Save the current framebuffer in a PNG file
.. code-block:: Python
- window.record(showm.scene, size=(1024, 768), out_path="viz_picking.png")
+ fury.window.record(showm.scene, size=(1024, 768), out_path="viz_picking.png")
.. _sphx_glr_download_auto_examples_01_introductory_viz_picking.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_selection.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_selection.rst.txt
index 85f45d203..b774caea6 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_selection.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_selection.rst.txt
@@ -45,7 +45,7 @@ behind that box.
import numpy as np
- from fury import actor, pick, utils, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 28-29
@@ -88,7 +88,7 @@ Build scene and add an actor with many objects.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
.. GENERATED FROM PYTHON SOURCE LINES 50-51
@@ -100,7 +100,7 @@ Build the actor containing all the cubes
.. code-block:: Python
- cube_actor = actor.cube(centers, directions=(1, 0, 0), colors=colors, scales=radii)
+ cube_actor = fury.actor.cube(centers, directions=(1, 0, 0), colors=colors, scales=radii)
.. GENERATED FROM PYTHON SOURCE LINES 55-56
@@ -112,7 +112,7 @@ Access the memory of the vertices of all the cubes
.. code-block:: Python
- vertices = utils.vertices_from_actor(cube_actor)
+ vertices = fury.utils.vertices_from_actor(cube_actor)
num_vertices = vertices.shape[0]
num_objects = centers.shape[0]
@@ -126,7 +126,7 @@ Access the memory of the colors of all the cubes
.. code-block:: Python
- vcolors = utils.colors_from_actor(cube_actor, "colors")
+ vcolors = fury.utils.colors_from_actor(cube_actor, "colors")
.. GENERATED FROM PYTHON SOURCE LINES 67-68
@@ -140,7 +140,7 @@ Create a rectangular 2d box as a texture
rgba = 255 * np.ones((100, 200, 4))
rgba[1:-1, 1:-1] = np.zeros((98, 198, 4)) + 100
- texa = actor.texture_2d(rgba.astype(np.uint8))
+ texa = fury.actor.texture_2d(rgba.astype(np.uint8))
scene.add(cube_actor)
scene.add(texa)
@@ -157,7 +157,7 @@ Create the Selection Manager
.. code-block:: Python
- selm = pick.SelectionManager(select="faces")
+ selm = fury.pick.SelectionManager(select="faces")
.. GENERATED FROM PYTHON SOURCE LINES 84-85
@@ -202,7 +202,7 @@ when we hover the mouse
vcolors[object_index * sec : object_index * sec + sec] = (
color_change
)
- utils.update_actor(cube_actor)
+ fury.utils.update_actor(cube_actor)
showm.render()
@@ -216,7 +216,7 @@ Make the window appear
.. code-block:: Python
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(1024, 768), order_transparent=True, reset_camera=False
)
@@ -259,7 +259,7 @@ Save the current framebuffer in a PNG file
.. code-block:: Python
- window.record(showm.scene, size=(1024, 768), out_path="viz_selection.png")
+ fury.window.record(showm.scene, size=(1024, 768), out_path="viz_selection.png")
.. _sphx_glr_download_auto_examples_01_introductory_viz_selection.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_skinning.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_skinning.rst.txt
index 131946603..486e365c9 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_skinning.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_skinning.rst.txt
@@ -24,50 +24,48 @@ Skeletal Animation in a glTF file
In this tutorial, we will show how to use skeletal animations (skinning) in a
glTF model in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 8-13
+.. GENERATED FROM PYTHON SOURCE LINES 8-11
.. code-block:: Python
- from fury import window
- from fury.data import fetch_gltf, read_viz_gltf
- from fury.gltf import glTF
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 14-16
+.. GENERATED FROM PYTHON SOURCE LINES 12-14
Retrieving the model with skeletal animations.
We're choosing the `RiggedFigure` model here.
-.. GENERATED FROM PYTHON SOURCE LINES 16-20
+.. GENERATED FROM PYTHON SOURCE LINES 14-18
.. code-block:: Python
- fetch_gltf("RiggedFigure", "glTF")
- filename = read_viz_gltf("RiggedFigure")
+ fury.data.fetch_gltf("RiggedFigure", "glTF")
+ filename = fury.data.read_viz_gltf("RiggedFigure")
-.. GENERATED FROM PYTHON SOURCE LINES 21-23
+.. GENERATED FROM PYTHON SOURCE LINES 19-21
Initializing the glTF object, You can additionally set `apply_normals=True`.
Note: Normals might not work well as intended with skinning animations.
-.. GENERATED FROM PYTHON SOURCE LINES 23-26
+.. GENERATED FROM PYTHON SOURCE LINES 21-24
.. code-block:: Python
- gltf_obj = glTF(filename, apply_normals=False)
+ gltf_obj = fury.gltf.glTF(filename, apply_normals=False)
-.. GENERATED FROM PYTHON SOURCE LINES 27-30
+.. GENERATED FROM PYTHON SOURCE LINES 25-28
Get the skinning timeline using `skin_timeline` method, Choose the animation
name you want to visualize.
Note: If there's no name for animation, It's stored as `anim_0`, `anim_1` etc
-.. GENERATED FROM PYTHON SOURCE LINES 30-41
+.. GENERATED FROM PYTHON SOURCE LINES 28-39
.. code-block:: Python
@@ -83,32 +81,32 @@ Note: If there's no name for animation, It's stored as `anim_0`, `anim_1` etc
gltf_obj.initialize_skin(animation, bones=False)
-.. GENERATED FROM PYTHON SOURCE LINES 42-45
+.. GENERATED FROM PYTHON SOURCE LINES 40-43
Create a scene, and show manager.
Initialize the show manager and add timeline to the scene (No need to add
actors to the scene separately).
-.. GENERATED FROM PYTHON SOURCE LINES 45-53
+.. GENERATED FROM PYTHON SOURCE LINES 43-51
.. code-block:: Python
- scene = window.Scene()
- showm = window.ShowManager(
+ scene = fury.window.Scene()
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=True, order_transparent=True
)
showm.initialize()
scene.add(animation)
-.. GENERATED FROM PYTHON SOURCE LINES 54-57
+.. GENERATED FROM PYTHON SOURCE LINES 52-55
define a timer_callback.
Use the `update_skin` method, It updates the timeline and applies skinning to
actors (and bones).
-.. GENERATED FROM PYTHON SOURCE LINES 57-64
+.. GENERATED FROM PYTHON SOURCE LINES 55-62
.. code-block:: Python
@@ -120,11 +118,11 @@ actors (and bones).
-.. GENERATED FROM PYTHON SOURCE LINES 65-66
+.. GENERATED FROM PYTHON SOURCE LINES 63-64
Optional: `timeline.play()` auto plays the animations.
-.. GENERATED FROM PYTHON SOURCE LINES 66-77
+.. GENERATED FROM PYTHON SOURCE LINES 64-75
.. code-block:: Python
@@ -138,7 +136,7 @@ Optional: `timeline.play()` auto plays the animations.
if interactive:
showm.start()
- window.record(scene, out_path="viz_skinning.png", size=(900, 768))
+ fury.window.record(scene, out_path="viz_skinning.png", size=(900, 768))
.. _sphx_glr_download_auto_examples_01_introductory_viz_skinning.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_slice.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_slice.rst.txt
index f83452b07..37e70db8b 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_slice.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_slice.rst.txt
@@ -34,7 +34,7 @@ Here we present an example for visualizing slices from 3D images.
from dipy.data import fetch_bundles_2_subjects
import nibabel as nib
- from fury import actor, ui, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 17-18
@@ -72,7 +72,7 @@ Create a Scene object which holds all the actors which we want to visualize.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background((0.5, 0.5, 0.5))
@@ -104,7 +104,7 @@ middle slice of the last dimension of the resampled data.
.. code-block:: Python
- slice_actor = actor.slicer(data, affine, value_range)
+ slice_actor = fury.actor.slicer(data, affine, value_range)
.. GENERATED FROM PYTHON SOURCE LINES 59-60
@@ -160,7 +160,7 @@ In order to interact with the data you will need to uncomment the line below.
.. code-block:: Python
- # window.show(scene, size=(600, 600), reset_camera=False)
+ # fury.window.show(scene, size=(600, 600), reset_camera=False)
.. GENERATED FROM PYTHON SOURCE LINES 87-88
@@ -172,7 +172,7 @@ Otherwise, you can save a screenshot using the following command.
.. code-block:: Python
- window.record(scene, out_path="slices.png", size=(600, 600), reset_camera=False)
+ fury.window.record(scene, out_path="slices.png", size=(600, 600), reset_camera=False)
.. GENERATED FROM PYTHON SOURCE LINES 92-94
@@ -211,7 +211,7 @@ Notice here how the scale range is. We use FA min and max values to set it up
.. code-block:: Python
- lut = actor.colormap_lookup_table(
+ lut = fury.actor.colormap_lookup_table(
scale_range=(fa.min(), fa.max()),
hue_range=(0.4, 1.0),
saturation_range=(1, 1.0),
@@ -224,12 +224,12 @@ Notice here how the scale range is. We use FA min and max values to set it up
This is because the lookup table is applied in the slice after interpolating
to (0, 255).
-.. GENERATED FROM PYTHON SOURCE LINES 124-137
+.. GENERATED FROM PYTHON SOURCE LINES 124-139
.. code-block:: Python
- fa_actor = actor.slicer(fa, affine, lookup_colormap=lut)
+ fa_actor = fury.actor.slicer(fa, affine, lookup_colormap=lut)
scene.clear()
scene.add(fa_actor)
@@ -237,12 +237,14 @@ to (0, 255).
scene.reset_camera()
scene.zoom(1.4)
- # window.show(scene, size=(600, 600), reset_camera=False)
+ # fury.window.show(scene, size=(600, 600), reset_camera=False)
- window.record(scene, out_path="slices_lut.png", size=(600, 600), reset_camera=False)
+ fury.window.record(
+ scene, out_path="slices_lut.png", size=(600, 600), reset_camera=False
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 138-144
+.. GENERATED FROM PYTHON SOURCE LINES 140-146
Now we would like to add the ability to click on a voxel and show its value
on a panel in the window. The panel is a UI element which requires access to
@@ -251,31 +253,31 @@ recommend using it with ``window.show``. The more appropriate way is to use
the ``ShowManager`` object, which allows accessing the pipeline in different
areas.
-.. GENERATED FROM PYTHON SOURCE LINES 144-148
+.. GENERATED FROM PYTHON SOURCE LINES 146-150
.. code-block:: Python
- show_m = window.ShowManager(scene, size=(1200, 900))
+ show_m = fury.window.ShowManager(scene, size=(1200, 900))
-.. GENERATED FROM PYTHON SOURCE LINES 149-150
+.. GENERATED FROM PYTHON SOURCE LINES 151-152
We'll start by creating the panel and adding it to the ``ShowManager``
-.. GENERATED FROM PYTHON SOURCE LINES 150-169
+.. GENERATED FROM PYTHON SOURCE LINES 152-171
.. code-block:: Python
- label_position = ui.TextBlock2D(text="Position:")
- label_value = ui.TextBlock2D(text="Value:")
+ label_position = fury.ui.TextBlock2D(text="Position:")
+ label_value = fury.ui.TextBlock2D(text="Value:")
- result_position = ui.TextBlock2D(text="")
- result_value = ui.TextBlock2D(text="")
+ result_position = fury.ui.TextBlock2D(text="")
+ result_value = fury.ui.TextBlock2D(text="")
- panel_picking = ui.Panel2D(
+ panel_picking = fury.ui.Panel2D(
size=(250, 125), position=(20, 20), color=(0, 0, 0), opacity=0.75, align="left"
)
@@ -288,12 +290,12 @@ We'll start by creating the panel and adding it to the ``ShowManager``
show_m.scene.add(panel_picking)
-.. GENERATED FROM PYTHON SOURCE LINES 170-172
+.. GENERATED FROM PYTHON SOURCE LINES 172-174
Add a left-click callback to the slicer. Also disable interpolation so you
can see what you are picking.
-.. GENERATED FROM PYTHON SOURCE LINES 172-190
+.. GENERATED FROM PYTHON SOURCE LINES 174-192
.. code-block:: Python
@@ -316,7 +318,7 @@ can see what you are picking.
# show_m.start()
-.. GENERATED FROM PYTHON SOURCE LINES 191-199
+.. GENERATED FROM PYTHON SOURCE LINES 193-201
Create a mosaic
================
@@ -327,7 +329,7 @@ easy and efficient to create a mosaic of all the slices.
So, let's clear the scene and change the projection from perspective to
parallel. We'll also need a new show manager and an associated callback.
-.. GENERATED FROM PYTHON SOURCE LINES 199-220
+.. GENERATED FROM PYTHON SOURCE LINES 201-222
.. code-block:: Python
@@ -338,7 +340,7 @@ parallel. We'll also need a new show manager and an associated callback.
result_position.message = ""
result_value.message = ""
- show_m_mosaic = window.ShowManager(scene, size=(1200, 900))
+ show_m_mosaic = fury.window.ShowManager(scene, size=(1200, 900))
def left_click_callback_mosaic(obj, _ev):
@@ -353,13 +355,13 @@ parallel. We'll also need a new show manager and an associated callback.
-.. GENERATED FROM PYTHON SOURCE LINES 221-224
+.. GENERATED FROM PYTHON SOURCE LINES 223-226
Now we need to create two nested for loops which will set the positions of
the grid of the mosaic and add the new actors to the scene. We are going
to use 15 columns and 10 rows but you can adjust those with your datasets.
-.. GENERATED FROM PYTHON SOURCE LINES 224-257
+.. GENERATED FROM PYTHON SOURCE LINES 226-259
.. code-block:: Python
@@ -397,19 +399,19 @@ to use 15 columns and 10 rows but you can adjust those with your datasets.
# show_m_mosaic.start()
-.. GENERATED FROM PYTHON SOURCE LINES 258-261
+.. GENERATED FROM PYTHON SOURCE LINES 260-263
If you uncomment the two lines above, you will be able to move
the mosaic up/down and left/right using the middle mouse button drag,
zoom in/out using the scroll wheel, and pick voxels with left click.
-.. GENERATED FROM PYTHON SOURCE LINES 261-264
+.. GENERATED FROM PYTHON SOURCE LINES 263-266
.. code-block:: Python
- window.record(scene, out_path="mosaic.png", size=(900, 600), reset_camera=False)
+ fury.window.record(scene, out_path="mosaic.png", size=(900, 600), reset_camera=False)
.. _sphx_glr_download_auto_examples_01_introductory_viz_slice.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_solar_system.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_solar_system.rst.txt
index caaee9e72..90055956c 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_solar_system.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_solar_system.rst.txt
@@ -27,7 +27,7 @@ using textured spheres. We will also show how to manipulate the
position of these sphere actors in a timer_callback function
to simulate orbital motion.
-.. GENERATED FROM PYTHON SOURCE LINES 11-19
+.. GENERATED FROM PYTHON SOURCE LINES 11-18
.. code-block:: Python
@@ -36,28 +36,31 @@ to simulate orbital motion.
import numpy as np
- from fury import actor, io, ui, utils, window
- from fury.data import fetch_viz_textures, read_viz_icons, read_viz_textures
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 20-21
+.. GENERATED FROM PYTHON SOURCE LINES 19-20
Create a scene to start.
-.. GENERATED FROM PYTHON SOURCE LINES 21-38
+.. GENERATED FROM PYTHON SOURCE LINES 20-41
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
# Create a panel and the start/pause buttons
- panel = ui.Panel2D(size=(300, 100), color=(1, 1, 1), align="right")
+ panel = fury.ui.Panel2D(size=(300, 100), color=(1, 1, 1), align="right")
panel.center = (400, 50)
- pause_button = ui.Button2D(icon_fnames=[("square", read_viz_icons(fname="pause2.png"))])
- start_button = ui.Button2D(icon_fnames=[("square", read_viz_icons(fname="play3.png"))])
+ pause_button = fury.ui.Button2D(
+ icon_fnames=[("square", fury.data.read_viz_icons(fname="pause2.png"))]
+ )
+ start_button = fury.ui.Button2D(
+ icon_fnames=[("square", fury.data.read_viz_icons(fname="play3.png"))]
+ )
# Add the buttons on the panel
@@ -66,12 +69,12 @@ Create a scene to start.
-.. GENERATED FROM PYTHON SOURCE LINES 39-41
+.. GENERATED FROM PYTHON SOURCE LINES 42-44
Define information relevant for each planet actor including its
texture name, relative position, and scale.
-.. GENERATED FROM PYTHON SOURCE LINES 41-96
+.. GENERATED FROM PYTHON SOURCE LINES 44-99
.. code-block:: Python
@@ -128,17 +131,17 @@ texture name, relative position, and scale.
},
{"filename": "8k_sun.jpg", "position": 0, "earth_days": 27, "scale": (5, 5, 5)},
]
- fetch_viz_textures()
+ fury.data.fetch_viz_textures()
-.. GENERATED FROM PYTHON SOURCE LINES 97-101
+.. GENERATED FROM PYTHON SOURCE LINES 100-104
To take advantage of the previously defined data structure we are going to
create an auxiliary function that will load and apply the respective
texture, set its respective properties (relative position and scale),
and add the actor to a previously created scene.
-.. GENERATED FROM PYTHON SOURCE LINES 101-128
+.. GENERATED FROM PYTHON SOURCE LINES 104-131
.. code-block:: Python
@@ -158,25 +161,25 @@ and add the actor to a previously created scene.
planet_actor: actor
The corresponding sphere actor with texture applied.
"""
- planet_file = read_viz_textures(planet_data["filename"])
- planet_image = io.load_image(planet_file)
- planet_actor = actor.texture_on_sphere(planet_image)
+ planet_file = fury.data.read_viz_textures(planet_data["filename"])
+ planet_image = fury.io.load_image(planet_file)
+ planet_actor = fury.actor.texture_on_sphere(planet_image)
planet_actor.SetPosition(planet_data["position"], 0, 0)
if planet_data["filename"] != "8k_saturn_ring_alpha.png":
- utils.rotate(planet_actor, (90, 1, 0, 0))
+ fury.utils.rotate(planet_actor, (90, 1, 0, 0))
planet_actor.SetScale(planet_data["scale"])
scene.add(planet_actor)
return planet_actor
-.. GENERATED FROM PYTHON SOURCE LINES 129-132
+.. GENERATED FROM PYTHON SOURCE LINES 132-135
Use the ``map`` function to create actors for each of the texture files
in the ``planet_files`` list. Then, assign each actor to its corresponding
actor in the list.
-.. GENERATED FROM PYTHON SOURCE LINES 132-147
+.. GENERATED FROM PYTHON SOURCE LINES 135-150
.. code-block:: Python
@@ -196,14 +199,14 @@ actor in the list.
-.. GENERATED FROM PYTHON SOURCE LINES 148-152
+.. GENERATED FROM PYTHON SOURCE LINES 151-155
Define the gravitational constant G, the orbital radii of each of the
planets, and the central mass of the sun. The gravity and mass will be
used to calculate the orbital position, so multiply these two together to
create a new constant, which we will call miu.
-.. GENERATED FROM PYTHON SOURCE LINES 152-161
+.. GENERATED FROM PYTHON SOURCE LINES 155-164
.. code-block:: Python
@@ -217,14 +220,14 @@ create a new constant, which we will call miu.
miu = m_constant * g_constant
-.. GENERATED FROM PYTHON SOURCE LINES 162-166
+.. GENERATED FROM PYTHON SOURCE LINES 165-169
Let's define two functions that will help us calculate the position of each
planet as it orbits around the sun: ``get_orbit_period`` and
``get_orbital_position``, using the constant miu and the orbital radii
of each planet.
-.. GENERATED FROM PYTHON SOURCE LINES 166-179
+.. GENERATED FROM PYTHON SOURCE LINES 169-182
.. code-block:: Python
@@ -242,13 +245,13 @@ of each planet.
-.. GENERATED FROM PYTHON SOURCE LINES 180-183
+.. GENERATED FROM PYTHON SOURCE LINES 183-186
Let's define a function to rotate the planet actor axially, we'll be defining
axis of each planet and angle by which it should be rotated using
``rotate_axial`` funtction
-.. GENERATED FROM PYTHON SOURCE LINES 183-192
+.. GENERATED FROM PYTHON SOURCE LINES 186-195
.. code-block:: Python
@@ -257,16 +260,16 @@ axis of each planet and angle by which it should be rotated using
def rotate_axial(actor, time, radius):
axis = (0, radius, 0)
angle = 50 / time
- utils.rotate(actor, (angle, axis[0], axis[1], axis[2]))
+ fury.utils.rotate(actor, (angle, axis[0], axis[1], axis[2]))
return angle
-.. GENERATED FROM PYTHON SOURCE LINES 193-194
+.. GENERATED FROM PYTHON SOURCE LINES 196-197
Let's change the camera position to visualize the planets better.
-.. GENERATED FROM PYTHON SOURCE LINES 194-197
+.. GENERATED FROM PYTHON SOURCE LINES 197-200
.. code-block:: Python
@@ -274,29 +277,29 @@ Let's change the camera position to visualize the planets better.
scene.set_camera(position=(-20, 60, 100))
-.. GENERATED FROM PYTHON SOURCE LINES 198-200
+.. GENERATED FROM PYTHON SOURCE LINES 201-203
Next, create a ShowManager object. The ShowManager class is the interface
between the scene, the window and the interactor.
-.. GENERATED FROM PYTHON SOURCE LINES 200-206
+.. GENERATED FROM PYTHON SOURCE LINES 203-209
.. code-block:: Python
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
scene.add(panel)
-.. GENERATED FROM PYTHON SOURCE LINES 207-210
+.. GENERATED FROM PYTHON SOURCE LINES 210-213
Next, let's focus on creating the animation.
We can determine the duration of animation with using the ``counter``.
Use itertools to avoid global variables.
-.. GENERATED FROM PYTHON SOURCE LINES 210-213
+.. GENERATED FROM PYTHON SOURCE LINES 213-216
.. code-block:: Python
@@ -304,12 +307,12 @@ Use itertools to avoid global variables.
counter = itertools.count()
-.. GENERATED FROM PYTHON SOURCE LINES 214-216
+.. GENERATED FROM PYTHON SOURCE LINES 217-219
Define one new function to use in ``timer_callback`` to update the planet
positions ``update_planet_position``.
-.. GENERATED FROM PYTHON SOURCE LINES 216-224
+.. GENERATED FROM PYTHON SOURCE LINES 219-227
.. code-block:: Python
@@ -322,12 +325,12 @@ positions ``update_planet_position``.
-.. GENERATED FROM PYTHON SOURCE LINES 225-227
+.. GENERATED FROM PYTHON SOURCE LINES 228-230
``calculate_path`` function is for calculating the path/orbit
of every planet.
-.. GENERATED FROM PYTHON SOURCE LINES 227-237
+.. GENERATED FROM PYTHON SOURCE LINES 230-240
.. code-block:: Python
@@ -342,7 +345,7 @@ of every planet.
-.. GENERATED FROM PYTHON SOURCE LINES 238-243
+.. GENERATED FROM PYTHON SOURCE LINES 241-246
First we are making a list that will contain radius from `planets_data`.
Here we are not taking the radius of orbit/path for sun and saturn ring.
@@ -350,7 +353,7 @@ Here we are not taking the radius of orbit/path for sun and saturn ring.
`r_times` will contain time taken (in days) by the planets to rotate
around itself.
-.. GENERATED FROM PYTHON SOURCE LINES 243-271
+.. GENERATED FROM PYTHON SOURCE LINES 246-274
.. code-block:: Python
@@ -383,11 +386,11 @@ around itself.
r_times = [p_data["earth_days"] for p_data in planets_data]
-.. GENERATED FROM PYTHON SOURCE LINES 272-273
+.. GENERATED FROM PYTHON SOURCE LINES 275-276
Here we are calculating and updating the path/orbit before animation starts.
-.. GENERATED FROM PYTHON SOURCE LINES 273-276
+.. GENERATED FROM PYTHON SOURCE LINES 276-279
.. code-block:: Python
@@ -395,28 +398,28 @@ Here we are calculating and updating the path/orbit before animation starts.
planet_tracks = [calculate_path(rplanet, rplanet * 85) for rplanet in r_planets]
-.. GENERATED FROM PYTHON SOURCE LINES 277-279
+.. GENERATED FROM PYTHON SOURCE LINES 280-282
This is for orbit visualization. We are using line actor for orbits.
After creating an actor we add it to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 279-283
+.. GENERATED FROM PYTHON SOURCE LINES 282-286
.. code-block:: Python
- orbit_actor = actor.line(planet_tracks, colors=(1, 1, 1), linewidth=0.1)
+ orbit_actor = fury.actor.line(planet_tracks, colors=(1, 1, 1), linewidth=0.1)
scene.add(orbit_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 284-288
+.. GENERATED FROM PYTHON SOURCE LINES 287-291
Define the ``timer_callback`` function, which controls what events happen
at certain times, using the counter. Update the position of each planet
actor using ``update_planet_position,`` assigning the x and y values of
each planet's position with the newly calculated ones.
-.. GENERATED FROM PYTHON SOURCE LINES 288-311
+.. GENERATED FROM PYTHON SOURCE LINES 291-314
.. code-block:: Python
@@ -444,11 +447,11 @@ each planet's position with the newly calculated ones.
-.. GENERATED FROM PYTHON SOURCE LINES 312-313
+.. GENERATED FROM PYTHON SOURCE LINES 315-316
We add a callback to each button to perform some action.
-.. GENERATED FROM PYTHON SOURCE LINES 313-327
+.. GENERATED FROM PYTHON SOURCE LINES 316-330
.. code-block:: Python
@@ -467,11 +470,11 @@ We add a callback to each button to perform some action.
-.. GENERATED FROM PYTHON SOURCE LINES 328-329
+.. GENERATED FROM PYTHON SOURCE LINES 331-332
Watch the planets orbit the sun in your new animation!
-.. GENERATED FROM PYTHON SOURCE LINES 329-335
+.. GENERATED FROM PYTHON SOURCE LINES 332-340
.. code-block:: Python
@@ -480,7 +483,9 @@ Watch the planets orbit the sun in your new animation!
showm.add_timer_callback(True, 10, timer_callback)
showm.start()
- window.record(showm.scene, size=(900, 768), out_path="viz_solar_system_animation.png")
+ fury.window.record(
+ showm.scene, size=(900, 768), out_path="viz_solar_system_animation.png"
+ )
.. _sphx_glr_download_auto_examples_01_introductory_viz_solar_system.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_sphere.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_sphere.rst.txt
index 75cbfb51d..0df138e50 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_sphere.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_sphere.rst.txt
@@ -30,7 +30,7 @@ This example shows how to use both primitive and vtkSource sphere actor.
import numpy as np
- from fury import actor, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 13-14
@@ -55,7 +55,7 @@ The below sphere actor is generated by repeating the sphere primitive.
.. code-block:: Python
- prim_sphere_actor = actor.sphere(centers, colors=colors, radii=5)
+ prim_sphere_actor = fury.actor.sphere(centers, colors=colors, radii=5)
.. GENERATED FROM PYTHON SOURCE LINES 24-25
@@ -70,9 +70,9 @@ This time, we're using vtkSphereSource to generate the sphere actor
cen2 = np.add(centers, np.array([12, 0, 0]))
cols2 = np.array([1, 0, 0])
- vtk_sphere_actor = actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False)
+ vtk_sphere_actor = fury.actor.sphere(cen2, colors=cols2, radii=5, use_primitive=False)
- scene = window.Scene()
+ scene = fury.window.Scene()
.. GENERATED FROM PYTHON SOURCE LINES 34-35
@@ -90,9 +90,9 @@ Adding our sphere actors to scene.
interactive = False
if interactive:
- window.show(scene, size=(600, 600))
+ fury.window.show(scene, size=(600, 600))
- window.record(scene, out_path="viz_sphere.png", size=(600, 600))
+ fury.window.record(scene, out_path="viz_sphere.png", size=(600, 600))
.. _sphx_glr_download_auto_examples_01_introductory_viz_sphere.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_spiky.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_spiky.rst.txt
index 0874e1ae9..06ee1ba63 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_spiky.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_spiky.rst.txt
@@ -32,7 +32,7 @@ In this tutorial, we show how to create a sphere with spikes.
import numpy as np
- from fury import actor, primitive, utils, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 15-19
@@ -47,7 +47,7 @@ Let's create a scene.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
.. GENERATED FROM PYTHON SOURCE LINES 23-26
@@ -61,7 +61,7 @@ of the surface normal.
.. code-block:: Python
- vertices, triangles = primitive.prim_sphere(name="symmetric362", gen_faces=False)
+ vertices, triangles = fury.primitive.prim_sphere(name="symmetric362", gen_faces=False)
.. GENERATED FROM PYTHON SOURCE LINES 30-32
@@ -74,7 +74,7 @@ green color.
.. code-block:: Python
- point_actor = actor.point(vertices, point_radius=0.01, colors=(0, 1, 0))
+ point_actor = fury.actor.point(vertices, point_radius=0.01, colors=(0, 1, 0))
.. GENERATED FROM PYTHON SOURCE LINES 36-39
@@ -88,7 +88,7 @@ whether triangles represent curved surfaces.
.. code-block:: Python
- normals = utils.normals_from_v_f(vertices, triangles)
+ normals = fury.utils.normals_from_v_f(vertices, triangles)
.. GENERATED FROM PYTHON SOURCE LINES 43-47
@@ -103,7 +103,7 @@ So, let's create an arrow actor at the center of each vertex.
.. code-block:: Python
- arrow_actor = actor.arrow(
+ arrow_actor = fury.actor.arrow(
centers=vertices,
directions=normals,
colors=(1, 0, 0),
@@ -126,7 +126,7 @@ To be able to visualize the surface of the primitive sphere, we use
primitive_colors = np.zeros(vertices.shape)
primitive_colors[:, 2] = 180
- primitive_actor = utils.get_actor_from_primitive(
+ primitive_actor = fury.utils.get_actor_from_primitive(
vertices=vertices,
triangles=triangles,
colors=primitive_colors,
@@ -147,7 +147,7 @@ We add all actors (visual objects) defined above to the scene.
scene.add(point_actor)
scene.add(arrow_actor)
scene.add(primitive_actor)
- scene.add(actor.axes())
+ scene.add(fury.actor.axes())
.. GENERATED FROM PYTHON SOURCE LINES 81-83
@@ -160,7 +160,7 @@ interactor.
.. code-block:: Python
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
@@ -201,7 +201,7 @@ application will exit after the callback has been called 20 times.
showm.add_timer_callback(True, 200, timer_callback)
showm.start()
- window.record(showm.scene, size=(900, 768), out_path="viz_spiky.png")
+ fury.window.record(showm.scene, size=(900, 768), out_path="viz_spiky.png")
.. GENERATED FROM PYTHON SOURCE LINES 114-116
diff --git a/dev/_sources/auto_examples/01_introductory/viz_surfaces.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_surfaces.rst.txt
index acf0de18f..d4e402317 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_surfaces.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_surfaces.rst.txt
@@ -30,39 +30,37 @@ surfaces.
structures. Here we show how to visualize a simple cube but the same idea
should apply for any surface.
-.. GENERATED FROM PYTHON SOURCE LINES 14-21
+.. GENERATED FROM PYTHON SOURCE LINES 14-19
.. code-block:: Python
import numpy as np
- from fury import utils, window
- from fury.io import load_polydata, save_polydata
- from fury.lib import PolyData
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 22-23
+.. GENERATED FROM PYTHON SOURCE LINES 20-21
Import useful functions
-.. GENERATED FROM PYTHON SOURCE LINES 26-27
+.. GENERATED FROM PYTHON SOURCE LINES 24-25
Create an empty ``PolyData``
-.. GENERATED FROM PYTHON SOURCE LINES 27-30
+.. GENERATED FROM PYTHON SOURCE LINES 25-28
.. code-block:: Python
- my_polydata = PolyData()
+ my_polydata = fury.lib.PolyData()
-.. GENERATED FROM PYTHON SOURCE LINES 31-32
+.. GENERATED FROM PYTHON SOURCE LINES 29-30
Create a cube with vertices and triangles as numpy arrays
-.. GENERATED FROM PYTHON SOURCE LINES 32-65
+.. GENERATED FROM PYTHON SOURCE LINES 30-63
.. code-block:: Python
@@ -100,83 +98,83 @@ Create a cube with vertices and triangles as numpy arrays
-.. GENERATED FROM PYTHON SOURCE LINES 66-67
+.. GENERATED FROM PYTHON SOURCE LINES 64-65
Set vertices and triangles in the ``PolyData``
-.. GENERATED FROM PYTHON SOURCE LINES 67-71
+.. GENERATED FROM PYTHON SOURCE LINES 65-69
.. code-block:: Python
- utils.set_polydata_vertices(my_polydata, my_vertices)
- utils.set_polydata_triangles(my_polydata, my_triangles)
+ fury.utils.set_polydata_vertices(my_polydata, my_vertices)
+ fury.utils.set_polydata_triangles(my_polydata, my_triangles)
-.. GENERATED FROM PYTHON SOURCE LINES 72-73
+.. GENERATED FROM PYTHON SOURCE LINES 70-71
Save the ``PolyData``
-.. GENERATED FROM PYTHON SOURCE LINES 73-78
+.. GENERATED FROM PYTHON SOURCE LINES 71-76
.. code-block:: Python
file_name = "my_cube.vtk"
- save_polydata(my_polydata, file_name)
+ fury.io.save_polydata(my_polydata, file_name)
print("Surface saved in " + file_name)
-.. GENERATED FROM PYTHON SOURCE LINES 79-80
+.. GENERATED FROM PYTHON SOURCE LINES 77-78
Load the ``PolyData``
-.. GENERATED FROM PYTHON SOURCE LINES 80-83
+.. GENERATED FROM PYTHON SOURCE LINES 78-81
.. code-block:: Python
- cube_polydata = load_polydata(file_name)
+ cube_polydata = fury.io.load_polydata(file_name)
-.. GENERATED FROM PYTHON SOURCE LINES 84-85
+.. GENERATED FROM PYTHON SOURCE LINES 82-83
add color based on vertices position
-.. GENERATED FROM PYTHON SOURCE LINES 85-93
+.. GENERATED FROM PYTHON SOURCE LINES 83-91
.. code-block:: Python
- cube_vertices = utils.get_polydata_vertices(cube_polydata)
+ cube_vertices = fury.utils.get_polydata_vertices(cube_polydata)
colors = cube_vertices * 255
- utils.set_polydata_colors(cube_polydata, colors)
+ fury.utils.set_polydata_colors(cube_polydata, colors)
print("new surface colors")
- print(utils.get_polydata_colors(cube_polydata))
+ print(fury.utils.get_polydata_colors(cube_polydata))
-.. GENERATED FROM PYTHON SOURCE LINES 94-95
+.. GENERATED FROM PYTHON SOURCE LINES 92-93
Visualize surfaces
-.. GENERATED FROM PYTHON SOURCE LINES 95-108
+.. GENERATED FROM PYTHON SOURCE LINES 93-106
.. code-block:: Python
# get Actor
- cube_actor = utils.get_actor_from_polydata(cube_polydata)
+ cube_actor = fury.utils.get_actor_from_polydata(cube_polydata)
# Create a scene
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(cube_actor)
scene.set_camera(position=(10, 5, 7), focal_point=(0.5, 0.5, 0.5))
scene.zoom(3)
# display
- # window.show(scene, size=(600, 600), reset_camera=False)
- window.record(scene, out_path="cube.png", size=(600, 600))
+ # fury.window.show(scene, size=(600, 600), reset_camera=False)
+ fury.window.record(scene, out_path="cube.png", size=(600, 600))
.. _sphx_glr_download_auto_examples_01_introductory_viz_surfaces.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_texture.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_texture.rst.txt
index 022350756..552842de1 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_texture.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_texture.rst.txt
@@ -23,73 +23,72 @@ Sphere Texture
===============
In this tutorial, we will show how to create a sphere with a texture.
-.. GENERATED FROM PYTHON SOURCE LINES 7-11
+.. GENERATED FROM PYTHON SOURCE LINES 7-10
.. code-block:: Python
- from fury import actor, io, window
- from fury.data import fetch_viz_textures, read_viz_textures
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 12-13
+.. GENERATED FROM PYTHON SOURCE LINES 11-12
Create a scene to start.
-.. GENERATED FROM PYTHON SOURCE LINES 13-16
+.. GENERATED FROM PYTHON SOURCE LINES 12-15
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
-.. GENERATED FROM PYTHON SOURCE LINES 17-21
+.. GENERATED FROM PYTHON SOURCE LINES 16-20
Load an image (png, bmp, jpeg or jpg) using ``io.load_image``. In this
example, we will use ``read_viz_textures`` to access an image of the
Earth's surface from the fury Github after using ''fetch_viz_textures()''
to download the available textures.
-.. GENERATED FROM PYTHON SOURCE LINES 21-26
+.. GENERATED FROM PYTHON SOURCE LINES 20-25
.. code-block:: Python
- fetch_viz_textures()
- filename = read_viz_textures("1_earth_8k.jpg")
- image = io.load_image(filename)
+ fury.data.fetch_viz_textures()
+ filename = fury.data.read_viz_textures("1_earth_8k.jpg")
+ image = fury.io.load_image(filename)
-.. GENERATED FROM PYTHON SOURCE LINES 27-31
+.. GENERATED FROM PYTHON SOURCE LINES 26-30
-Next, use ``actor.texture_on_sphere`` to add a sphere with the texture from
+Next, use ``fury.actor.texture_on_sphere`` to add a sphere with the texture from
your loaded image to the already existing scene.
To add a texture to your scene as visualized on a plane, use
-``actor.texture`` instead.
+``fury.actor.texture`` instead.
-.. GENERATED FROM PYTHON SOURCE LINES 31-34
+.. GENERATED FROM PYTHON SOURCE LINES 30-33
.. code-block:: Python
- scene.add(actor.texture_on_sphere(image))
+ scene.add(fury.actor.texture_on_sphere(image))
-.. GENERATED FROM PYTHON SOURCE LINES 35-37
+.. GENERATED FROM PYTHON SOURCE LINES 34-36
Lastly, record the scene, or set interactive to True if you would like to
manipulate your new sphere.
-.. GENERATED FROM PYTHON SOURCE LINES 37-42
+.. GENERATED FROM PYTHON SOURCE LINES 36-41
.. code-block:: Python
interactive = False
if interactive:
- window.show(scene, size=(600, 600), reset_camera=False)
- window.record(scene, size=(900, 768), out_path="viz_texture.png")
+ fury.window.show(scene, size=(600, 600), reset_camera=False)
+ fury.window.record(scene, size=(900, 768), out_path="viz_texture.png")
.. _sphx_glr_download_auto_examples_01_introductory_viz_texture.py:
diff --git a/dev/_sources/auto_examples/01_introductory/viz_timers.rst.txt b/dev/_sources/auto_examples/01_introductory/viz_timers.rst.txt
index 58c2fe27c..6ade4976d 100644
--- a/dev/_sources/auto_examples/01_introductory/viz_timers.rst.txt
+++ b/dev/_sources/auto_examples/01_introductory/viz_timers.rst.txt
@@ -40,24 +40,24 @@ application will exit after the callback has been called 100 times.
import numpy as np
- from fury import actor, ui, window
+ import fury
xyz = 10 * np.random.rand(100, 3)
colors = np.random.rand(100, 4)
radii = np.random.rand(100) + 0.5
- scene = window.Scene()
+ scene = fury.window.Scene()
- sphere_actor = actor.sphere(centers=xyz, colors=colors, radii=radii)
+ sphere_actor = fury.actor.sphere(centers=xyz, colors=colors, radii=radii)
scene.add(sphere_actor)
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
- tb = ui.TextBlock2D(bold=True)
+ tb = fury.ui.TextBlock2D(bold=True)
# use itertools to avoid global variables
counter = itertools.count()
@@ -89,7 +89,7 @@ application will exit after the callback has been called 100 times.
showm.start()
- window.record(showm.scene, size=(900, 768), out_path="viz_timer.png")
+ fury.window.record(showm.scene, size=(900, 768), out_path="viz_timer.png")
.. _sphx_glr_download_auto_examples_01_introductory_viz_timers.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_dt_ellipsoids.rst.txt b/dev/_sources/auto_examples/04_demos/viz_dt_ellipsoids.rst.txt
index 901da1cc1..358b7c547 100644
--- a/dev/_sources/auto_examples/04_demos/viz_dt_ellipsoids.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_dt_ellipsoids.rst.txt
@@ -29,7 +29,7 @@ amount of ellipsoids.
We start by importing the necessary modules:
-.. GENERATED FROM PYTHON SOURCE LINES 13-24
+.. GENERATED FROM PYTHON SOURCE LINES 13-21
.. code-block:: Python
@@ -39,45 +39,42 @@ We start by importing the necessary modules:
from dipy.io.image import load_nifti
import numpy as np
- from fury import actor, ui, window
- from fury.actor import _color_fa, _fa
- from fury.data import fetch_viz_dmri, read_viz_dmri
- from fury.primitive import prim_sphere
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 25-27
+.. GENERATED FROM PYTHON SOURCE LINES 22-24
Now, we fetch and load the data needed to display the Diffusion Tensor
Images.
-.. GENERATED FROM PYTHON SOURCE LINES 27-30
+.. GENERATED FROM PYTHON SOURCE LINES 24-27
.. code-block:: Python
- fetch_viz_dmri()
+ fury.data.fetch_viz_dmri()
-.. GENERATED FROM PYTHON SOURCE LINES 31-34
+.. GENERATED FROM PYTHON SOURCE LINES 28-31
The tensor ellipsoids are expressed as eigenvalues and eigenvectors which are
the decomposition of the diffusion tensor that describes the water diffusion
within a voxel.
-.. GENERATED FROM PYTHON SOURCE LINES 34-42
+.. GENERATED FROM PYTHON SOURCE LINES 31-39
.. code-block:: Python
- slice_evecs, _ = load_nifti(read_viz_dmri("slice_evecs.nii.gz"))
- slice_evals, _ = load_nifti(read_viz_dmri("slice_evals.nii.gz"))
- roi_evecs, _ = load_nifti(read_viz_dmri("roi_evecs.nii.gz"))
- roi_evals, _ = load_nifti(read_viz_dmri("roi_evals.nii.gz"))
- whole_brain_evecs, _ = load_nifti(read_viz_dmri("whole_brain_evecs.nii.gz"))
- whole_brain_evals, _ = load_nifti(read_viz_dmri("whole_brain_evals.nii.gz"))
+ slice_evecs, _ = load_nifti(fury.data.read_viz_dmri("slice_evecs.nii.gz"))
+ slice_evals, _ = load_nifti(fury.data.read_viz_dmri("slice_evals.nii.gz"))
+ roi_evecs, _ = load_nifti(fury.data.read_viz_dmri("roi_evecs.nii.gz"))
+ roi_evals, _ = load_nifti(fury.data.read_viz_dmri("roi_evals.nii.gz"))
+ whole_brain_evecs, _ = load_nifti(fury.data.read_viz_dmri("whole_brain_evecs.nii.gz"))
+ whole_brain_evals, _ = load_nifti(fury.data.read_viz_dmri("whole_brain_evals.nii.gz"))
-.. GENERATED FROM PYTHON SOURCE LINES 43-51
+.. GENERATED FROM PYTHON SOURCE LINES 40-48
Using tensor_slicer actor
=========================
@@ -88,21 +85,21 @@ the spheres. These are labeled as 'repulsionN' with N been the number of
vertices that made up the sphere, which have a standard number of 100, 200,
and 724 vertices.
-.. GENERATED FROM PYTHON SOURCE LINES 51-55
+.. GENERATED FROM PYTHON SOURCE LINES 48-52
.. code-block:: Python
- vertices, faces = prim_sphere("repulsion100", True)
+ vertices, faces = fury.prim_sphere("repulsion100", True)
-.. GENERATED FROM PYTHON SOURCE LINES 56-58
+.. GENERATED FROM PYTHON SOURCE LINES 53-55
As we need to provide a sphere object we create a class Sphere to which we
assign the values obtained from vertices and faces.
-.. GENERATED FROM PYTHON SOURCE LINES 58-68
+.. GENERATED FROM PYTHON SOURCE LINES 55-65
.. code-block:: Python
@@ -117,38 +114,38 @@ assign the values obtained from vertices and faces.
sphere100 = Sphere(vertices, faces)
-.. GENERATED FROM PYTHON SOURCE LINES 69-72
+.. GENERATED FROM PYTHON SOURCE LINES 66-69
Now we are ready to create the ``tensor_slicer`` actor with the values of a
brain slice. We also define the scale so that the tensors are not so large
and overlap each other.
-.. GENERATED FROM PYTHON SOURCE LINES 72-77
+.. GENERATED FROM PYTHON SOURCE LINES 69-74
.. code-block:: Python
- tensor_slice = actor.tensor_slicer(
+ tensor_slice = fury.actor.tensor_slicer(
evals=slice_evals, evecs=slice_evecs, sphere=sphere100, scale=0.3
)
-.. GENERATED FROM PYTHON SOURCE LINES 78-80
+.. GENERATED FROM PYTHON SOURCE LINES 75-77
Next, we set up a new scene to add and visualize the tensor ellipsoids
created.
-.. GENERATED FROM PYTHON SOURCE LINES 80-96
+.. GENERATED FROM PYTHON SOURCE LINES 77-93
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background([255, 255, 255])
scene.add(tensor_slice)
# Create show manager
- showm = window.ShowManager(scene, size=(600, 600))
+ showm = fury.window.ShowManager(scene, size=(600, 600))
# Enables/disables interactive visualization
interactive = False
@@ -156,29 +153,29 @@ created.
if interactive:
showm.start()
- window.record(showm.scene, size=(600, 600), out_path="tensor_slice_100.png")
+ fury.window.record(showm.scene, size=(600, 600), out_path="tensor_slice_100.png")
-.. GENERATED FROM PYTHON SOURCE LINES 97-99
+.. GENERATED FROM PYTHON SOURCE LINES 94-96
If we zoom in at the scene to see with detail the tensor ellipsoids displayed
with the different spheres, we get the following results.
-.. GENERATED FROM PYTHON SOURCE LINES 99-116
+.. GENERATED FROM PYTHON SOURCE LINES 96-113
.. code-block:: Python
scene.roll(10)
scene.pitch(90)
- showm = window.ShowManager(scene, size=(600, 600), order_transparent=True)
+ showm = fury.window.ShowManager(scene, size=(600, 600), order_transparent=True)
showm.scene.zoom(50)
if interactive:
showm.render()
showm.start()
- window.record(
+ fury.window.record(
showm.scene,
out_path="tensor_slice_100_zoom.png",
size=(600, 300),
@@ -186,7 +183,7 @@ with the different spheres, we get the following results.
)
-.. GENERATED FROM PYTHON SOURCE LINES 117-123
+.. GENERATED FROM PYTHON SOURCE LINES 114-120
To render the same tensor slice using a different sphere we redefine the
vertices and faces of the sphere using prim_sphere with other sphere
@@ -195,7 +192,7 @@ specification, as 'repulsion200' or 'repulsion724'.
Now we clear the scene for the next visualization, and revert the scene
rotations.
-.. GENERATED FROM PYTHON SOURCE LINES 123-129
+.. GENERATED FROM PYTHON SOURCE LINES 120-126
.. code-block:: Python
@@ -206,7 +203,7 @@ rotations.
-.. GENERATED FROM PYTHON SOURCE LINES 130-136
+.. GENERATED FROM PYTHON SOURCE LINES 127-133
Using ellipsoid actor
=====================
@@ -215,7 +212,7 @@ need to set additional parameters. For this purpose, we define a helper
function to facilitate the correct setting of the parameters before passing
them to the actor.
-.. GENERATED FROM PYTHON SOURCE LINES 136-159
+.. GENERATED FROM PYTHON SOURCE LINES 133-156
.. code-block:: Python
@@ -237,18 +234,18 @@ them to the actor.
# coloring in tensor_slicer that is uses _color_fa that is a way to map
# colors to each tensor based on the fractional anisotropy (FA) of each
# diffusion tensor.
- colors = _color_fa(_fa(fevals), fevecs)
+ colors = fury.actor._color_fa(fury.actor._fa(fevals), fevecs)
return centers, fevecs, fevals, colors
-.. GENERATED FROM PYTHON SOURCE LINES 160-162
+.. GENERATED FROM PYTHON SOURCE LINES 157-159
With this we now have the values we need to define the centers, axes,
lengths, and colors of the ellipsoids.
-.. GENERATED FROM PYTHON SOURCE LINES 162-165
+.. GENERATED FROM PYTHON SOURCE LINES 159-162
.. code-block:: Python
@@ -256,17 +253,17 @@ lengths, and colors of the ellipsoids.
centers, evecs, evals, colors = get_params(slice_evecs, slice_evals)
-.. GENERATED FROM PYTHON SOURCE LINES 166-168
+.. GENERATED FROM PYTHON SOURCE LINES 163-165
Now, we can use the ``ellipsoid`` actor to create the tensor ellipsoids as
follows.
-.. GENERATED FROM PYTHON SOURCE LINES 168-179
+.. GENERATED FROM PYTHON SOURCE LINES 165-176
.. code-block:: Python
- tensors = actor.ellipsoid(
+ tensors = fury.actor.ellipsoid(
centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6
)
showm.scene.add(tensors)
@@ -274,10 +271,10 @@ follows.
if interactive:
showm.start()
- window.record(scene, size=(600, 600), out_path="tensor_slice_sdf.png")
+ fury.window.record(scene, size=(600, 600), out_path="tensor_slice_sdf.png")
-.. GENERATED FROM PYTHON SOURCE LINES 180-185
+.. GENERATED FROM PYTHON SOURCE LINES 177-182
Thus, one can see that the same result is obtained, however there is a
difference in the visual quality and this is because the ``ellipsoid`` actor
@@ -285,21 +282,21 @@ uses raymarching technique, so the objects that are generated are smoother
since they are not made with polygons but defined by an SDF function. Next we
can see in more detail the tensor ellipsoids generated.
-.. GENERATED FROM PYTHON SOURCE LINES 185-206
+.. GENERATED FROM PYTHON SOURCE LINES 182-203
.. code-block:: Python
scene.roll(10)
scene.pitch(90)
- showm = window.ShowManager(scene, size=(600, 600), order_transparent=True)
+ showm = fury.window.ShowManager(scene, size=(600, 600), order_transparent=True)
showm.scene.zoom(50)
if interactive:
showm.render()
showm.start()
- window.record(
+ fury.window.record(
showm.scene,
out_path="tensor_slice_sdf_zoom.png",
size=(600, 300),
@@ -311,7 +308,7 @@ can see in more detail the tensor ellipsoids generated.
showm.scene.roll(-10)
-.. GENERATED FROM PYTHON SOURCE LINES 207-215
+.. GENERATED FROM PYTHON SOURCE LINES 204-212
Visual quality comparison
=========================
@@ -322,7 +319,7 @@ same time, so we can see this in more detail.
We first set up the required data and create the actors.
-.. GENERATED FROM PYTHON SOURCE LINES 215-241
+.. GENERATED FROM PYTHON SOURCE LINES 212-244
.. code-block:: Python
@@ -338,40 +335,46 @@ We first set up the required data and create the actors.
evals[..., :] = mevals
evecs[..., :, :] = mevecs
- vertices, faces = prim_sphere("repulsion200", True)
+ vertices, faces = fury.prim_sphere("repulsion200", True)
sphere200 = Sphere(vertices, faces)
- vertices, faces = prim_sphere("repulsion724", True)
+ vertices, faces = fury.prim_sphere("repulsion724", True)
sphere724 = Sphere(vertices, faces)
- tensor_100 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere100, scale=1.0)
- tensor_200 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere200, scale=1.0)
- tensor_724 = actor.tensor_slicer(evals=evals, evecs=evecs, sphere=sphere724, scale=1.0)
+ tensor_100 = fury.actor.tensor_slicer(
+ evals=evals, evecs=evecs, sphere=sphere100, scale=1.0
+ )
+ tensor_200 = fury.actor.tensor_slicer(
+ evals=evals, evecs=evecs, sphere=sphere200, scale=1.0
+ )
+ tensor_724 = fury.actor.tensor_slicer(
+ evals=evals, evecs=evecs, sphere=sphere724, scale=1.0
+ )
centers, evecs, evals, colors = get_params(evecs=evecs, evals=evals)
- tensor_sdf = actor.ellipsoid(
+ tensor_sdf = fury.actor.ellipsoid(
centers=centers, axes=evecs, lengths=evals, colors=colors, scales=2.0
)
-.. GENERATED FROM PYTHON SOURCE LINES 242-244
+.. GENERATED FROM PYTHON SOURCE LINES 245-247
Next, we made use of `GridUI` which allows us to add the actors in a grid and
interact with them individually.
-.. GENERATED FROM PYTHON SOURCE LINES 244-281
+.. GENERATED FROM PYTHON SOURCE LINES 247-284
.. code-block:: Python
objects = [tensor_100, tensor_200, tensor_724, tensor_sdf]
text = [
- actor.vector_text("Tensor 100"),
- actor.vector_text("Tensor 200"),
- actor.vector_text("Tensor 724"),
- actor.vector_text("Tensor SDF"),
+ fury.actor.vector_text("Tensor 100"),
+ fury.actor.vector_text("Tensor 200"),
+ fury.actor.vector_text("Tensor 724"),
+ fury.actor.vector_text("Tensor SDF"),
]
- grid_ui = ui.GridUI(
+ grid_ui = fury.ui.GridUI(
actors=objects,
captions=text,
cell_padding=0.1,
@@ -379,17 +382,17 @@ interact with them individually.
dim=(1, 4),
)
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background([255, 255, 255])
scene.zoom(3.5)
scene.set_camera(position=(3.2, -20, 12), focal_point=(3.2, 0.0, 0.0))
- showm = window.ShowManager(scene, size=(560, 200))
+ showm = fury.window.ShowManager(scene, size=(560, 200))
showm.scene.add(grid_ui)
if interactive:
showm.start()
- window.record(
+ fury.window.record(
showm.scene,
size=(560, 200),
out_path="tensor_comparison.png",
@@ -400,7 +403,7 @@ interact with them individually.
showm.scene.clear()
-.. GENERATED FROM PYTHON SOURCE LINES 282-287
+.. GENERATED FROM PYTHON SOURCE LINES 285-290
Visualize a larger amount of data
=================================
@@ -408,12 +411,12 @@ With ``tensor_slicer`` is possible to visualize more than one slice using
``display_extent()``. Here we can see an example of a region of interest
(ROI) using a sphere of 100 vertices.
-.. GENERATED FROM PYTHON SOURCE LINES 287-307
+.. GENERATED FROM PYTHON SOURCE LINES 290-310
.. code-block:: Python
- tensor_roi = actor.tensor_slicer(
+ tensor_roi = fury.actor.tensor_slicer(
evals=roi_evals, evecs=roi_evecs, sphere=sphere100, scale=0.3
)
@@ -428,26 +431,26 @@ With ``tensor_slicer`` is possible to visualize more than one slice using
if interactive:
showm.start()
- window.record(showm.scene, size=(600, 600), out_path="tensor_roi_100.png")
+ fury.window.record(showm.scene, size=(600, 600), out_path="tensor_roi_100.png")
showm.scene.clear()
-.. GENERATED FROM PYTHON SOURCE LINES 308-312
+.. GENERATED FROM PYTHON SOURCE LINES 311-315
We can do it also with a sphere of 200 vertices, but if we try to do it with
one of 724 the visualization can no longer be rendered. In contrast, we can
visualize the ROI with the ``ellipsoid`` actor without compromising the
quality of the visualization.
-.. GENERATED FROM PYTHON SOURCE LINES 312-327
+.. GENERATED FROM PYTHON SOURCE LINES 315-330
.. code-block:: Python
centers, evecs, evals, colors = get_params(roi_evecs, roi_evals)
- tensors = actor.ellipsoid(
+ tensors = fury.actor.ellipsoid(
centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6
)
showm.scene.add(tensors)
@@ -455,18 +458,18 @@ quality of the visualization.
if interactive:
showm.start()
- window.record(showm.scene, size=(600, 600), out_path="tensor_roi_sdf.png")
+ fury.window.record(showm.scene, size=(600, 600), out_path="tensor_roi_sdf.png")
showm.scene.clear()
-.. GENERATED FROM PYTHON SOURCE LINES 328-331
+.. GENERATED FROM PYTHON SOURCE LINES 331-334
In fact, although with a low performance, this actor allows us to visualize
the whole brain, which contains a much larger amount of data, to be exact
184512 tensor ellipsoids are displayed at the same time.
-.. GENERATED FROM PYTHON SOURCE LINES 331-361
+.. GENERATED FROM PYTHON SOURCE LINES 334-364
.. code-block:: Python
@@ -480,19 +483,19 @@ the whole brain, which contains a much larger amount of data, to be exact
evecs = np.array(list(itertools.compress(evecs, fil)))
evals = np.array(list(itertools.compress(evals, fil)))
- tensors = actor.ellipsoid(
+ tensors = fury.actor.ellipsoid(
centers=centers, colors=colors, axes=evecs, lengths=evals, scales=0.6
)
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(tensors)
scene.pitch(180)
- showm = window.ShowManager(scene, size=(600, 600))
+ showm = fury.window.ShowManager(scene, size=(600, 600))
if interactive:
showm.start()
- window.record(
+ fury.window.record(
showm.scene,
size=(600, 600),
reset_camera=False,
diff --git a/dev/_sources/auto_examples/04_demos/viz_emwave_animation.rst.txt b/dev/_sources/auto_examples/04_demos/viz_emwave_animation.rst.txt
index 113b8f940..6045a162f 100644
--- a/dev/_sources/auto_examples/04_demos/viz_emwave_animation.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_emwave_animation.rst.txt
@@ -42,7 +42,7 @@ Importing necessary modules
import numpy as np
- from fury import actor, ui, utils, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 25-27
@@ -110,11 +110,11 @@ Creating a scene object and configuring the camera's position
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.set_camera(
position=(-6, 5, -10), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)
)
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(800, 600), reset_camera=True, order_transparent=True
)
@@ -133,10 +133,10 @@ electromagnetic wave
centers = np.array([[3, 0, 0]])
directions = np.array([[-1, 0, 0]])
heights = np.array([6.4])
- arrow_actor = actor.arrow(
+ arrow_actor = fury.actor.arrow(
centers,
directions,
- window.colors.yellow,
+ fury.window.colors.yellow,
heights,
resolution=20,
tip_length=0.06,
@@ -162,12 +162,12 @@ Creating point actor that renders the magnetic field
pts = np.array(list(zip(x, y, z)))
pts = [pts]
- colors = window.colors.red
- wave_actor1 = actor.line(pts, colors, linewidth=3)
+ colors = fury.window.colors.red
+ wave_actor1 = fury.actor.line(pts, colors, linewidth=3)
scene.add(wave_actor1)
- vertices = utils.vertices_from_actor(wave_actor1)
- vcolors = utils.colors_from_actor(wave_actor1, "colors")
+ vertices = fury.utils.vertices_from_actor(wave_actor1)
+ vcolors = fury.utils.colors_from_actor(wave_actor1, "colors")
no_vertices_per_point = len(vertices) / npoints
initial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0)
@@ -188,12 +188,12 @@ Creating point actor that renders the electric field
pts2 = np.array(list(zip(xx, yy, zz)))
pts2 = [pts2]
- colors2 = window.colors.blue
- wave_actor2 = actor.line(pts2, colors2, linewidth=3)
+ colors2 = fury.window.colors.blue
+ wave_actor2 = fury.actor.line(pts2, colors2, linewidth=3)
scene.add(wave_actor2)
- vertices2 = utils.vertices_from_actor(wave_actor2)
- vcolors2 = utils.colors_from_actor(wave_actor2, "colors")
+ vertices2 = fury.utils.vertices_from_actor(wave_actor2)
+ vcolors2 = fury.utils.colors_from_actor(wave_actor2, "colors")
no_vertices_per_point2 = len(vertices2) / npoints
initial_vertices2 = vertices2.copy() - np.repeat(pts2, no_vertices_per_point2, axis=0)
@@ -208,7 +208,7 @@ Initializing text box to display the title of the animation
.. code-block:: Python
- tb = ui.TextBlock2D(bold=True, position=(160, 90))
+ tb = fury.ui.TextBlock2D(bold=True, position=(160, 90))
tb.message = "Electromagnetic Wave"
scene.add(tb)
@@ -257,12 +257,12 @@ using the update_coordinates function. The wave is rendered here.
x, y, z = update_coordinates(wavenumber, angular_frq, phase_angle, time)
pts = np.array(list(zip(x, y, z)))
vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0)
- utils.update_actor(wave_actor1)
+ fury.utils.update_actor(wave_actor1)
xx, zz, yy = update_coordinates(wavenumber, angular_frq, phase_angle, time)
pts2 = np.array(list(zip(xx, yy, zz)))
vertices2[:] = initial_vertices2 + np.repeat(pts2, no_vertices_per_point2, axis=0)
- utils.update_actor(wave_actor2)
+ fury.utils.update_actor(wave_actor2)
showm.render()
@@ -286,7 +286,7 @@ Run every 25 milliseconds
interactive = False
if interactive:
showm.start()
- window.record(showm.scene, size=(800, 600), out_path="viz_emwave.png")
+ fury.window.record(showm.scene, size=(800, 600), out_path="viz_emwave.png")
.. _sphx_glr_download_auto_examples_04_demos_viz_emwave_animation.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_fiber_odf.rst.txt b/dev/_sources/auto_examples/04_demos/viz_fiber_odf.rst.txt
index 92dba2911..9d0274c81 100644
--- a/dev/_sources/auto_examples/04_demos/viz_fiber_odf.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_fiber_odf.rst.txt
@@ -25,7 +25,7 @@ Brain Fiber ODF Visualisation
This example demonstrate how to create a simple viewer for fiber
orientation distribution functions (ODF) using fury's odf_slicer.
-.. GENERATED FROM PYTHON SOURCE LINES 9-21
+.. GENERATED FROM PYTHON SOURCE LINES 9-19
.. code-block:: Python
@@ -37,36 +37,34 @@ orientation distribution functions (ODF) using fury's odf_slicer.
# First, we import some useful modules and methods.
import numpy as np
- from fury import actor, ui, window
- from fury.data import fetch_viz_dmri, fetch_viz_icons, read_viz_dmri
- from fury.utils import fix_winding_order
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 22-24
+.. GENERATED FROM PYTHON SOURCE LINES 20-22
Here, we fetch and load the fiber ODF volume to display. The ODF are
expressed as spherical harmonics (SH) coefficients in a 3D grid.
-.. GENERATED FROM PYTHON SOURCE LINES 24-32
+.. GENERATED FROM PYTHON SOURCE LINES 22-30
.. code-block:: Python
- fetch_viz_dmri()
- fetch_viz_icons()
+ fury.data.fetch_viz_dmri()
+ fury.data.fetch_viz_icons()
- fodf_img = nib.load(read_viz_dmri("fodf.nii.gz"))
+ fodf_img = nib.load(fury.data.read_viz_dmri("fodf.nii.gz"))
sh = fodf_img.get_fdata()
affine = fodf_img.affine
grid_shape = sh.shape[:-1]
-.. GENERATED FROM PYTHON SOURCE LINES 33-36
+.. GENERATED FROM PYTHON SOURCE LINES 31-34
We then define a low resolution sphere used to visualize SH coefficients
as spherical functions (SF) as well as a matrix `B_low` to project SH
onto the sphere.
-.. GENERATED FROM PYTHON SOURCE LINES 36-39
+.. GENERATED FROM PYTHON SOURCE LINES 34-37
.. code-block:: Python
@@ -74,12 +72,12 @@ onto the sphere.
B_low = sh_to_sf_matrix(sphere_low, 8, return_inv=False)
-.. GENERATED FROM PYTHON SOURCE LINES 40-42
+.. GENERATED FROM PYTHON SOURCE LINES 38-40
Now, we create a slicer for each orientation to display a slice in
the middle of the volume and we add them to a `scene`.
-.. GENERATED FROM PYTHON SOURCE LINES 42-107
+.. GENERATED FROM PYTHON SOURCE LINES 40-105
.. code-block:: Python
@@ -93,7 +91,7 @@ the middle of the volume and we add them to a `scene`.
global_cm = False
# ODF slicer for axial slice
- odf_actor_z = actor.odf_slicer(
+ odf_actor_z = fury.actor.odf_slicer(
sh,
affine=affine,
sphere=sphere_low,
@@ -107,7 +105,7 @@ the middle of the volume and we add them to a `scene`.
)
# ODF slicer for coronal slice
- odf_actor_y = actor.odf_slicer(
+ odf_actor_y = fury.actor.odf_slicer(
sh,
affine=affine,
sphere=sphere_low,
@@ -124,7 +122,7 @@ the middle of the volume and we add them to a `scene`.
)
# ODF slicer for sagittal slice
- odf_actor_x = actor.odf_slicer(
+ odf_actor_x = fury.actor.odf_slicer(
sh,
affine=affine,
sphere=sphere_low,
@@ -140,25 +138,25 @@ the middle of the volume and we add them to a `scene`.
grid_shape[0] // 2, grid_shape[0] // 2, 0, grid_shape[1] - 1, 0, grid_shape[2] - 1
)
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(odf_actor_z)
scene.add(odf_actor_y)
scene.add(odf_actor_x)
- show_m = window.ShowManager(scene, reset_camera=True, size=(1200, 900))
+ show_m = fury.window.ShowManager(scene, reset_camera=True, size=(1200, 900))
-.. GENERATED FROM PYTHON SOURCE LINES 108-110
+.. GENERATED FROM PYTHON SOURCE LINES 106-108
Now that we have a `ShowManager` containing our slicer, we can go on and
configure our UI for changing the slices to visualize.
-.. GENERATED FROM PYTHON SOURCE LINES 110-134
+.. GENERATED FROM PYTHON SOURCE LINES 108-132
.. code-block:: Python
- line_slider_z = ui.LineSlider2D(
+ line_slider_z = fury.ui.LineSlider2D(
min_value=0,
max_value=grid_shape[2] - 1,
initial_value=grid_shape[2] / 2,
@@ -166,7 +164,7 @@ configure our UI for changing the slices to visualize.
length=140,
)
- line_slider_y = ui.LineSlider2D(
+ line_slider_y = fury.ui.LineSlider2D(
min_value=0,
max_value=grid_shape[1] - 1,
initial_value=grid_shape[1] / 2,
@@ -174,7 +172,7 @@ configure our UI for changing the slices to visualize.
length=140,
)
- line_slider_x = ui.LineSlider2D(
+ line_slider_x = fury.ui.LineSlider2D(
min_value=0,
max_value=grid_shape[0] - 1,
initial_value=grid_shape[0] / 2,
@@ -183,12 +181,12 @@ configure our UI for changing the slices to visualize.
)
-.. GENERATED FROM PYTHON SOURCE LINES 135-137
+.. GENERATED FROM PYTHON SOURCE LINES 133-135
We also define a high resolution sphere to demonstrate the capability to
dynamically change the sphere used for SH to SF projection.
-.. GENERATED FROM PYTHON SOURCE LINES 137-144
+.. GENERATED FROM PYTHON SOURCE LINES 135-144
.. code-block:: Python
@@ -196,7 +194,9 @@ dynamically change the sphere used for SH to SF projection.
# We fix the order of the faces' three vertices to a clockwise winding. This
# ensures all faces have a normal going away from the center of the sphere.
- sphere_high.faces = fix_winding_order(sphere_high.vertices, sphere_high.faces, True)
+ sphere_high.faces = fury.utils.fix_winding_order(
+ sphere_high.vertices, sphere_high.faces, True
+ )
B_high = sh_to_sf_matrix(sphere_high, 8, return_inv=False)
@@ -212,7 +212,7 @@ We add a combobox for choosing the sphere resolution during execution.
"Low resolution": (sphere_low, B_low),
"High resolution": (sphere_high, B_high),
}
- combobox = ui.ComboBox2D(items=list(sphere_dict))
+ combobox = fury.ui.ComboBox2D(items=list(sphere_dict))
scene.add(combobox)
@@ -265,7 +265,7 @@ We then add labels for the sliders and position them inside a panel.
def build_label(text):
- label = ui.TextBlock2D()
+ label = fury.ui.TextBlock2D()
label.message = text
label.font_size = 18
label.font_family = "Arial"
@@ -283,7 +283,7 @@ We then add labels for the sliders and position them inside a panel.
line_slider_label_y = build_label(text="Y Slice")
line_slider_label_x = build_label(text="X Slice")
- panel = ui.Panel2D(size=(300, 200), color=(1, 1, 1), opacity=0.1, align="right")
+ panel = fury.ui.Panel2D(size=(300, 200), color=(1, 1, 1), opacity=0.1, align="right")
panel.center = (1030, 120)
panel.add_element(line_slider_label_x, (0.1, 0.75))
@@ -338,7 +338,7 @@ datasets in 3D.
show_m.render()
show_m.start()
else:
- window.record(
+ fury.window.record(
scene, out_path="odf_slicer_3D.png", size=(1200, 900), reset_camera=False
)
diff --git a/dev/_sources/auto_examples/04_demos/viz_fine_tuning_gl_context.rst.txt b/dev/_sources/auto_examples/04_demos/viz_fine_tuning_gl_context.rst.txt
index ac05b88ac..281cc6bb4 100644
--- a/dev/_sources/auto_examples/04_demos/viz_fine_tuning_gl_context.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_fine_tuning_gl_context.rst.txt
@@ -31,7 +31,7 @@ specialized visualization effects.
First, let's import some functions
-.. GENERATED FROM PYTHON SOURCE LINES 14-23
+.. GENERATED FROM PYTHON SOURCE LINES 14-21
.. code-block:: Python
@@ -40,17 +40,15 @@ First, let's import some functions
import numpy as np
- from fury import actor, window
- from fury.shaders import shader_apply_effects
- from fury.utils import remove_observer_from_actor
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 24-26
+.. GENERATED FROM PYTHON SOURCE LINES 22-24
We just proceed as usual: creating the actors and initializing a scene in
FURY
-.. GENERATED FROM PYTHON SOURCE LINES 26-76
+.. GENERATED FROM PYTHON SOURCE LINES 24-74
.. code-block:: Python
@@ -58,21 +56,21 @@ FURY
centers = np.array([[0, 0, 0], [-0.1, 0, 0], [0.1, 0, 0]])
colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
- actor_no_depth_test = actor.markers(
+ actor_no_depth_test = fury.actor.markers(
centers,
marker="s",
colors=colors,
marker_opacity=0.5,
scales=0.2,
)
- actor_normal_blending = actor.markers(
+ actor_normal_blending = fury.actor.markers(
centers - np.array([[0, -0.5, 0]]),
marker="s",
colors=colors,
marker_opacity=0.5,
scales=0.2,
)
- actor_add_blending = actor.markers(
+ actor_add_blending = fury.actor.markers(
centers - np.array([[0, -1, 0]]),
marker="s",
colors=colors,
@@ -80,14 +78,14 @@ FURY
scales=0.2,
)
- actor_sub_blending = actor.markers(
+ actor_sub_blending = fury.actor.markers(
centers - np.array([[0, -1.5, 0]]),
marker="s",
colors=colors,
marker_opacity=0.5,
scales=0.2,
)
- actor_mul_blending = actor.markers(
+ actor_mul_blending = fury.actor.markers(
centers - np.array([[0, -2, 0]]),
marker="s",
colors=colors,
@@ -96,20 +94,20 @@ FURY
)
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background((0.5, 0.5, 0.5))
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=False
)
-.. GENERATED FROM PYTHON SOURCE LINES 77-78
+.. GENERATED FROM PYTHON SOURCE LINES 75-76
All actors must be added in the scene
-.. GENERATED FROM PYTHON SOURCE LINES 78-84
+.. GENERATED FROM PYTHON SOURCE LINES 76-82
.. code-block:: Python
@@ -120,7 +118,7 @@ All actors must be added in the scene
scene.add(actor_sub_blending)
scene.add(actor_mul_blending)
-.. GENERATED FROM PYTHON SOURCE LINES 85-91
+.. GENERATED FROM PYTHON SOURCE LINES 83-89
Now, we will enter in the topic of this example. First, we need to create
(or use one of the pre-built gl_function of FURY) to
@@ -129,49 +127,53 @@ change the OpenGL state of a given fury window instance (showm.window).
Here we're using the pre-build FURY window functions which has already a
set of specific behaviors to be applied in the OpenGL context
-.. GENERATED FROM PYTHON SOURCE LINES 91-124
+.. GENERATED FROM PYTHON SOURCE LINES 89-126
.. code-block:: Python
- shader_apply_effects(
- showm.window, actor_normal_blending, effects=window.gl_set_normal_blending
+ fury.shaders.shader_apply_effects(
+ showm.window, actor_normal_blending, effects=fury.window.gl_set_normal_blending
)
# ###############################################################################
# It's also possible use a list of effects. The final opengl state it'll
# be the composition of each effect that each function has in the opengl state
- id_observer = shader_apply_effects(
+ id_observer = fury.shaders.shader_apply_effects(
showm.window,
actor_no_depth_test,
- effects=[window.gl_reset_blend, window.gl_disable_blend, window.gl_disable_depth],
+ effects=[
+ fury.window.gl_reset_blend,
+ fury.window.gl_disable_blend,
+ fury.window.gl_disable_depth,
+ ],
)
- shader_apply_effects(
+ fury.shaders.shader_apply_effects(
showm.window,
actor_add_blending,
effects=[
- window.gl_reset_blend,
- window.gl_enable_depth,
- window.gl_set_additive_blending,
+ fury.window.gl_reset_blend,
+ fury.window.gl_enable_depth,
+ fury.window.gl_set_additive_blending,
],
)
- shader_apply_effects(
- showm.window, actor_sub_blending, effects=window.gl_set_subtractive_blending
+ fury.shaders.shader_apply_effects(
+ showm.window, actor_sub_blending, effects=fury.window.gl_set_subtractive_blending
)
- shader_apply_effects(
- showm.window, actor_mul_blending, effects=window.gl_set_multiplicative_blending
+ fury.shaders.shader_apply_effects(
+ showm.window, actor_mul_blending, effects=fury.window.gl_set_multiplicative_blending
)
-.. GENERATED FROM PYTHON SOURCE LINES 125-126
+.. GENERATED FROM PYTHON SOURCE LINES 127-128
Finally, just render and see the results
-.. GENERATED FROM PYTHON SOURCE LINES 126-154
+.. GENERATED FROM PYTHON SOURCE LINES 128-158
.. code-block:: Python
@@ -189,9 +191,11 @@ Finally, just render and see the results
# the results of each specific opengl-state
showm.scene.azimuth(1)
if cnt == 400:
- remove_observer_from_actor(actor_no_depth_test, id_observer)
- shader_apply_effects(
- showm.window, actor_no_depth_test, effects=window.gl_set_additive_blending
+ fury.utils.remove_observer_from_actor(actor_no_depth_test, id_observer)
+ fury.shaders.shader_apply_effects(
+ showm.window,
+ actor_no_depth_test,
+ effects=fury.window.gl_set_additive_blending,
)
if cnt == 1000:
showm.exit()
@@ -202,7 +206,7 @@ Finally, just render and see the results
if interactive:
showm.start()
- window.record(scene, out_path="viz_fine_tuning_gl_context.png", size=(600, 600))
+ fury.window.record(scene, out_path="viz_fine_tuning_gl_context.png", size=(600, 600))
.. _sphx_glr_download_auto_examples_04_demos_viz_fine_tuning_gl_context.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_fractals.rst.txt b/dev/_sources/auto_examples/04_demos/viz_fractals.rst.txt
index 2614a32b8..5181dcc77 100644
--- a/dev/_sources/auto_examples/04_demos/viz_fractals.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_fractals.rst.txt
@@ -44,7 +44,7 @@ for this demo.
import numpy as np
- from fury import primitive, ui, utils, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 27-51
@@ -95,7 +95,7 @@ for the new centers, provided that the tetrahedron is centered at the origin
offset = (4**N - 1) // 3 + 1
# just need the vertices
- U, _ = primitive.prim_tetrahedron()
+ U, _ = fury.primitive.prim_tetrahedron()
def gen_centers(depth, pos, center, dist):
if depth == N:
@@ -109,7 +109,7 @@ for the new centers, provided that the tetrahedron is centered at the origin
# the division by sqrt(6) is to ensure correct scale
gen_centers(0, 1, np.zeros(3), 2 / (6**0.5))
- vertices, faces = primitive.prim_tetrahedron()
+ vertices, faces = fury.primitive.prim_tetrahedron()
# primitive is scaled down depending on level
vertices /= 2 ** (N - 1)
@@ -118,10 +118,10 @@ for the new centers, provided that the tetrahedron is centered at the origin
bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)
colors = (centers - bounds_min) / (bounds_max - bounds_min)
- vertices, triangles, colors, _ = primitive.repeat_primitive(
+ vertices, triangles, colors, _ = fury.primitive.repeat_primitive(
centers=centers, colors=colors, vertices=vertices, faces=faces
)
- return utils.get_actor_from_primitive(vertices, triangles, colors)
+ return fury.utils.get_actor_from_primitive(vertices, triangles, colors)
@@ -187,16 +187,16 @@ level.
gen_centers(0, 1, np.zeros(3), 1 / 3)
- vertices, faces = primitive.prim_box()
+ vertices, faces = fury.primitive.prim_box()
vertices /= 3**N
bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)
colors = (centers - bounds_min) / (bounds_max - bounds_min)
- vertices, triangles, colors, _ = primitive.repeat_primitive(
+ vertices, triangles, colors, _ = fury.primitive.repeat_primitive(
centers=centers, colors=colors, vertices=vertices, faces=faces
)
- return utils.get_actor_from_primitive(vertices, triangles, colors)
+ return fury.utils.get_actor_from_primitive(vertices, triangles, colors)
@@ -249,16 +249,16 @@ possible to see the Koch snowflake if you position the camera just right.
gen_centers(0, 1, np.zeros(3), 1 / 3)
- vertices, faces = primitive.prim_box()
+ vertices, faces = fury.primitive.prim_box()
vertices /= 3**N
bounds_min, bounds_max = np.min(centers, axis=0), np.max(centers, axis=0)
colors = (centers - bounds_min) / (bounds_max - bounds_min)
- vertices, triangles, colors, _ = primitive.repeat_primitive(
+ vertices, triangles, colors, _ = fury.primitive.repeat_primitive(
centers=centers, colors=colors, vertices=vertices, faces=faces
)
- return utils.get_actor_from_primitive(vertices, triangles, colors)
+ return fury.utils.get_actor_from_primitive(vertices, triangles, colors)
@@ -272,8 +272,8 @@ the Scene and ShowManager.
.. code-block:: Python
- scene = window.Scene()
- showmgr = window.ShowManager(scene, "Fractals", (800, 800), reset_camera=True)
+ scene = fury.window.Scene()
+ showmgr = fury.window.ShowManager(scene, "Fractals", (800, 800), reset_camera=True)
.. GENERATED FROM PYTHON SOURCE LINES 227-229
@@ -306,7 +306,7 @@ fractals and add the selected one. This also resets the camera.
"Snowflake": 2,
}
- shape_chooser = ui.RadioButton(
+ shape_chooser = fury.ui.RadioButton(
options.keys(),
padding=10,
font_size=16,
@@ -369,7 +369,7 @@ reading.
if interactive:
showmgr.start()
else:
- window.record(showmgr.scene, out_path="fractals.png", size=(800, 800))
+ fury.window.record(showmgr.scene, out_path="fractals.png", size=(800, 800))
.. _sphx_glr_download_auto_examples_04_demos_viz_fractals.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_helical_motion.rst.txt b/dev/_sources/auto_examples/04_demos/viz_helical_motion.rst.txt
index f05603669..838a56603 100644
--- a/dev/_sources/auto_examples/04_demos/viz_helical_motion.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_helical_motion.rst.txt
@@ -43,7 +43,7 @@ Importing necessary modules
import numpy as np
- from fury import actor, ui, utils, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 26-40
@@ -87,12 +87,12 @@ Creating a scene object and configuring the camera's position
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.zoom(1.2)
scene.set_camera(
position=(10, 12.5, 19), focal_point=(3.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)
)
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(800, 600), reset_camera=True, order_transparent=True
)
@@ -108,11 +108,11 @@ electric field.
.. code-block:: Python
- color_arrow = window.colors.blue # color of the arrow can be manipulated
+ color_arrow = fury.window.colors.blue # color of the arrow can be manipulated
centers = np.array([[0, 0, 0]])
directions = np.array([[1, 0, 0]])
heights = np.array([8])
- arrow_actor = actor.arrow(
+ arrow_actor = fury.actor.arrow(
centers,
directions,
color_arrow,
@@ -148,13 +148,13 @@ Initializing point actor which will represent the charged particle
.. code-block:: Python
- color_particle = window.colors.red # color of particle can be manipulated
+ color_particle = fury.window.colors.red # color of particle can be manipulated
pts = np.array([[x, y, z]])
- charge_actor = actor.point(pts, color_particle, point_radius=radius_particle)
+ charge_actor = fury.actor.point(pts, color_particle, point_radius=radius_particle)
scene.add(charge_actor)
- vertices = utils.vertices_from_actor(charge_actor)
- vcolors = utils.colors_from_actor(charge_actor, "colors")
+ vertices = fury.utils.vertices_from_actor(charge_actor)
+ vcolors = fury.utils.colors_from_actor(charge_actor, "colors")
no_vertices_per_point = len(vertices)
initial_vertices = vertices.copy() - np.repeat(pts, no_vertices_per_point, axis=0)
@@ -169,7 +169,7 @@ Initializing text box to display the name of the animation
.. code-block:: Python
- tb = ui.TextBlock2D(bold=True, position=(100, 90))
+ tb = fury.ui.TextBlock2D(bold=True, position=(100, 90))
m1 = "Motion of a charged particle in a "
m2 = "combined electric and magnetic field"
tb.message = m1 + m2
@@ -236,13 +236,13 @@ using the update_coordinates function. The wave is rendered here.
vertices[:] = initial_vertices + np.repeat(pts, no_vertices_per_point, axis=0)
- utils.update_actor(charge_actor)
+ fury.utils.update_actor(charge_actor)
# Plotting the path followed by the particle
coor_2 = np.array([x, y, z])
coors = np.array([coor_1, coor_2])
coors = [coors]
- line_actor = actor.line(coors, window.colors.cyan, linewidth=3)
+ line_actor = fury.actor.line(coors, fury.window.colors.cyan, linewidth=3)
scene.add(line_actor)
coor_1 = coor_2
@@ -266,7 +266,7 @@ Run every 15 milliseconds
showm.add_timer_callback(True, 15, timer_callback)
showm.start()
- window.record(showm.scene, size=(800, 600), out_path="viz_helical_motion.png")
+ fury.window.record(showm.scene, size=(800, 600), out_path="viz_helical_motion.png")
.. _sphx_glr_download_auto_examples_04_demos_viz_helical_motion.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_markers.rst.txt b/dev/_sources/auto_examples/04_demos/viz_markers.rst.txt
index dcd8c30cf..421c9af6e 100644
--- a/dev/_sources/auto_examples/04_demos/viz_markers.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_markers.rst.txt
@@ -31,7 +31,7 @@ This example shows how to use the marker actor.
import numpy as np
- from fury import actor, window
+ import fury
n = 10000
@@ -63,7 +63,7 @@ You can control the edge color and edge width for each marker
.. code-block:: Python
- nodes_actor = actor.markers(
+ nodes_actor = fury.actor.markers(
centers,
marker=markers,
edge_width=0.1,
@@ -82,14 +82,14 @@ In addition, an 3D sphere it's also a valid type of marker
.. code-block:: Python
- nodes_3d_actor = actor.markers(
+ nodes_3d_actor = fury.actor.markers(
centers + np.ones_like(centers) * 25,
marker="3d",
colors=colors,
scales=0.5,
)
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(nodes_actor)
scene.add(nodes_3d_actor)
@@ -97,9 +97,9 @@ In addition, an 3D sphere it's also a valid type of marker
interactive = False
if interactive:
- window.show(scene, size=(600, 600))
+ fury.window.show(scene, size=(600, 600))
- window.record(scene, out_path="viz_markers.png", size=(600, 600))
+ fury.window.record(scene, out_path="viz_markers.png", size=(600, 600))
.. _sphx_glr_download_auto_examples_04_demos_viz_markers.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_network.rst.txt b/dev/_sources/auto_examples/04_demos/viz_network.rst.txt
index 5949c3973..6c73e2398 100644
--- a/dev/_sources/auto_examples/04_demos/viz_network.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_network.rst.txt
@@ -30,7 +30,7 @@ indicates a citation between two of them.
First, let's import some useful functions
-.. GENERATED FROM PYTHON SOURCE LINES 13-21
+.. GENERATED FROM PYTHON SOURCE LINES 13-20
.. code-block:: Python
@@ -39,29 +39,27 @@ First, let's import some useful functions
import numpy as np
- from fury import actor, colormap as cmap, window
- from fury.data import fetch_viz_wiki_nw
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 22-23
+.. GENERATED FROM PYTHON SOURCE LINES 21-22
Then let's download some available datasets.
-.. GENERATED FROM PYTHON SOURCE LINES 23-28
+.. GENERATED FROM PYTHON SOURCE LINES 22-26
.. code-block:: Python
-
- files, folder = fetch_viz_wiki_nw()
+ files, folder = fury.data.fetch_viz_wiki_nw()
categories_file, edges_file, positions_file = sorted(files.keys())
-.. GENERATED FROM PYTHON SOURCE LINES 29-30
+.. GENERATED FROM PYTHON SOURCE LINES 27-28
We read our datasets
-.. GENERATED FROM PYTHON SOURCE LINES 30-35
+.. GENERATED FROM PYTHON SOURCE LINES 28-33
.. code-block:: Python
@@ -71,12 +69,12 @@ We read our datasets
edges = np.loadtxt(pjoin(folder, edges_file), dtype=int)
-.. GENERATED FROM PYTHON SOURCE LINES 36-38
+.. GENERATED FROM PYTHON SOURCE LINES 34-36
We attribute a color to each category of our dataset which correspond to our
nodes colors.
-.. GENERATED FROM PYTHON SOURCE LINES 38-47
+.. GENERATED FROM PYTHON SOURCE LINES 36-45
.. code-block:: Python
@@ -85,16 +83,16 @@ nodes colors.
index2category = np.unique(categories)
- categoryColors = cmap.distinguishable_colormap(nb_colors=len(index2category))
+ categoryColors = fury.colormap.distinguishable_colormap(nb_colors=len(index2category))
colors = np.array([categoryColors[category2index[category]] for category in categories])
-.. GENERATED FROM PYTHON SOURCE LINES 48-49
+.. GENERATED FROM PYTHON SOURCE LINES 46-47
We define our node size
-.. GENERATED FROM PYTHON SOURCE LINES 49-52
+.. GENERATED FROM PYTHON SOURCE LINES 47-50
.. code-block:: Python
@@ -102,13 +100,13 @@ We define our node size
radii = 1 + np.random.rand(len(positions))
-.. GENERATED FROM PYTHON SOURCE LINES 53-56
+.. GENERATED FROM PYTHON SOURCE LINES 51-54
Lets create our edges now. They will indicate a citation between two nodes.
OF course, the colors of each edges will be an interpolation between the two
node that it connects.
-.. GENERATED FROM PYTHON SOURCE LINES 56-66
+.. GENERATED FROM PYTHON SOURCE LINES 54-64
.. code-block:: Python
@@ -123,18 +121,18 @@ node that it connects.
edgesColors = np.average(np.array(edgesColors), axis=1)
-.. GENERATED FROM PYTHON SOURCE LINES 67-70
+.. GENERATED FROM PYTHON SOURCE LINES 65-68
Our data preparation is ready, it is time to visualize them all. We start to
build 2 actors that we represent our data : sphere_actor for the nodes and
lines_actor for the edges.
-.. GENERATED FROM PYTHON SOURCE LINES 70-85
+.. GENERATED FROM PYTHON SOURCE LINES 68-83
.. code-block:: Python
- sphere_actor = actor.sphere(
+ sphere_actor = fury.actor.sphere(
centers=positions,
colors=colors,
radii=radii * 0.5,
@@ -142,35 +140,35 @@ lines_actor for the edges.
phi=8,
)
- lines_actor = actor.line(
+ lines_actor = fury.actor.line(
edgesPositions,
colors=edgesColors,
opacity=0.1,
)
-.. GENERATED FROM PYTHON SOURCE LINES 86-88
+.. GENERATED FROM PYTHON SOURCE LINES 84-86
All actors need to be added in a scene, so we build one and add our
lines_actor and sphere_actor.
-.. GENERATED FROM PYTHON SOURCE LINES 88-94
+.. GENERATED FROM PYTHON SOURCE LINES 86-92
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(lines_actor)
scene.add(sphere_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 95-97
+.. GENERATED FROM PYTHON SOURCE LINES 93-95
The final step ! Visualize and save the result of our creation! Please,
switch interactive variable to True if you want to visualize it.
-.. GENERATED FROM PYTHON SOURCE LINES 97-105
+.. GENERATED FROM PYTHON SOURCE LINES 95-103
.. code-block:: Python
@@ -178,12 +176,12 @@ switch interactive variable to True if you want to visualize it.
interactive = False
if interactive:
- window.show(scene, size=(600, 600))
+ fury.window.show(scene, size=(600, 600))
- window.record(scene, out_path="journal_networks.png", size=(600, 600))
+ fury.window.record(scene, out_path="journal_networks.png", size=(600, 600))
-.. GENERATED FROM PYTHON SOURCE LINES 106-108
+.. GENERATED FROM PYTHON SOURCE LINES 104-106
This example can be improved by adding some interactivy with slider,
picking, etc. Play with it, improve it!
diff --git a/dev/_sources/auto_examples/04_demos/viz_network_animated.rst.txt b/dev/_sources/auto_examples/04_demos/viz_network_animated.rst.txt
index 2eabaa028..e88c74958 100644
--- a/dev/_sources/auto_examples/04_demos/viz_network_animated.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_network_animated.rst.txt
@@ -32,7 +32,7 @@ positions is also demoed.
First, let's import some useful functions
-.. GENERATED FROM PYTHON SOURCE LINES 15-24
+.. GENERATED FROM PYTHON SOURCE LINES 15-23
.. code-block:: Python
@@ -42,11 +42,10 @@ First, let's import some useful functions
import numpy as np
- from fury import actor, colormap as cmap, window
- from fury.utils import compute_bounds, update_actor, vertices_from_actor
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 25-32
+.. GENERATED FROM PYTHON SOURCE LINES 24-31
This demo has two modes.
Use `mode = 0` to visualize a randomly generated geographic network by
@@ -56,7 +55,7 @@ Use `mode = 1` to visualize a large network being animated with random
displacements
-.. GENERATED FROM PYTHON SOURCE LINES 32-35
+.. GENERATED FROM PYTHON SOURCE LINES 31-34
.. code-block:: Python
@@ -64,11 +63,11 @@ displacements
mode = 0
-.. GENERATED FROM PYTHON SOURCE LINES 36-37
+.. GENERATED FROM PYTHON SOURCE LINES 35-36
Then let's download some available datasets. (mode 1)
-.. GENERATED FROM PYTHON SOURCE LINES 37-44
+.. GENERATED FROM PYTHON SOURCE LINES 36-43
.. code-block:: Python
@@ -80,11 +79,11 @@ Then let's download some available datasets. (mode 1)
categories_file, edges_file, positions_file = sorted(files.keys())
-.. GENERATED FROM PYTHON SOURCE LINES 45-46
+.. GENERATED FROM PYTHON SOURCE LINES 44-45
We read our datasets (mode 1)
-.. GENERATED FROM PYTHON SOURCE LINES 46-53
+.. GENERATED FROM PYTHON SOURCE LINES 45-52
.. code-block:: Python
@@ -96,11 +95,11 @@ We read our datasets (mode 1)
vertices_count = len(positions)
-.. GENERATED FROM PYTHON SOURCE LINES 54-55
+.. GENERATED FROM PYTHON SOURCE LINES 53-54
Generate a geographic random network, requires networkx package (mode 0)
-.. GENERATED FROM PYTHON SOURCE LINES 55-67
+.. GENERATED FROM PYTHON SOURCE LINES 54-66
.. code-block:: Python
@@ -117,12 +116,12 @@ Generate a geographic random network, requires networkx package (mode 0)
positions = view_size * np.random.random((vertices_count, 3)) - view_size / 2.0
-.. GENERATED FROM PYTHON SOURCE LINES 68-70
+.. GENERATED FROM PYTHON SOURCE LINES 67-69
We attribute a color to each category of our dataset which correspond to our
nodes colors.
-.. GENERATED FROM PYTHON SOURCE LINES 70-81
+.. GENERATED FROM PYTHON SOURCE LINES 69-80
.. code-block:: Python
@@ -131,18 +130,18 @@ nodes colors.
index2category = np.unique(categories)
- category_colors = cmap.distinguishable_colormap(nb_colors=len(index2category))
+ category_colors = fury.colormap.distinguishable_colormap(nb_colors=len(index2category))
colors = np.array(
[category_colors[category2index[category]] for category in categories]
)
-.. GENERATED FROM PYTHON SOURCE LINES 82-83
+.. GENERATED FROM PYTHON SOURCE LINES 81-82
We define our node size
-.. GENERATED FROM PYTHON SOURCE LINES 83-86
+.. GENERATED FROM PYTHON SOURCE LINES 82-85
.. code-block:: Python
@@ -150,12 +149,12 @@ We define our node size
radii = 1 + np.random.rand(len(positions))
-.. GENERATED FROM PYTHON SOURCE LINES 87-89
+.. GENERATED FROM PYTHON SOURCE LINES 86-88
Let's create our edges now. They will indicate a citation between two nodes.
The colors of each edge are interpolated between the two endpoints.
-.. GENERATED FROM PYTHON SOURCE LINES 89-96
+.. GENERATED FROM PYTHON SOURCE LINES 88-95
.. code-block:: Python
@@ -167,23 +166,23 @@ The colors of each edge are interpolated between the two endpoints.
edges_colors = np.average(np.array(edges_colors), axis=1)
-.. GENERATED FROM PYTHON SOURCE LINES 97-100
+.. GENERATED FROM PYTHON SOURCE LINES 96-99
Our data preparation is ready, it is time to visualize them all. We start to
build 2 actors that we represent our data : sphere_actor for the nodes and
lines_actor for the edges.
-.. GENERATED FROM PYTHON SOURCE LINES 100-114
+.. GENERATED FROM PYTHON SOURCE LINES 99-113
.. code-block:: Python
- sphere_actor = actor.sphere(
+ sphere_actor = fury.actor.sphere(
centers=np.zeros(positions.shape), colors=colors, radii=radii * 0.5, theta=8, phi=8
)
- lines_actor = actor.line(
+ lines_actor = fury.actor.line(
np.zeros((len(edges), 2, 3)),
colors=edges_colors,
lod=False,
@@ -192,11 +191,11 @@ lines_actor for the edges.
)
-.. GENERATED FROM PYTHON SOURCE LINES 115-116
+.. GENERATED FROM PYTHON SOURCE LINES 114-115
Defining timer callback and layout iterator
-.. GENERATED FROM PYTHON SOURCE LINES 116-223
+.. GENERATED FROM PYTHON SOURCE LINES 115-222
.. code-block:: Python
@@ -216,7 +215,7 @@ Defining timer callback and layout iterator
b = 1.0
deltaT = 1.0
- sphere_geometry = np.array(vertices_from_actor(sphere_actor))
+ sphere_geometry = np.array(fury.utils.vertices_from_actor(sphere_actor))
geometry_length = sphere_geometry.shape[0] / vertices_count
if vertex_initial_positions is not None:
@@ -286,18 +285,18 @@ Defining timer callback and layout iterator
iterate(1)
else:
pos[:] += (np.random.random(pos.shape) - 0.5) * 1.5
- spheres_positions = vertices_from_actor(sphere_actor)
+ spheres_positions = fury.utils.vertices_from_actor(sphere_actor)
spheres_positions[:] = sphere_geometry + np.repeat(pos, geometry_length, axis=0)
- edges_positions = vertices_from_actor(lines_actor)
+ edges_positions = fury.utils.vertices_from_actor(lines_actor)
edges_positions[::2] = pos[edges_list[:, 0]]
edges_positions[1::2] = pos[edges_list[:, 1]]
- update_actor(lines_actor)
- compute_bounds(lines_actor)
+ fury.utils.update_actor(lines_actor)
+ fury.utils.compute_bounds(lines_actor)
- update_actor(sphere_actor)
- compute_bounds(lines_actor)
+ fury.utils.update_actor(sphere_actor)
+ fury.utils.compute_bounds(lines_actor)
showm.scene.reset_clipping_range()
showm.render()
@@ -308,18 +307,18 @@ Defining timer callback and layout iterator
-.. GENERATED FROM PYTHON SOURCE LINES 224-226
+.. GENERATED FROM PYTHON SOURCE LINES 223-225
All actors need to be added in a scene, so we build one and add our
lines_actor and sphere_actor.
-.. GENERATED FROM PYTHON SOURCE LINES 226-235
+.. GENERATED FROM PYTHON SOURCE LINES 225-234
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
camera = scene.camera()
@@ -327,19 +326,19 @@ lines_actor and sphere_actor.
scene.add(sphere_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 236-240
+.. GENERATED FROM PYTHON SOURCE LINES 235-239
The final step! Visualize the result of our creation! Also, we need to move
the camera a little bit farther from the network. you can increase the
parameter max_iteractions of the timer callback to let the animation run for
more time.
-.. GENERATED FROM PYTHON SOURCE LINES 240-259
+.. GENERATED FROM PYTHON SOURCE LINES 239-258
.. code-block:: Python
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, reset_camera=False, size=(900, 768), order_transparent=True, multi_samples=8
)
@@ -356,7 +355,7 @@ more time.
showm.start()
- window.record(showm.scene, size=(900, 768), out_path="viz_animated_networks.png")
+ fury.window.record(showm.scene, size=(900, 768), out_path="viz_animated_networks.png")
.. _sphx_glr_download_auto_examples_04_demos_viz_network_animated.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_pbr_interactive.rst.txt b/dev/_sources/auto_examples/04_demos/viz_pbr_interactive.rst.txt
index 8021f97c3..9d7b41b40 100644
--- a/dev/_sources/auto_examples/04_demos/viz_pbr_interactive.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_pbr_interactive.rst.txt
@@ -27,26 +27,19 @@ simulate different materials.
Let's start by importing the necessary modules:
-.. GENERATED FROM PYTHON SOURCE LINES 11-21
+.. GENERATED FROM PYTHON SOURCE LINES 11-14
.. code-block:: Python
- from fury import actor, material, ui, window
- from fury.data import fetch_viz_cubemaps, read_viz_cubemap
- from fury.io import load_cubemap_texture
- from fury.utils import (
- normals_from_actor,
- tangents_from_direction_of_anisotropy,
- tangents_to_actor,
- )
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 22-23
+.. GENERATED FROM PYTHON SOURCE LINES 15-16
The following functions will help us to manage the sliders events.
-.. GENERATED FROM PYTHON SOURCE LINES 23-86
+.. GENERATED FROM PYTHON SOURCE LINES 16-79
.. code-block:: Python
@@ -70,22 +63,22 @@ The following functions will help us to manage the sliders events.
def change_slice_anisotropy_direction_x(slider):
global doa, normals, sphere
doa[0] = slider.value
- tangents = tangents_from_direction_of_anisotropy(normals, doa)
- tangents_to_actor(sphere, tangents)
+ tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)
+ fury.utils.tangents_to_actor(sphere, tangents)
def change_slice_anisotropy_direction_y(slider):
global doa, normals, sphere
doa[1] = slider.value
- tangents = tangents_from_direction_of_anisotropy(normals, doa)
- tangents_to_actor(sphere, tangents)
+ tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)
+ fury.utils.tangents_to_actor(sphere, tangents)
def change_slice_anisotropy_direction_z(slider):
global doa, normals, sphere
doa[2] = slider.value
- tangents = tangents_from_direction_of_anisotropy(normals, doa)
- tangents_to_actor(sphere, tangents)
+ tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)
+ fury.utils.tangents_to_actor(sphere, tangents)
def change_slice_anisotropy_rotation(slider):
@@ -114,12 +107,12 @@ The following functions will help us to manage the sliders events.
-.. GENERATED FROM PYTHON SOURCE LINES 87-89
+.. GENERATED FROM PYTHON SOURCE LINES 80-82
Last, but not least, we define the following function to help us to
reposition the UI elements every time we resize the window.
-.. GENERATED FROM PYTHON SOURCE LINES 89-100
+.. GENERATED FROM PYTHON SOURCE LINES 82-93
.. code-block:: Python
@@ -135,78 +128,78 @@ reposition the UI elements every time we resize the window.
-.. GENERATED FROM PYTHON SOURCE LINES 101-102
+.. GENERATED FROM PYTHON SOURCE LINES 94-95
Let's fetch a skybox texture from the FURY data repository.
-.. GENERATED FROM PYTHON SOURCE LINES 102-105
+.. GENERATED FROM PYTHON SOURCE LINES 95-98
.. code-block:: Python
- fetch_viz_cubemaps()
+ fury.data.fetch_viz_cubemaps()
-.. GENERATED FROM PYTHON SOURCE LINES 106-108
+.. GENERATED FROM PYTHON SOURCE LINES 99-101
The following function returns the full path of the 6 images composing the
skybox.
-.. GENERATED FROM PYTHON SOURCE LINES 108-111
+.. GENERATED FROM PYTHON SOURCE LINES 101-104
.. code-block:: Python
- textures = read_viz_cubemap("skybox")
+ textures = fury.data.read_viz_cubemap("skybox")
-.. GENERATED FROM PYTHON SOURCE LINES 112-114
+.. GENERATED FROM PYTHON SOURCE LINES 105-107
Now that we have the location of the textures, let's load them and create a
Cube Map Texture object.
-.. GENERATED FROM PYTHON SOURCE LINES 114-117
+.. GENERATED FROM PYTHON SOURCE LINES 107-110
.. code-block:: Python
- cubemap = load_cubemap_texture(textures)
+ cubemap = fury.io.load_cubemap_texture(textures)
-.. GENERATED FROM PYTHON SOURCE LINES 118-122
+.. GENERATED FROM PYTHON SOURCE LINES 111-115
The Scene object in FURY can handle cube map textures and extract light
information from them, so it can be used to create more plausible materials
interactions. The ``skybox`` parameter takes as input a cube map texture and
performs the previously described process.
-.. GENERATED FROM PYTHON SOURCE LINES 122-125
+.. GENERATED FROM PYTHON SOURCE LINES 115-118
.. code-block:: Python
- scene = window.Scene(skybox=cubemap)
+ scene = fury.window.Scene(skybox=cubemap)
-.. GENERATED FROM PYTHON SOURCE LINES 126-128
+.. GENERATED FROM PYTHON SOURCE LINES 119-121
With the scene created, we can then populate it. In this demo we will only
add a sphere actor.
-.. GENERATED FROM PYTHON SOURCE LINES 128-131
+.. GENERATED FROM PYTHON SOURCE LINES 121-124
.. code-block:: Python
- sphere = actor.sphere([[0, 0, 0]], (0.7, 0.7, 0.7), radii=2, theta=64, phi=64)
+ sphere = fury.actor.sphere([[0, 0, 0]], (0.7, 0.7, 0.7), radii=2, theta=64, phi=64)
-.. GENERATED FROM PYTHON SOURCE LINES 132-134
+.. GENERATED FROM PYTHON SOURCE LINES 125-127
The direction of anisotropy (DoA) defines the direction at which all the
tangents of our actor are pointing.
-.. GENERATED FROM PYTHON SOURCE LINES 134-137
+.. GENERATED FROM PYTHON SOURCE LINES 127-130
.. code-block:: Python
@@ -214,40 +207,40 @@ tangents of our actor are pointing.
doa = [0, 1, 0.5]
-.. GENERATED FROM PYTHON SOURCE LINES 138-141
+.. GENERATED FROM PYTHON SOURCE LINES 131-134
The following process gets the normals of the actor and computes the tangents
that are aligned to the provided DoA. Then it registers those tangents to the
-actor.
+fury.actor.
-.. GENERATED FROM PYTHON SOURCE LINES 141-146
+.. GENERATED FROM PYTHON SOURCE LINES 134-139
.. code-block:: Python
- normals = normals_from_actor(sphere)
- tangents = tangents_from_direction_of_anisotropy(normals, doa)
- tangents_to_actor(sphere, tangents)
+ normals = fury.utils.normals_from_actor(sphere)
+ tangents = fury.utils.tangents_from_direction_of_anisotropy(normals, doa)
+ fury.utils.tangents_to_actor(sphere, tangents)
-.. GENERATED FROM PYTHON SOURCE LINES 147-149
+.. GENERATED FROM PYTHON SOURCE LINES 140-142
With the tangents computed and in place, we have all the elements needed to
add some material properties to the actor.
-.. GENERATED FROM PYTHON SOURCE LINES 149-152
+.. GENERATED FROM PYTHON SOURCE LINES 142-145
.. code-block:: Python
- pbr_params = material.manifest_pbr(sphere)
+ pbr_params = fury.material.manifest_pbr(sphere)
-.. GENERATED FROM PYTHON SOURCE LINES 153-154
+.. GENERATED FROM PYTHON SOURCE LINES 146-147
Our actor is now ready to be added to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 154-157
+.. GENERATED FROM PYTHON SOURCE LINES 147-150
.. code-block:: Python
@@ -255,64 +248,64 @@ Our actor is now ready to be added to the scene.
scene.add(sphere)
-.. GENERATED FROM PYTHON SOURCE LINES 158-159
+.. GENERATED FROM PYTHON SOURCE LINES 151-152
Let's setup now the window and the UI.
-.. GENERATED FROM PYTHON SOURCE LINES 159-165
+.. GENERATED FROM PYTHON SOURCE LINES 152-158
.. code-block:: Python
- show_m = window.ShowManager(
+ show_m = fury.window.ShowManager(
scene=scene, size=(1920, 1080), reset_camera=False, order_transparent=True
)
-.. GENERATED FROM PYTHON SOURCE LINES 166-167
+.. GENERATED FROM PYTHON SOURCE LINES 159-160
We will create one single panel with all of our labels and sliders.
-.. GENERATED FROM PYTHON SOURCE LINES 167-172
+.. GENERATED FROM PYTHON SOURCE LINES 160-165
.. code-block:: Python
- control_panel = ui.Panel2D(
+ control_panel = fury.ui.Panel2D(
(400, 500), position=(5, 5), color=(0.25, 0.25, 0.25), opacity=0.75, align="right"
)
-.. GENERATED FROM PYTHON SOURCE LINES 173-175
+.. GENERATED FROM PYTHON SOURCE LINES 166-168
By using our previously defined function, we can easily create all the labels
we need for this demo. And then add them to the panel.
-.. GENERATED FROM PYTHON SOURCE LINES 175-208
+.. GENERATED FROM PYTHON SOURCE LINES 168-201
.. code-block:: Python
- slider_label_metallic = ui.TextBlock2D(text="Metallic", font_size=16)
- slider_label_roughness = ui.TextBlock2D(text="Roughness", font_size=16)
- slider_label_anisotropy = ui.TextBlock2D(text="Anisotropy", font_size=16)
- slider_label_anisotropy_rotation = ui.TextBlock2D(
+ slider_label_metallic = fury.ui.TextBlock2D(text="Metallic", font_size=16)
+ slider_label_roughness = fury.ui.TextBlock2D(text="Roughness", font_size=16)
+ slider_label_anisotropy = fury.ui.TextBlock2D(text="Anisotropy", font_size=16)
+ slider_label_anisotropy_rotation = fury.ui.TextBlock2D(
text="Anisotropy Rotation", font_size=16
)
- slider_label_anisotropy_direction_x = ui.TextBlock2D(
+ slider_label_anisotropy_direction_x = fury.ui.TextBlock2D(
text="Anisotropy Direction X", font_size=16
)
- slider_label_anisotropy_direction_y = ui.TextBlock2D(
+ slider_label_anisotropy_direction_y = fury.ui.TextBlock2D(
text="Anisotropy Direction Y", font_size=16
)
- slider_label_anisotropy_direction_z = ui.TextBlock2D(
+ slider_label_anisotropy_direction_z = fury.ui.TextBlock2D(
text="Anisotropy Direction Z", font_size=16
)
- slider_label_coat_strength = ui.TextBlock2D(text="Coat Strength", font_size=16)
- slider_label_coat_roughness = ui.TextBlock2D(text="Coat Roughness", font_size=16)
- slider_label_base_ior = ui.TextBlock2D(text="Base IoR", font_size=16)
- slider_label_coat_ior = ui.TextBlock2D(text="Coat IoR", font_size=16)
+ slider_label_coat_strength = fury.ui.TextBlock2D(text="Coat Strength", font_size=16)
+ slider_label_coat_roughness = fury.ui.TextBlock2D(text="Coat Roughness", font_size=16)
+ slider_label_base_ior = fury.ui.TextBlock2D(text="Base IoR", font_size=16)
+ slider_label_coat_ior = fury.ui.TextBlock2D(text="Coat IoR", font_size=16)
control_panel.add_element(slider_label_metallic, (0.01, 0.95))
control_panel.add_element(slider_label_roughness, (0.01, 0.86))
@@ -327,46 +320,46 @@ we need for this demo. And then add them to the panel.
control_panel.add_element(slider_label_coat_ior, (0.01, 0.05))
-.. GENERATED FROM PYTHON SOURCE LINES 209-210
+.. GENERATED FROM PYTHON SOURCE LINES 202-203
Our sliders are created and added to the panel in the following way.
-.. GENERATED FROM PYTHON SOURCE LINES 210-248
+.. GENERATED FROM PYTHON SOURCE LINES 203-241
.. code-block:: Python
- slider_slice_metallic = ui.LineSlider2D(
+ slider_slice_metallic = fury.ui.LineSlider2D(
initial_value=pbr_params.metallic,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_roughness = ui.LineSlider2D(
+ slider_slice_roughness = fury.ui.LineSlider2D(
initial_value=pbr_params.roughness,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_anisotropy = ui.LineSlider2D(
+ slider_slice_anisotropy = fury.ui.LineSlider2D(
initial_value=pbr_params.anisotropy,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_anisotropy_rotation = ui.LineSlider2D(
+ slider_slice_anisotropy_rotation = fury.ui.LineSlider2D(
initial_value=pbr_params.anisotropy_rotation,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_coat_strength = ui.LineSlider2D(
+ slider_slice_coat_strength = fury.ui.LineSlider2D(
initial_value=pbr_params.coat_strength,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_coat_roughness = ui.LineSlider2D(
+ slider_slice_coat_roughness = fury.ui.LineSlider2D(
initial_value=pbr_params.coat_roughness,
max_value=1,
length=195,
@@ -374,32 +367,32 @@ Our sliders are created and added to the panel in the following way.
)
-.. GENERATED FROM PYTHON SOURCE LINES 249-252
+.. GENERATED FROM PYTHON SOURCE LINES 242-245
Notice that we are defining a range of [-1, 1] for the DoA. This is because
within that range we cover all the possible 3D directions needed to align the
tangents.
-.. GENERATED FROM PYTHON SOURCE LINES 252-275
+.. GENERATED FROM PYTHON SOURCE LINES 245-268
.. code-block:: Python
- slider_slice_anisotropy_direction_x = ui.LineSlider2D(
+ slider_slice_anisotropy_direction_x = fury.ui.LineSlider2D(
initial_value=doa[0],
min_value=-1,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_anisotropy_direction_y = ui.LineSlider2D(
+ slider_slice_anisotropy_direction_y = fury.ui.LineSlider2D(
initial_value=doa[1],
min_value=-1,
max_value=1,
length=195,
text_template="{value:.1f}",
)
- slider_slice_anisotropy_direction_z = ui.LineSlider2D(
+ slider_slice_anisotropy_direction_z = fury.ui.LineSlider2D(
initial_value=doa[2],
min_value=-1,
max_value=1,
@@ -408,25 +401,25 @@ tangents.
)
-.. GENERATED FROM PYTHON SOURCE LINES 276-279
+.. GENERATED FROM PYTHON SOURCE LINES 269-272
Another special case are the Index of Refraction (IoR) sliders. In these
cases, the values are defined in the range [1, 2.3] according to the
documentation of the material.
-.. GENERATED FROM PYTHON SOURCE LINES 279-295
+.. GENERATED FROM PYTHON SOURCE LINES 272-288
.. code-block:: Python
- slider_slice_base_ior = ui.LineSlider2D(
+ slider_slice_base_ior = fury.ui.LineSlider2D(
initial_value=pbr_params.base_ior,
min_value=1,
max_value=2.3,
length=195,
text_template="{value:.02f}",
)
- slider_slice_coat_ior = ui.LineSlider2D(
+ slider_slice_coat_ior = fury.ui.LineSlider2D(
initial_value=pbr_params.coat_ior,
min_value=1,
max_value=2.3,
@@ -435,11 +428,11 @@ documentation of the material.
)
-.. GENERATED FROM PYTHON SOURCE LINES 296-297
+.. GENERATED FROM PYTHON SOURCE LINES 289-290
Let's add the event handlers functions to the corresponding sliders.
-.. GENERATED FROM PYTHON SOURCE LINES 297-310
+.. GENERATED FROM PYTHON SOURCE LINES 290-303
.. code-block:: Python
@@ -457,11 +450,11 @@ Let's add the event handlers functions to the corresponding sliders.
slider_slice_coat_ior.on_change = change_slice_coat_ior
-.. GENERATED FROM PYTHON SOURCE LINES 311-312
+.. GENERATED FROM PYTHON SOURCE LINES 304-305
And then add the sliders to the panel.
-.. GENERATED FROM PYTHON SOURCE LINES 312-325
+.. GENERATED FROM PYTHON SOURCE LINES 305-318
.. code-block:: Python
@@ -479,11 +472,11 @@ And then add the sliders to the panel.
control_panel.add_element(slider_slice_coat_ior, (0.44, 0.05))
-.. GENERATED FROM PYTHON SOURCE LINES 326-327
+.. GENERATED FROM PYTHON SOURCE LINES 319-320
Consequently, we add the panel to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 327-330
+.. GENERATED FROM PYTHON SOURCE LINES 320-323
.. code-block:: Python
@@ -491,13 +484,13 @@ Consequently, we add the panel to the scene.
scene.add(control_panel)
-.. GENERATED FROM PYTHON SOURCE LINES 331-334
+.. GENERATED FROM PYTHON SOURCE LINES 324-327
Previously we defined a function to help us when we resize the window, so
let's capture the current size and add our helper function as a
`window_callback` to the window.
-.. GENERATED FROM PYTHON SOURCE LINES 334-339
+.. GENERATED FROM PYTHON SOURCE LINES 327-332
.. code-block:: Python
@@ -507,11 +500,11 @@ let's capture the current size and add our helper function as a
show_m.add_window_callback(win_callback)
-.. GENERATED FROM PYTHON SOURCE LINES 340-341
+.. GENERATED FROM PYTHON SOURCE LINES 333-334
Finally, let's visualize our demo.
-.. GENERATED FROM PYTHON SOURCE LINES 341-347
+.. GENERATED FROM PYTHON SOURCE LINES 334-340
.. code-block:: Python
@@ -520,7 +513,7 @@ Finally, let's visualize our demo.
if interactive:
show_m.start()
- window.record(scene, size=(1920, 1080), out_path="viz_pbr_interactive.png")
+ fury.window.record(scene, size=(1920, 1080), out_path="viz_pbr_interactive.png")
.. _sphx_glr_download_auto_examples_04_demos_viz_pbr_interactive.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_play_video.rst.txt b/dev/_sources/auto_examples/04_demos/viz_play_video.rst.txt
index 1bbd5b318..83945f284 100644
--- a/dev/_sources/auto_examples/04_demos/viz_play_video.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_play_video.rst.txt
@@ -25,7 +25,7 @@ Play a video in the 3D world
The goal of this demo is to show how to visualize a video
on a rectangle by updating a texture.
-.. GENERATED FROM PYTHON SOURCE LINES 9-94
+.. GENERATED FROM PYTHON SOURCE LINES 9-96
.. code-block:: Python
@@ -35,7 +35,7 @@ on a rectangle by updating a texture.
import cv2
import numpy as np
- from fury import actor, window
+ import fury
# The VideoCapturer Class
@@ -71,16 +71,16 @@ on a rectangle by updating a texture.
# Initialize Scene
self.initialize_scene()
# Create a Show Manager and Initialize it
- self.show_manager = window.ShowManager(
+ self.show_manager = fury.window.ShowManager(
self.scene, size=(900, 768), reset_camera=False, order_transparent=True
)
# Initialize the Scene with actors
def initialize_scene(self):
- self.scene = window.Scene()
+ self.scene = fury.window.Scene()
# Initialize a Plane actor with the 1st video frame along with
# the actor grid which is to be updated in each iteration
- self.plane_actor = actor.texture(self.current_video_frame)
+ self.plane_actor = fury.actor.texture(self.current_video_frame)
self.scene.add(self.plane_actor)
# The timer_callback function getting called by the show manager
@@ -89,7 +89,7 @@ on a rectangle by updating a texture.
if isinstance(self.current_video_frame, np.ndarray):
# update texture of the actor with the current frame image
# by updating the actor grid
- actor.texture_update(self.plane_actor, self.current_video_frame)
+ fury.actor.texture_update(self.plane_actor, self.current_video_frame)
self.show_manager.scene.azimuth(1.5) # to rotate the camera
else:
self.show_manager.exit()
@@ -113,7 +113,9 @@ on a rectangle by updating a texture.
)
vp = VideoPlayer(video_url)
vp.run()
- window.record(vp.show_manager.scene, out_path="viz_play_video.png", size=(600, 600))
+ fury.window.record(
+ vp.show_manager.scene, out_path="viz_play_video.png", size=(600, 600)
+ )
.. _sphx_glr_download_auto_examples_04_demos_viz_play_video.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_roi_contour.rst.txt b/dev/_sources/auto_examples/04_demos/viz_roi_contour.rst.txt
index 6e147c9a7..3155f739d 100644
--- a/dev/_sources/auto_examples/04_demos/viz_roi_contour.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_roi_contour.rst.txt
@@ -26,7 +26,7 @@ Here is a simple tutorial following the probabilistic CSA Tracking Example in
which we generate a dataset of streamlines from a corpus callosum ROI, and
then display them with the seed ROI rendered in 3D with 50% transparency.
-.. GENERATED FROM PYTHON SOURCE LINES 10-30
+.. GENERATED FROM PYTHON SOURCE LINES 10-29
.. code-block:: Python
@@ -47,17 +47,16 @@ then display them with the seed ROI rendered in 3D with 50% transparency.
from dipy.tracking import utils
from dipy.tracking.streamline import Streamlines
- from fury import actor, window
- from fury.colormap import line_colors
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 31-34
+.. GENERATED FROM PYTHON SOURCE LINES 30-33
First, we need to generate some streamlines. For a more complete
description of these steps, please refer to the CSA Probabilistic Tracking
Tutorial.
-.. GENERATED FROM PYTHON SOURCE LINES 34-63
+.. GENERATED FROM PYTHON SOURCE LINES 33-62
.. code-block:: Python
@@ -69,7 +68,7 @@ Tutorial.
white_matter = (labels == 1) | (labels == 2)
- csa_model = CsaOdfModel(gtab, sh_order=6)
+ csa_model = CsaOdfModel(gtab, sh_order_max=6)
csa_peaks = peaks_from_model(
csa_model,
data,
@@ -91,26 +90,26 @@ Tutorial.
streamlines = Streamlines(streamlines)
-.. GENERATED FROM PYTHON SOURCE LINES 64-65
+.. GENERATED FROM PYTHON SOURCE LINES 63-64
We will create a streamline actor from the streamlines.
-.. GENERATED FROM PYTHON SOURCE LINES 65-68
+.. GENERATED FROM PYTHON SOURCE LINES 64-67
.. code-block:: Python
- streamlines_actor = actor.line(streamlines, line_colors(streamlines))
+ streamlines_actor = fury.actor.line(streamlines, fury.colormap.line_colors(streamlines))
-.. GENERATED FROM PYTHON SOURCE LINES 69-73
+.. GENERATED FROM PYTHON SOURCE LINES 68-72
Next, we create a surface actor from the corpus callosum seed ROI. We
provide the ROI data, the affine, the color in [R,G,B], and the opacity as
a decimal between zero and one. Here, we set the color as blue/green with
50% opacity.
-.. GENERATED FROM PYTHON SOURCE LINES 73-81
+.. GENERATED FROM PYTHON SOURCE LINES 72-80
.. code-block:: Python
@@ -118,44 +117,44 @@ a decimal between zero and one. Here, we set the color as blue/green with
surface_opacity = 0.5
surface_color = [0, 1, 1]
- seedroi_actor = actor.contour_from_roi(
+ seedroi_actor = fury.actor.contour_from_roi(
seed_mask, affine, surface_color, surface_opacity
)
-.. GENERATED FROM PYTHON SOURCE LINES 82-84
+.. GENERATED FROM PYTHON SOURCE LINES 81-83
Next, we initialize a ''Scene'' object and add both actors
to the rendering.
-.. GENERATED FROM PYTHON SOURCE LINES 84-89
+.. GENERATED FROM PYTHON SOURCE LINES 83-88
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(streamlines_actor)
scene.add(seedroi_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 90-92
+.. GENERATED FROM PYTHON SOURCE LINES 89-91
If you uncomment the following line, the rendering will pop up in an
interactive window.
-.. GENERATED FROM PYTHON SOURCE LINES 92-101
+.. GENERATED FROM PYTHON SOURCE LINES 91-100
.. code-block:: Python
interactive = False
if interactive:
- window.show(scene)
+ fury.window.show(scene)
# scene.zoom(1.5)
# scene.reset_clipping_range()
- window.record(scene, out_path="contour_from_roi_tutorial.png", size=(600, 600))
+ fury.window.record(scene, out_path="contour_from_roi_tutorial.png", size=(600, 600))
.. _sphx_glr_download_auto_examples_04_demos_viz_roi_contour.py:
diff --git a/dev/_sources/auto_examples/04_demos/viz_tesseract.rst.txt b/dev/_sources/auto_examples/04_demos/viz_tesseract.rst.txt
index d15c3e641..9c940d348 100644
--- a/dev/_sources/auto_examples/04_demos/viz_tesseract.rst.txt
+++ b/dev/_sources/auto_examples/04_demos/viz_tesseract.rst.txt
@@ -29,7 +29,7 @@ squares.
First, import some useful functions
-.. GENERATED FROM PYTHON SOURCE LINES 12-20
+.. GENERATED FROM PYTHON SOURCE LINES 12-19
.. code-block:: Python
@@ -38,18 +38,17 @@ First, import some useful functions
import numpy as np
- from fury import actor, utils, window
- from fury.ui import TextBlock2D
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 21-25
+.. GENERATED FROM PYTHON SOURCE LINES 20-24
Let's define some variables and their descriptions:
Use `wireframe = True` to show wireframe like representation of the tesseract
`wireframe = False` will render it with point actor on each vertex.
-.. GENERATED FROM PYTHON SOURCE LINES 25-41
+.. GENERATED FROM PYTHON SOURCE LINES 24-40
.. code-block:: Python
@@ -70,12 +69,12 @@ Use `wireframe = True` to show wireframe like representation of the tesseract
angle = 0
-.. GENERATED FROM PYTHON SOURCE LINES 42-44
+.. GENERATED FROM PYTHON SOURCE LINES 41-43
Let's define vertices for our 4D cube, `verts4D` contains the coordinates of
our 4D tesseract.
-.. GENERATED FROM PYTHON SOURCE LINES 44-64
+.. GENERATED FROM PYTHON SOURCE LINES 43-63
.. code-block:: Python
@@ -100,13 +99,13 @@ our 4D tesseract.
verts4D = np.append(u, v, axis=0)
-.. GENERATED FROM PYTHON SOURCE LINES 65-68
+.. GENERATED FROM PYTHON SOURCE LINES 64-67
We define a `rotate4D` function that takes 4D matrix as parameter and rotates
it in XY plane (Z axis) and ZW plane (an imaginary axis), projects it to the
3D plane so that we can render it in a scene.
-.. GENERATED FROM PYTHON SOURCE LINES 68-92
+.. GENERATED FROM PYTHON SOURCE LINES 67-91
.. code-block:: Python
@@ -135,12 +134,12 @@ it in XY plane (Z axis) and ZW plane (an imaginary axis), projects it to the
-.. GENERATED FROM PYTHON SOURCE LINES 93-95
+.. GENERATED FROM PYTHON SOURCE LINES 92-94
Now, We have 4D points projected to 3D. Let's define a function to connect
lines.
-.. GENERATED FROM PYTHON SOURCE LINES 95-118
+.. GENERATED FROM PYTHON SOURCE LINES 94-117
.. code-block:: Python
@@ -168,78 +167,80 @@ lines.
-.. GENERATED FROM PYTHON SOURCE LINES 119-120
+.. GENERATED FROM PYTHON SOURCE LINES 118-119
Creating a scene object and configuring the camera's position
-.. GENERATED FROM PYTHON SOURCE LINES 120-128
+.. GENERATED FROM PYTHON SOURCE LINES 119-127
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.set_camera(
position=(0, 10, -1), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)
)
- showm = window.ShowManager(scene, size=(1920, 1080), order_transparent=True)
+ showm = fury.window.ShowManager(scene, size=(1920, 1080), order_transparent=True)
-.. GENERATED FROM PYTHON SOURCE LINES 129-130
+.. GENERATED FROM PYTHON SOURCE LINES 128-129
Creating vertices and points actors
-.. GENERATED FROM PYTHON SOURCE LINES 130-140
+.. GENERATED FROM PYTHON SOURCE LINES 129-139
.. code-block:: Python
verts3D = rotate4D(verts4D)
if not wireframe:
- points = actor.point(verts3D, colors=p_color)
- point_verts = utils.vertices_from_actor(points)
+ points = fury.actor.point(verts3D, colors=p_color)
+ point_verts = fury.utils.vertices_from_actor(points)
no_vertices = len(point_verts) / 16
initial_verts = point_verts.copy() - np.repeat(verts3D, no_vertices, axis=0)
scene.add(points)
-.. GENERATED FROM PYTHON SOURCE LINES 141-142
+.. GENERATED FROM PYTHON SOURCE LINES 140-141
Connecting points with lines actor
-.. GENERATED FROM PYTHON SOURCE LINES 142-150
+.. GENERATED FROM PYTHON SOURCE LINES 141-151
.. code-block:: Python
lines = connect_points(verts3D)
- edges = actor.line(lines=lines, colors=e_color, lod=False, fake_tube=True, linewidth=4)
- lines_verts = utils.vertices_from_actor(edges)
+ edges = fury.actor.line(
+ lines=lines, colors=e_color, lod=False, fake_tube=True, linewidth=4
+ )
+ lines_verts = fury.utils.vertices_from_actor(edges)
initial_lines = lines_verts.copy() - np.reshape(lines, (-1, 3))
scene.add(edges)
-.. GENERATED FROM PYTHON SOURCE LINES 151-152
+.. GENERATED FROM PYTHON SOURCE LINES 152-153
Initializing text box to display the name
-.. GENERATED FROM PYTHON SOURCE LINES 152-156
+.. GENERATED FROM PYTHON SOURCE LINES 153-157
.. code-block:: Python
- tb = TextBlock2D(text="Tesseract", position=(900, 950), font_size=20)
+ tb = fury.ui.TextBlock2D(text="Tesseract", position=(900, 950), font_size=20)
showm.scene.add(tb)
-.. GENERATED FROM PYTHON SOURCE LINES 157-159
+.. GENERATED FROM PYTHON SOURCE LINES 158-160
Define a timer_callback in which we'll update the vertices of point and lines
actor using `rotate4D`.
-.. GENERATED FROM PYTHON SOURCE LINES 159-183
+.. GENERATED FROM PYTHON SOURCE LINES 160-184
.. code-block:: Python
@@ -254,11 +255,11 @@ actor using `rotate4D`.
verts3D = rotate4D(verts4D)
if not wireframe:
point_verts[:] = initial_verts + np.repeat(verts3D, no_vertices, axis=0)
- utils.update_actor(points)
+ fury.utils.update_actor(points)
lines = connect_points(verts3D)
lines_verts[:] = initial_lines + np.reshape(lines, (-1, 3))
- utils.update_actor(edges)
+ fury.utils.update_actor(edges)
showm.render()
angle += dtheta
@@ -268,11 +269,11 @@ actor using `rotate4D`.
-.. GENERATED FROM PYTHON SOURCE LINES 184-185
+.. GENERATED FROM PYTHON SOURCE LINES 185-186
Run every 20 milliseconds
-.. GENERATED FROM PYTHON SOURCE LINES 185-190
+.. GENERATED FROM PYTHON SOURCE LINES 186-191
.. code-block:: Python
@@ -280,7 +281,7 @@ Run every 20 milliseconds
showm.add_timer_callback(True, 20, timer_callback)
showm.start()
- window.record(showm.scene, size=(600, 600), out_path="viz_tesseract.png")
+ fury.window.record(showm.scene, size=(600, 600), out_path="viz_tesseract.png")
.. _sphx_glr_download_auto_examples_04_demos_viz_tesseract.py:
diff --git a/dev/_sources/auto_examples/07_ui/index.rst.txt b/dev/_sources/auto_examples/07_ui/index.rst.txt
index 46921598c..f6a0133e8 100644
--- a/dev/_sources/auto_examples/07_ui/index.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/index.rst.txt
@@ -17,35 +17,35 @@ These tutorials show how to create user interfaces elements.
.. raw:: html
-
+
.. only:: html
- .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_shapes_thumb.png
+ .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_drawpanel_thumb.png
:alt:
- :ref:`sphx_glr_auto_examples_07_ui_viz_shapes.py`
+ :ref:`sphx_glr_auto_examples_07_ui_viz_drawpanel.py`
.. raw:: html
- Simple Shapes
+ DrawPanel
.. raw:: html
-
+
.. only:: html
- .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_drawpanel_thumb.png
+ .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_shapes_thumb.png
:alt:
- :ref:`sphx_glr_auto_examples_07_ui_viz_drawpanel.py`
+ :ref:`sphx_glr_auto_examples_07_ui_viz_shapes.py`
.. raw:: html
- DrawPanel
+ Simple Shapes
@@ -263,8 +263,8 @@ These tutorials show how to create user interfaces elements.
.. toctree::
:hidden:
- /auto_examples/07_ui/viz_shapes
/auto_examples/07_ui/viz_drawpanel
+ /auto_examples/07_ui/viz_shapes
/auto_examples/07_ui/viz_card
/auto_examples/07_ui/viz_spinbox
/auto_examples/07_ui/viz_combobox
diff --git a/dev/_sources/auto_examples/07_ui/viz_drawpanel.rst.txt b/dev/_sources/auto_examples/07_ui/viz_drawpanel.rst.txt
index 248717df4..dad357037 100644
--- a/dev/_sources/auto_examples/07_ui/viz_drawpanel.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_drawpanel.rst.txt
@@ -27,53 +27,52 @@ create Various shapes and transform them.
First, some imports.
-.. GENERATED FROM PYTHON SOURCE LINES 11-15
+.. GENERATED FROM PYTHON SOURCE LINES 11-14
.. code-block:: Python
- from fury import ui, window
- from fury.data import fetch_viz_new_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 16-17
+.. GENERATED FROM PYTHON SOURCE LINES 15-16
First we need to fetch some icons that are needed for DrawPanel.
-.. GENERATED FROM PYTHON SOURCE LINES 17-20
+.. GENERATED FROM PYTHON SOURCE LINES 16-19
.. code-block:: Python
- fetch_viz_new_icons()
+ fury.data.fetch_viz_new_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 21-22
+.. GENERATED FROM PYTHON SOURCE LINES 20-21
We then create a DrawPanel Object.
-.. GENERATED FROM PYTHON SOURCE LINES 22-25
+.. GENERATED FROM PYTHON SOURCE LINES 21-24
.. code-block:: Python
- drawing_canvas = ui.DrawPanel(size=(560, 560), position=(40, 10))
+ drawing_canvas = fury.ui.DrawPanel(size=(560, 560), position=(40, 10))
-.. GENERATED FROM PYTHON SOURCE LINES 26-30
+.. GENERATED FROM PYTHON SOURCE LINES 25-29
Show Manager
============
Now we add DrawPanel to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 30-47
+.. GENERATED FROM PYTHON SOURCE LINES 29-46
.. code-block:: Python
current_size = (650, 650)
- showm = window.ShowManager(size=current_size, title="DrawPanel UI Example")
+ showm = fury.window.ShowManager(size=current_size, title="DrawPanel UI Example")
showm.scene.add(drawing_canvas)
@@ -87,7 +86,7 @@ Now we add DrawPanel to the scene.
drawing_canvas.draw_shape(shape_type="circle", current_position=(275, 275))
drawing_canvas.shape_list[-1].resize((50, 50))
- window.record(showm.scene, size=current_size, out_path="viz_drawpanel.png")
+ fury.window.record(showm.scene, size=current_size, out_path="viz_drawpanel.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_drawpanel.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_layout.rst.txt b/dev/_sources/auto_examples/07_ui/viz_layout.rst.txt
index 4e8dfe6b0..7b20b60d1 100644
--- a/dev/_sources/auto_examples/07_ui/viz_layout.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_layout.rst.txt
@@ -25,80 +25,81 @@ Using Layouts with different UI elements
This example shows how to place different UI elements in different Layouts.
The Layouts used here is GridLayout (with different cell shapes).
-First, some imports.
+First, let's import fury.
-.. GENERATED FROM PYTHON SOURCE LINES 11-15
+.. GENERATED FROM PYTHON SOURCE LINES 11-14
.. code-block:: Python
- from fury import ui, window
- from fury.layout import GridLayout
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 16-19
+.. GENERATED FROM PYTHON SOURCE LINES 15-18
We create some panels and then we arrange them in a grid fashion
First, we create some panels with different sizes/positions
-.. GENERATED FROM PYTHON SOURCE LINES 19-24
+.. GENERATED FROM PYTHON SOURCE LINES 18-23
.. code-block:: Python
- panel_1 = ui.Panel2D(size=(200, 200), color=(0.4, 0.6, 0.3), position=(100, 100))
+ panel_1 = fury.ui.Panel2D(size=(200, 200), color=(0.4, 0.6, 0.3), position=(100, 100))
- panel_2 = ui.Panel2D(size=(250, 250), color=(0.8, 0.3, 0.5), position=(150, 150))
+ panel_2 = fury.ui.Panel2D(size=(250, 250), color=(0.8, 0.3, 0.5), position=(150, 150))
-.. GENERATED FROM PYTHON SOURCE LINES 25-26
+.. GENERATED FROM PYTHON SOURCE LINES 24-25
Now we create two listboxes
-.. GENERATED FROM PYTHON SOURCE LINES 26-31
+.. GENERATED FROM PYTHON SOURCE LINES 25-30
.. code-block:: Python
- listbox_1 = ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"])
+ listbox_1 = fury.ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"])
- listbox_2 = ui.ListBox2D(size=(250, 250), values=["First", "Second", "Third"])
+ listbox_2 = fury.ui.ListBox2D(size=(250, 250), values=["First", "Second", "Third"])
-.. GENERATED FROM PYTHON SOURCE LINES 32-33
+.. GENERATED FROM PYTHON SOURCE LINES 31-32
Now we create two different UI i.e. a slider and a listbox
-.. GENERATED FROM PYTHON SOURCE LINES 33-37
+.. GENERATED FROM PYTHON SOURCE LINES 32-36
.. code-block:: Python
- slider = ui.LineSlider2D(length=150)
- listbox = ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"])
+ slider = fury.ui.LineSlider2D(length=150)
+ listbox = fury.ui.ListBox2D(size=(150, 150), values=["First", "Second", "Third"])
-.. GENERATED FROM PYTHON SOURCE LINES 38-39
+.. GENERATED FROM PYTHON SOURCE LINES 37-38
Now, we create grids with different shapes
-.. GENERATED FROM PYTHON SOURCE LINES 39-45
+.. GENERATED FROM PYTHON SOURCE LINES 38-46
.. code-block:: Python
- rect_grid = GridLayout(position_offset=(0, 0, 0))
- square_grid = GridLayout(cell_shape="square", position_offset=(0, 300, 0))
- diagonal_grid = GridLayout(cell_shape="diagonal", position_offset=(0, 600, 0))
+ rect_grid = fury.layout.GridLayout(position_offset=(0, 0, 0))
+ square_grid = fury.layout.GridLayout(cell_shape="square", position_offset=(0, 300, 0))
+ diagonal_grid = fury.layout.GridLayout(
+ cell_shape="diagonal", position_offset=(0, 600, 0)
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 46-47
+.. GENERATED FROM PYTHON SOURCE LINES 47-48
Applying the grid to the ui elements
-.. GENERATED FROM PYTHON SOURCE LINES 47-64
+.. GENERATED FROM PYTHON SOURCE LINES 48-65
.. code-block:: Python
@@ -108,7 +109,7 @@ Applying the grid to the ui elements
diagonal_grid.apply([slider, listbox])
current_size = (1500, 1500)
- show_manager = window.ShowManager(size=current_size, title="FURY UI Layout")
+ show_manager = fury.window.ShowManager(size=current_size, title="FURY UI Layout")
show_manager.scene.add(panel_1, panel_2, listbox_1, listbox_2, slider, listbox)
@@ -118,7 +119,7 @@ Applying the grid to the ui elements
if interactive:
show_manager.start()
- window.record(show_manager.scene, out_path="ui_layout.png", size=(400, 400))
+ fury.window.record(show_manager.scene, out_path="ui_layout.png", size=(400, 400))
.. _sphx_glr_download_auto_examples_07_ui_viz_layout.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_radio_buttons.rst.txt b/dev/_sources/auto_examples/07_ui/viz_radio_buttons.rst.txt
index 1bc1344b5..ef6ddf676 100644
--- a/dev/_sources/auto_examples/07_ui/viz_radio_buttons.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_radio_buttons.rst.txt
@@ -27,42 +27,41 @@ create a Sphere and control its color using radio buttons.
First, some imports.
-.. GENERATED FROM PYTHON SOURCE LINES 11-17
+.. GENERATED FROM PYTHON SOURCE LINES 11-16
.. code-block:: Python
import numpy as np
- from fury import actor, ui, utils, window
- from fury.data import fetch_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 18-19
+.. GENERATED FROM PYTHON SOURCE LINES 17-18
First we need to fetch some icons that are included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 19-22
+.. GENERATED FROM PYTHON SOURCE LINES 18-21
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 23-27
+.. GENERATED FROM PYTHON SOURCE LINES 22-26
Sphere and Radio Buttons
========================
Add a Sphere to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 27-60
+.. GENERATED FROM PYTHON SOURCE LINES 26-59
.. code-block:: Python
- sphere = actor.sphere(
+ sphere = fury.actor.sphere(
centers=np.array([[50, 0, 0]]),
colors=np.array([[0, 0, 1]]),
radii=11.0,
@@ -73,7 +72,7 @@ Add a Sphere to the scene.
# Creating a dict of possible options and mapping it with their values.
options = {"Blue": (0, 0, 255), "Red": (255, 0, 0), "Green": (0, 255, 0)}
- color_toggler = ui.RadioButton(
+ color_toggler = fury.ui.RadioButton(
list(options),
checked_labels=["Blue"],
padding=1,
@@ -85,17 +84,17 @@ Add a Sphere to the scene.
# A callback which will set the values for the box
def toggle_color(radio):
- vcolors = utils.colors_from_actor(sphere)
+ vcolors = fury.utils.colors_from_actor(sphere)
color = options[radio.checked_labels[0]]
vcolors[:] = np.array(color)
- utils.update_actor(sphere)
+ fury.utils.update_actor(sphere)
color_toggler.on_change = toggle_color
-.. GENERATED FROM PYTHON SOURCE LINES 61-66
+.. GENERATED FROM PYTHON SOURCE LINES 60-65
Show Manager
============
@@ -103,23 +102,23 @@ Show Manager
Now that all the elements have been initialised, we add them to the show
manager.
-.. GENERATED FROM PYTHON SOURCE LINES 66-73
+.. GENERATED FROM PYTHON SOURCE LINES 65-72
.. code-block:: Python
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title="FURY Sphere Example")
+ show_manager = fury.window.ShowManager(size=current_size, title="FURY Sphere Example")
show_manager.scene.add(sphere)
show_manager.scene.add(color_toggler)
-.. GENERATED FROM PYTHON SOURCE LINES 74-75
+.. GENERATED FROM PYTHON SOURCE LINES 73-74
Set camera for better visualization
-.. GENERATED FROM PYTHON SOURCE LINES 75-86
+.. GENERATED FROM PYTHON SOURCE LINES 74-87
.. code-block:: Python
@@ -133,7 +132,9 @@ Set camera for better visualization
if interactive:
show_manager.start()
- window.record(show_manager.scene, size=current_size, out_path="viz_radio_buttons.png")
+ fury.window.record(
+ show_manager.scene, size=current_size, out_path="viz_radio_buttons.png"
+ )
.. _sphx_glr_download_auto_examples_07_ui_viz_radio_buttons.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_shapes.rst.txt b/dev/_sources/auto_examples/07_ui/viz_shapes.rst.txt
index c65e15dad..8d1e987e8 100644
--- a/dev/_sources/auto_examples/07_ui/viz_shapes.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_shapes.rst.txt
@@ -27,76 +27,77 @@ some geometric shapes from FURY UI elements.
First, a bunch of imports.
-.. GENERATED FROM PYTHON SOURCE LINES 12-16
+.. GENERATED FROM PYTHON SOURCE LINES 12-15
.. code-block:: Python
- from fury import ui, window
- from fury.data import fetch_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 17-18
+.. GENERATED FROM PYTHON SOURCE LINES 16-17
First we need to fetch some icons that are included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 18-21
+.. GENERATED FROM PYTHON SOURCE LINES 17-20
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 22-23
+.. GENERATED FROM PYTHON SOURCE LINES 21-22
Let's draw some simple shapes. First, a rectangle.
-.. GENERATED FROM PYTHON SOURCE LINES 23-26
+.. GENERATED FROM PYTHON SOURCE LINES 22-25
.. code-block:: Python
- rect = ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1))
+ rect = fury.ui.Rectangle2D(size=(100, 100), position=(400, 400), color=(1, 0, 1))
-.. GENERATED FROM PYTHON SOURCE LINES 27-28
+.. GENERATED FROM PYTHON SOURCE LINES 26-27
Then we can draw a solid circle, or disk.
-.. GENERATED FROM PYTHON SOURCE LINES 28-31
+.. GENERATED FROM PYTHON SOURCE LINES 27-30
.. code-block:: Python
- disk = ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0))
+ disk = fury.ui.Disk2D(outer_radius=50, center=(400, 200), color=(1, 1, 0))
-.. GENERATED FROM PYTHON SOURCE LINES 32-33
+.. GENERATED FROM PYTHON SOURCE LINES 31-32
Add an inner radius to make a ring.
-.. GENERATED FROM PYTHON SOURCE LINES 33-37
+.. GENERATED FROM PYTHON SOURCE LINES 32-38
.. code-block:: Python
- ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1))
+ ring = fury.ui.Disk2D(
+ outer_radius=50, inner_radius=45, center=(500, 600), color=(0, 1, 1)
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 38-40
+.. GENERATED FROM PYTHON SOURCE LINES 39-41
Now that all the elements have been initialised, we add them to the show
manager.
-.. GENERATED FROM PYTHON SOURCE LINES 40-54
+.. GENERATED FROM PYTHON SOURCE LINES 41-55
.. code-block:: Python
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title="FURY Shapes Example")
+ show_manager = fury.window.ShowManager(size=current_size, title="FURY Shapes Example")
show_manager.scene.add(rect)
show_manager.scene.add(disk)
@@ -107,7 +108,7 @@ manager.
if interactive:
show_manager.start()
- window.record(show_manager.scene, size=current_size, out_path="viz_shapes.png")
+ fury.window.record(show_manager.scene, size=current_size, out_path="viz_shapes.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_shapes.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_spinbox.rst.txt b/dev/_sources/auto_examples/07_ui/viz_spinbox.rst.txt
index 88bc72e30..c81c73499 100644
--- a/dev/_sources/auto_examples/07_ui/viz_spinbox.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_spinbox.rst.txt
@@ -27,39 +27,38 @@ a SpinBox UI.
First, some imports.
-.. GENERATED FROM PYTHON SOURCE LINES 12-18
+.. GENERATED FROM PYTHON SOURCE LINES 12-17
.. code-block:: Python
import numpy as np
- from fury import actor, ui, utils, window
- from fury.data import fetch_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 19-20
+.. GENERATED FROM PYTHON SOURCE LINES 18-19
First we need to fetch some icons that are included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 20-23
+.. GENERATED FROM PYTHON SOURCE LINES 19-22
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 24-25
+.. GENERATED FROM PYTHON SOURCE LINES 23-24
Let's create a Cone.
-.. GENERATED FROM PYTHON SOURCE LINES 25-33
+.. GENERATED FROM PYTHON SOURCE LINES 24-32
.. code-block:: Python
- cone = actor.cone(
+ cone = fury.actor.cone(
centers=np.random.rand(1, 3),
directions=np.random.rand(1, 3),
colors=(1, 1, 1),
@@ -67,16 +66,16 @@ Let's create a Cone.
)
-.. GENERATED FROM PYTHON SOURCE LINES 34-35
+.. GENERATED FROM PYTHON SOURCE LINES 33-34
Creating the SpinBox UI.
-.. GENERATED FROM PYTHON SOURCE LINES 35-45
+.. GENERATED FROM PYTHON SOURCE LINES 34-44
.. code-block:: Python
- spinbox = ui.SpinBox(
+ spinbox = fury.ui.SpinBox(
position=(200, 100),
size=(300, 100),
min_val=0,
@@ -86,28 +85,28 @@ Creating the SpinBox UI.
)
-.. GENERATED FROM PYTHON SOURCE LINES 46-48
+.. GENERATED FROM PYTHON SOURCE LINES 45-47
Now that all the elements have been initialised, we add them to the show
manager.
-.. GENERATED FROM PYTHON SOURCE LINES 48-55
+.. GENERATED FROM PYTHON SOURCE LINES 47-54
.. code-block:: Python
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title="FURY SpinBox Example")
+ show_manager = fury.window.ShowManager(size=current_size, title="FURY SpinBox Example")
show_manager.scene.add(cone)
show_manager.scene.add(spinbox)
-.. GENERATED FROM PYTHON SOURCE LINES 56-57
+.. GENERATED FROM PYTHON SOURCE LINES 55-56
Using the on_change hook to rotate the cone.
-.. GENERATED FROM PYTHON SOURCE LINES 57-71
+.. GENERATED FROM PYTHON SOURCE LINES 56-70
.. code-block:: Python
@@ -119,18 +118,18 @@ Using the on_change hook to rotate the cone.
def rotate_cone(spinbox):
global previous_value
change_in_value = spinbox.value - previous_value
- utils.rotate(cone, (change_in_value, 1, 0, 0))
+ fury.utils.rotate(cone, (change_in_value, 1, 0, 0))
previous_value = spinbox.value
spinbox.on_change = rotate_cone
-.. GENERATED FROM PYTHON SOURCE LINES 72-73
+.. GENERATED FROM PYTHON SOURCE LINES 71-72
Starting the ShowManager.
-.. GENERATED FROM PYTHON SOURCE LINES 73-80
+.. GENERATED FROM PYTHON SOURCE LINES 72-79
.. code-block:: Python
@@ -140,7 +139,7 @@ Starting the ShowManager.
if interactive:
show_manager.start()
- window.record(show_manager.scene, size=current_size, out_path="viz_spinbox.png")
+ fury.window.record(show_manager.scene, size=current_size, out_path="viz_spinbox.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_spinbox.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_tab.rst.txt b/dev/_sources/auto_examples/07_ui/viz_tab.rst.txt
index 4c37f756f..10bae4e2e 100644
--- a/dev/_sources/auto_examples/07_ui/viz_tab.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_tab.rst.txt
@@ -31,47 +31,46 @@ create Tabs for:
First, some imports.
-.. GENERATED FROM PYTHON SOURCE LINES 15-21
+.. GENERATED FROM PYTHON SOURCE LINES 15-20
.. code-block:: Python
import numpy as np
- from fury import actor, ui, window
- from fury.data import fetch_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 22-23
+.. GENERATED FROM PYTHON SOURCE LINES 21-22
First we need to fetch some icons that are included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 23-26
+.. GENERATED FROM PYTHON SOURCE LINES 22-25
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 27-28
+.. GENERATED FROM PYTHON SOURCE LINES 26-27
First, we create the Tab UI.
-.. GENERATED FROM PYTHON SOURCE LINES 28-31
+.. GENERATED FROM PYTHON SOURCE LINES 27-30
.. code-block:: Python
- tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True)
+ tab_ui = fury.ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True)
-.. GENERATED FROM PYTHON SOURCE LINES 32-34
+.. GENERATED FROM PYTHON SOURCE LINES 31-33
We can also define the position of the Tab Bar.
By default the Tab Bar is positioned at top
-.. GENERATED FROM PYTHON SOURCE LINES 34-37
+.. GENERATED FROM PYTHON SOURCE LINES 33-36
.. code-block:: Python
@@ -79,21 +78,21 @@ By default the Tab Bar is positioned at top
tab_ui.tab_bar_pos = "bottom"
-.. GENERATED FROM PYTHON SOURCE LINES 38-42
+.. GENERATED FROM PYTHON SOURCE LINES 37-41
Slider Controls for a Cube for Tab Index 0
==========================================
Now we prepare content for the first tab.
-.. GENERATED FROM PYTHON SOURCE LINES 42-94
+.. GENERATED FROM PYTHON SOURCE LINES 41-93
.. code-block:: Python
- ring_slider = ui.RingSlider2D(initial_value=0, text_template="{angle:5.1f}°")
+ ring_slider = fury.ui.RingSlider2D(initial_value=0, text_template="{angle:5.1f}°")
- line_slider_x = ui.LineSlider2D(
+ line_slider_x = fury.ui.LineSlider2D(
initial_value=0,
min_value=-10,
max_value=10,
@@ -101,7 +100,7 @@ Now we prepare content for the first tab.
text_alignment="Top",
)
- line_slider_y = ui.LineSlider2D(
+ line_slider_y = fury.ui.LineSlider2D(
initial_value=0,
min_value=-10,
max_value=10,
@@ -109,7 +108,7 @@ Now we prepare content for the first tab.
text_alignment="Right",
)
- cube = actor.box(
+ cube = fury.actor.box(
centers=np.array([[10, 0, 0]]),
directions=np.array([[0, 1, 0]]),
colors=np.array([[0, 0, 1]]),
@@ -143,11 +142,11 @@ Now we prepare content for the first tab.
line_slider_y.on_change = translate_cube_y
-.. GENERATED FROM PYTHON SOURCE LINES 95-96
+.. GENERATED FROM PYTHON SOURCE LINES 94-95
After defining content, we define properties for the tab.
-.. GENERATED FROM PYTHON SOURCE LINES 96-102
+.. GENERATED FROM PYTHON SOURCE LINES 95-101
.. code-block:: Python
@@ -158,29 +157,29 @@ After defining content, we define properties for the tab.
tab_ui.add_element(0, line_slider_y, (0.0, 0.1))
-.. GENERATED FROM PYTHON SOURCE LINES 103-107
+.. GENERATED FROM PYTHON SOURCE LINES 102-106
CheckBoxes For Cylinder and Sphere for Tab Index 1
==================================================
Now we prepare content for second tab.
-.. GENERATED FROM PYTHON SOURCE LINES 107-140
+.. GENERATED FROM PYTHON SOURCE LINES 106-139
.. code-block:: Python
- cylinder = actor.cylinder(
+ cylinder = fury.actor.cylinder(
centers=np.array([[0, 0, 0]]),
directions=np.array([[1, 1, 0]]),
colors=np.array([[0, 1, 1]]),
radius=1.0,
)
- sphere = actor.sphere(centers=np.array([[5, 0, 0]]), colors=(1, 1, 0))
+ sphere = fury.actor.sphere(centers=np.array([[5, 0, 0]]), colors=(1, 1, 0))
figure_dict = {"cylinder": cylinder, "sphere": sphere}
- checkbox = ui.Checkbox(labels=["cylinder", "sphere"])
+ checkbox = fury.ui.Checkbox(labels=["cylinder", "sphere"])
# Get difference between two lists.
@@ -203,11 +202,11 @@ Now we prepare content for second tab.
checkbox.on_change = set_figure_visiblity
-.. GENERATED FROM PYTHON SOURCE LINES 141-142
+.. GENERATED FROM PYTHON SOURCE LINES 140-141
After defining content, we define properties for the tab.
-.. GENERATED FROM PYTHON SOURCE LINES 142-146
+.. GENERATED FROM PYTHON SOURCE LINES 141-145
.. code-block:: Python
@@ -216,19 +215,19 @@ After defining content, we define properties for the tab.
tab_ui.add_element(1, checkbox, (0.2, 0.2))
-.. GENERATED FROM PYTHON SOURCE LINES 147-151
+.. GENERATED FROM PYTHON SOURCE LINES 146-150
Color Combobox for Fury for Tab Index 2
=======================================
Now we prepare content for third tab.
-.. GENERATED FROM PYTHON SOURCE LINES 151-185
+.. GENERATED FROM PYTHON SOURCE LINES 150-184
.. code-block:: Python
- label = ui.TextBlock2D(
+ label = fury.ui.TextBlock2D(
position=(600, 300),
font_size=40,
color=(1, 0.5, 0),
@@ -247,7 +246,7 @@ Now we prepare content for third tab.
"Red": (1, 0, 0),
}
- color_combobox = ui.ComboBox2D(
+ color_combobox = fury.ui.ComboBox2D(
items=list(colors.keys()),
placeholder="Choose Text Color",
size=(250, 150),
@@ -262,11 +261,11 @@ Now we prepare content for third tab.
color_combobox.on_change = change_color
-.. GENERATED FROM PYTHON SOURCE LINES 186-187
+.. GENERATED FROM PYTHON SOURCE LINES 185-186
After defining content, we define properties for the tab.
-.. GENERATED FROM PYTHON SOURCE LINES 187-191
+.. GENERATED FROM PYTHON SOURCE LINES 186-190
.. code-block:: Python
@@ -275,13 +274,13 @@ After defining content, we define properties for the tab.
tab_ui.add_element(2, color_combobox, (0.1, 0.3))
-.. GENERATED FROM PYTHON SOURCE LINES 192-195
+.. GENERATED FROM PYTHON SOURCE LINES 191-194
Define on_change & on_collapsed methods for tab ui to perform certain tasks
while active tab is changed or when the tab is collapsed.
Note: Tab UI can be collapsed by right clicking on it.
-.. GENERATED FROM PYTHON SOURCE LINES 195-228
+.. GENERATED FROM PYTHON SOURCE LINES 194-227
.. code-block:: Python
@@ -319,16 +318,16 @@ Note: Tab UI can be collapsed by right clicking on it.
-.. GENERATED FROM PYTHON SOURCE LINES 229-230
+.. GENERATED FROM PYTHON SOURCE LINES 228-229
Next we prepare the scene and render it with the help of show manager.
-.. GENERATED FROM PYTHON SOURCE LINES 230-241
+.. GENERATED FROM PYTHON SOURCE LINES 229-240
.. code-block:: Python
- sm = window.ShowManager(size=(800, 500), title="Viz Tab")
+ sm = fury.window.ShowManager(size=(800, 500), title="Viz Tab")
sm.scene.add(tab_ui, cube, cylinder, sphere, label)
# To interact with the ui set interactive = True
@@ -337,7 +336,7 @@ Next we prepare the scene and render it with the help of show manager.
if interactive:
sm.start()
- window.record(sm.scene, size=(500, 500), out_path="viz_tab.png")
+ fury.window.record(sm.scene, size=(500, 500), out_path="viz_tab.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_tab.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_ui.rst.txt b/dev/_sources/auto_examples/07_ui/viz_ui.rst.txt
index 57e6d87f6..e3ab8e87b 100644
--- a/dev/_sources/auto_examples/07_ui/viz_ui.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_ui.rst.txt
@@ -27,57 +27,58 @@ several FURY UI elements, then use a list box to toggle which element is shown.
First, a bunch of imports.
-.. GENERATED FROM PYTHON SOURCE LINES 12-18
+.. GENERATED FROM PYTHON SOURCE LINES 12-17
.. code-block:: Python
import numpy as np
- from fury import actor, ui, window
- from fury.data import fetch_viz_icons, read_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 19-23
+.. GENERATED FROM PYTHON SOURCE LINES 18-22
Shapes
======
Let's start by drawing some simple shapes. First, a rectangle.
-.. GENERATED FROM PYTHON SOURCE LINES 23-26
+.. GENERATED FROM PYTHON SOURCE LINES 22-25
.. code-block:: Python
- rect = ui.Rectangle2D(size=(200, 200), position=(400, 300), color=(1, 0, 1))
+ rect = fury.ui.Rectangle2D(size=(200, 200), position=(400, 300), color=(1, 0, 1))
-.. GENERATED FROM PYTHON SOURCE LINES 27-28
+.. GENERATED FROM PYTHON SOURCE LINES 26-27
Then we can draw a solid circle, or disk.
-.. GENERATED FROM PYTHON SOURCE LINES 28-31
+.. GENERATED FROM PYTHON SOURCE LINES 27-30
.. code-block:: Python
- disk = ui.Disk2D(outer_radius=50, center=(500, 500), color=(1, 1, 0))
+ disk = fury.ui.Disk2D(outer_radius=50, center=(500, 500), color=(1, 1, 0))
-.. GENERATED FROM PYTHON SOURCE LINES 32-33
+.. GENERATED FROM PYTHON SOURCE LINES 31-32
Add an inner radius to make a ring.
-.. GENERATED FROM PYTHON SOURCE LINES 33-36
+.. GENERATED FROM PYTHON SOURCE LINES 32-37
.. code-block:: Python
- ring = ui.Disk2D(outer_radius=50, inner_radius=45, center=(500, 300), color=(0, 1, 1))
+ ring = fury.ui.Disk2D(
+ outer_radius=50, inner_radius=45, center=(500, 300), color=(0, 1, 1)
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 37-42
+.. GENERATED FROM PYTHON SOURCE LINES 38-43
Image
=====
@@ -85,29 +86,29 @@ Image
Now let's display an image. First we need to fetch some icons that are
included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 42-45
+.. GENERATED FROM PYTHON SOURCE LINES 43-46
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 46-47
+.. GENERATED FROM PYTHON SOURCE LINES 47-48
Now we can create an image container.
-.. GENERATED FROM PYTHON SOURCE LINES 47-52
+.. GENERATED FROM PYTHON SOURCE LINES 48-53
.. code-block:: Python
- img = ui.ImageContainer2D(
- img_path=read_viz_icons(fname="home3.png"), position=(450, 350)
+ img = fury.ui.ImageContainer2D(
+ img_path=fury.data.read_viz_icons(fname="home3.png"), position=(450, 350)
)
-.. GENERATED FROM PYTHON SOURCE LINES 53-58
+.. GENERATED FROM PYTHON SOURCE LINES 54-59
Panel with buttons and text
===========================
@@ -115,65 +116,65 @@ Panel with buttons and text
Let's create some buttons and text and put them in a panel. First we'll
make the panel.
-.. GENERATED FROM PYTHON SOURCE LINES 58-62
+.. GENERATED FROM PYTHON SOURCE LINES 59-63
.. code-block:: Python
- panel = ui.Panel2D(size=(300, 150), color=(1, 1, 1), align="right")
+ panel = fury.ui.Panel2D(size=(300, 150), color=(1, 1, 1), align="right")
panel.center = (500, 400)
-.. GENERATED FROM PYTHON SOURCE LINES 63-65
+.. GENERATED FROM PYTHON SOURCE LINES 64-66
Then we'll make two text labels and place them on the panel.
Note that we specify the position with integer numbers of pixels.
-.. GENERATED FROM PYTHON SOURCE LINES 65-71
+.. GENERATED FROM PYTHON SOURCE LINES 66-72
.. code-block:: Python
- text = ui.TextBlock2D(text="Click me")
- text2 = ui.TextBlock2D(text="Me too")
+ text = fury.ui.TextBlock2D(text="Click me")
+ text2 = fury.ui.TextBlock2D(text="Me too")
panel.add_element(text, (50, 100))
panel.add_element(text2, (180, 100))
-.. GENERATED FROM PYTHON SOURCE LINES 72-76
+.. GENERATED FROM PYTHON SOURCE LINES 73-77
Then we'll create two buttons and add them to the panel.
Note that here we specify the positions with floats. In this case, these are
percentages of the panel size.
-.. GENERATED FROM PYTHON SOURCE LINES 76-93
+.. GENERATED FROM PYTHON SOURCE LINES 77-94
.. code-block:: Python
- button_example = ui.Button2D(
- icon_fnames=[("square", read_viz_icons(fname="stop2.png"))]
+ button_example = fury.ui.Button2D(
+ icon_fnames=[("square", fury.data.read_viz_icons(fname="stop2.png"))]
)
icon_files = []
- icon_files.append(("down", read_viz_icons(fname="circle-down.png")))
- icon_files.append(("left", read_viz_icons(fname="circle-left.png")))
- icon_files.append(("up", read_viz_icons(fname="circle-up.png")))
- icon_files.append(("right", read_viz_icons(fname="circle-right.png")))
+ icon_files.append(("down", fury.data.read_viz_icons(fname="circle-down.png")))
+ icon_files.append(("left", fury.data.read_viz_icons(fname="circle-left.png")))
+ icon_files.append(("up", fury.data.read_viz_icons(fname="circle-up.png")))
+ icon_files.append(("right", fury.data.read_viz_icons(fname="circle-right.png")))
- second_button_example = ui.Button2D(icon_fnames=icon_files)
+ second_button_example = fury.ui.Button2D(icon_fnames=icon_files)
panel.add_element(button_example, (0.25, 0.33))
panel.add_element(second_button_example, (0.66, 0.33))
-.. GENERATED FROM PYTHON SOURCE LINES 94-95
+.. GENERATED FROM PYTHON SOURCE LINES 95-96
We can add a callback to each button to perform some action.
-.. GENERATED FROM PYTHON SOURCE LINES 95-110
+.. GENERATED FROM PYTHON SOURCE LINES 96-111
.. code-block:: Python
@@ -193,20 +194,20 @@ We can add a callback to each button to perform some action.
second_button_example.on_left_mouse_button_pressed = change_icon_callback
-.. GENERATED FROM PYTHON SOURCE LINES 111-115
+.. GENERATED FROM PYTHON SOURCE LINES 112-116
Cube and sliders
================
Let's add a cube to the scene and control it with sliders.
-.. GENERATED FROM PYTHON SOURCE LINES 115-124
+.. GENERATED FROM PYTHON SOURCE LINES 116-125
.. code-block:: Python
- cube = actor.cube(
+ cube = fury.actor.cube(
centers=np.array([[15, 0, 0]]),
colors=np.array([[0, 0, 1]]),
scales=np.array([[20, 20, 20]]),
@@ -214,20 +215,20 @@ Let's add a cube to the scene and control it with sliders.
)
-.. GENERATED FROM PYTHON SOURCE LINES 125-126
+.. GENERATED FROM PYTHON SOURCE LINES 126-127
Now we'll add three sliders: one circular and two linear.
-.. GENERATED FROM PYTHON SOURCE LINES 126-147
+.. GENERATED FROM PYTHON SOURCE LINES 127-148
.. code-block:: Python
- ring_slider = ui.RingSlider2D(
+ ring_slider = fury.ui.RingSlider2D(
center=(740, 400), initial_value=0, text_template="{angle:5.1f}°"
)
- line_slider_x = ui.LineSlider2D(
+ line_slider_x = fury.ui.LineSlider2D(
center=(500, 250),
initial_value=0,
min_value=-10,
@@ -235,7 +236,7 @@ Now we'll add three sliders: one circular and two linear.
orientation="horizontal",
)
- line_slider_y = ui.LineSlider2D(
+ line_slider_y = fury.ui.LineSlider2D(
center=(650, 350),
initial_value=0,
min_value=-10,
@@ -244,11 +245,11 @@ Now we'll add three sliders: one circular and two linear.
)
-.. GENERATED FROM PYTHON SOURCE LINES 148-149
+.. GENERATED FROM PYTHON SOURCE LINES 149-150
We can use a callback to rotate the cube with the ring slider.
-.. GENERATED FROM PYTHON SOURCE LINES 149-160
+.. GENERATED FROM PYTHON SOURCE LINES 150-161
.. code-block:: Python
@@ -264,12 +265,12 @@ We can use a callback to rotate the cube with the ring slider.
ring_slider.on_change = rotate_cube
-.. GENERATED FROM PYTHON SOURCE LINES 161-163
+.. GENERATED FROM PYTHON SOURCE LINES 162-164
Similarly, we can translate the cube with line sliders.
We use global variables to keep track of the position of the cube.
-.. GENERATED FROM PYTHON SOURCE LINES 163-183
+.. GENERATED FROM PYTHON SOURCE LINES 164-184
.. code-block:: Python
@@ -294,7 +295,7 @@ We use global variables to keep track of the position of the cube.
line_slider_y.on_change = translate_cube_y
-.. GENERATED FROM PYTHON SOURCE LINES 184-189
+.. GENERATED FROM PYTHON SOURCE LINES 185-190
Range Slider
============
@@ -302,12 +303,12 @@ Range Slider
Finally, we can add a range slider. This element is composed of two sliders.
The first slider has two handles which let you set the range of the second.
-.. GENERATED FROM PYTHON SOURCE LINES 189-218
+.. GENERATED FROM PYTHON SOURCE LINES 190-219
.. code-block:: Python
- range_slider_x = ui.RangeSlider(
+ range_slider_x = fury.ui.RangeSlider(
line_width=8,
handle_side=25,
range_slider_center=(450, 450),
@@ -321,7 +322,7 @@ The first slider has two handles which let you set the range of the second.
shape="square",
)
- range_slider_y = ui.RangeSlider(
+ range_slider_y = fury.ui.RangeSlider(
line_width=8,
handle_side=25,
range_slider_center=(750, 400),
@@ -336,7 +337,7 @@ The first slider has two handles which let you set the range of the second.
shape="square",
)
-.. GENERATED FROM PYTHON SOURCE LINES 219-226
+.. GENERATED FROM PYTHON SOURCE LINES 220-227
Select menu
============
@@ -346,7 +347,7 @@ the screen. Let's make a simple menu to choose which example is shown.
We'll first make a list of the examples.
-.. GENERATED FROM PYTHON SOURCE LINES 226-236
+.. GENERATED FROM PYTHON SOURCE LINES 227-237
.. code-block:: Python
@@ -361,12 +362,12 @@ We'll first make a list of the examples.
]
-.. GENERATED FROM PYTHON SOURCE LINES 237-239
+.. GENERATED FROM PYTHON SOURCE LINES 238-240
Now we'll make a function to hide all the examples. Then we'll call it so
that none are shown initially.
-.. GENERATED FROM PYTHON SOURCE LINES 239-250
+.. GENERATED FROM PYTHON SOURCE LINES 240-251
.. code-block:: Python
@@ -382,12 +383,12 @@ that none are shown initially.
hide_all_examples()
-.. GENERATED FROM PYTHON SOURCE LINES 251-253
+.. GENERATED FROM PYTHON SOURCE LINES 252-254
To make the menu, we'll first need to create a list of labels which
correspond with the examples.
-.. GENERATED FROM PYTHON SOURCE LINES 253-263
+.. GENERATED FROM PYTHON SOURCE LINES 254-264
.. code-block:: Python
@@ -402,26 +403,26 @@ correspond with the examples.
]
-.. GENERATED FROM PYTHON SOURCE LINES 264-265
+.. GENERATED FROM PYTHON SOURCE LINES 265-266
Now we can create the menu.
-.. GENERATED FROM PYTHON SOURCE LINES 265-270
+.. GENERATED FROM PYTHON SOURCE LINES 266-271
.. code-block:: Python
- listbox = ui.ListBox2D(
+ listbox = fury.ui.ListBox2D(
values=values, position=(10, 300), size=(300, 200), multiselection=False
)
-.. GENERATED FROM PYTHON SOURCE LINES 271-273
+.. GENERATED FROM PYTHON SOURCE LINES 272-274
Then we will use a callback to show the correct example when a label is
clicked.
-.. GENERATED FROM PYTHON SOURCE LINES 273-286
+.. GENERATED FROM PYTHON SOURCE LINES 274-287
.. code-block:: Python
@@ -439,7 +440,7 @@ clicked.
listbox.on_change = display_element
-.. GENERATED FROM PYTHON SOURCE LINES 287-292
+.. GENERATED FROM PYTHON SOURCE LINES 288-293
Show Manager
==================================
@@ -447,13 +448,13 @@ Show Manager
Now that all the elements have been initialised, we add them to the show
manager.
-.. GENERATED FROM PYTHON SOURCE LINES 292-313
+.. GENERATED FROM PYTHON SOURCE LINES 293-314
.. code-block:: Python
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title="FURY UI Example")
+ show_manager = fury.window.ShowManager(size=current_size, title="FURY UI Example")
show_manager.scene.add(listbox)
for example in examples:
@@ -471,7 +472,7 @@ manager.
if interactive:
show_manager.start()
- window.record(show_manager.scene, size=current_size, out_path="viz_ui.png")
+ fury.window.record(show_manager.scene, size=current_size, out_path="viz_fury.ui.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_ui.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_ui_listbox.rst.txt b/dev/_sources/auto_examples/07_ui/viz_ui_listbox.rst.txt
index 8eb6c2bb0..a9ced3f0c 100644
--- a/dev/_sources/auto_examples/07_ui/viz_ui_listbox.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_ui_listbox.rst.txt
@@ -27,49 +27,48 @@ some geometric shapes from FURY UI elements.
First, a bunch of imports.
-.. GENERATED FROM PYTHON SOURCE LINES 12-16
+.. GENERATED FROM PYTHON SOURCE LINES 12-15
.. code-block:: Python
- from fury import ui, window
- from fury.data import fetch_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 17-18
+.. GENERATED FROM PYTHON SOURCE LINES 16-17
First we need to fetch some icons that are included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 18-21
+.. GENERATED FROM PYTHON SOURCE LINES 17-20
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 22-24
+.. GENERATED FROM PYTHON SOURCE LINES 21-23
Create some text blocks that will be shown when
list elements will be selected
-.. GENERATED FROM PYTHON SOURCE LINES 24-31
+.. GENERATED FROM PYTHON SOURCE LINES 23-30
.. code-block:: Python
- welcome_text = ui.TextBlock2D(text="Welcome", font_size=30, position=(500, 400))
- bye_text = ui.TextBlock2D(text="Bye", font_size=30, position=(500, 400))
- fury_text = ui.TextBlock2D(text="Fury", font_size=30, position=(500, 400))
+ welcome_text = fury.ui.TextBlock2D(text="Welcome", font_size=30, position=(500, 400))
+ bye_text = fury.ui.TextBlock2D(text="Bye", font_size=30, position=(500, 400))
+ fury_text = fury.ui.TextBlock2D(text="Fury", font_size=30, position=(500, 400))
example = [welcome_text, bye_text, fury_text]
-.. GENERATED FROM PYTHON SOURCE LINES 32-33
+.. GENERATED FROM PYTHON SOURCE LINES 31-32
Hide these text blocks for now
-.. GENERATED FROM PYTHON SOURCE LINES 33-42
+.. GENERATED FROM PYTHON SOURCE LINES 32-41
.. code-block:: Python
@@ -83,26 +82,26 @@ Hide these text blocks for now
hide_all_examples()
-.. GENERATED FROM PYTHON SOURCE LINES 43-44
+.. GENERATED FROM PYTHON SOURCE LINES 42-43
Create ListBox with the values as parameter.
-.. GENERATED FROM PYTHON SOURCE LINES 44-50
+.. GENERATED FROM PYTHON SOURCE LINES 43-49
.. code-block:: Python
values = ["Welcome", "Bye", "Fury"]
- listbox = ui.ListBox2D(
+ listbox = fury.ui.ListBox2D(
values=values, position=(10, 300), size=(200, 200), multiselection=False
)
-.. GENERATED FROM PYTHON SOURCE LINES 51-52
+.. GENERATED FROM PYTHON SOURCE LINES 50-51
Function to show selected element.
-.. GENERATED FROM PYTHON SOURCE LINES 52-62
+.. GENERATED FROM PYTHON SOURCE LINES 51-61
.. code-block:: Python
@@ -117,18 +116,20 @@ Function to show selected element.
listbox.on_change = display_element
-.. GENERATED FROM PYTHON SOURCE LINES 63-65
+.. GENERATED FROM PYTHON SOURCE LINES 62-64
Now that all the elements have been initialised, we add them to the show
manager.
-.. GENERATED FROM PYTHON SOURCE LINES 65-79
+.. GENERATED FROM PYTHON SOURCE LINES 64-80
.. code-block:: Python
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title="FURY UI ListBox_Example")
+ show_manager = fury.window.ShowManager(
+ size=current_size, title="FURY UI ListBox_Example"
+ )
show_manager.scene.add(listbox)
show_manager.scene.add(welcome_text)
@@ -139,7 +140,7 @@ manager.
if interactive:
show_manager.start()
- window.record(show_manager.scene, size=current_size, out_path="viz_listbox.png")
+ fury.window.record(show_manager.scene, size=current_size, out_path="viz_listbox.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_ui_listbox.py:
diff --git a/dev/_sources/auto_examples/07_ui/viz_ui_slider.rst.txt b/dev/_sources/auto_examples/07_ui/viz_ui_slider.rst.txt
index a582e6e27..10f78d7d3 100644
--- a/dev/_sources/auto_examples/07_ui/viz_ui_slider.rst.txt
+++ b/dev/_sources/auto_examples/07_ui/viz_ui_slider.rst.txt
@@ -27,42 +27,41 @@ create a cube and control with sliders.
First, some imports.
-.. GENERATED FROM PYTHON SOURCE LINES 12-18
+.. GENERATED FROM PYTHON SOURCE LINES 12-17
.. code-block:: Python
import numpy as np
- from fury import actor, ui, window
- from fury.data import fetch_viz_icons
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 19-20
+.. GENERATED FROM PYTHON SOURCE LINES 18-19
First we need to fetch some icons that are included in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 20-23
+.. GENERATED FROM PYTHON SOURCE LINES 19-22
.. code-block:: Python
- fetch_viz_icons()
+ fury.data.fetch_viz_icons()
-.. GENERATED FROM PYTHON SOURCE LINES 24-28
+.. GENERATED FROM PYTHON SOURCE LINES 23-27
Cube and sliders
================
Add a cube to the scene .
-.. GENERATED FROM PYTHON SOURCE LINES 28-36
+.. GENERATED FROM PYTHON SOURCE LINES 27-35
.. code-block:: Python
- cube = actor.cube(
+ cube = fury.actor.cube(
centers=np.array([[15, 0, 0]]),
colors=np.array([[0, 0, 1]]),
scales=np.array([[20, 20, 20]]),
@@ -70,21 +69,21 @@ Add a cube to the scene .
)
-.. GENERATED FROM PYTHON SOURCE LINES 37-39
+.. GENERATED FROM PYTHON SOURCE LINES 36-38
Now we'll add five sliders: 1 circular and 4 linear sliders.
By default the alignments are 'bottom' for horizontal and 'top' for vertical.
-.. GENERATED FROM PYTHON SOURCE LINES 39-81
+.. GENERATED FROM PYTHON SOURCE LINES 38-80
.. code-block:: Python
- ring_slider = ui.RingSlider2D(
+ ring_slider = fury.ui.RingSlider2D(
center=(630, 400), initial_value=0, text_template="{angle:5.1f}°"
)
- hor_line_slider_text_top = ui.LineSlider2D(
+ hor_line_slider_text_top = fury.ui.LineSlider2D(
center=(400, 230),
initial_value=0,
orientation="horizontal",
@@ -93,7 +92,7 @@ By default the alignments are 'bottom' for horizontal and 'top' for vertical.
text_alignment="top",
)
- hor_line_slider_text_bottom = ui.LineSlider2D(
+ hor_line_slider_text_bottom = fury.ui.LineSlider2D(
center=(400, 200),
initial_value=0,
orientation="horizontal",
@@ -102,7 +101,7 @@ By default the alignments are 'bottom' for horizontal and 'top' for vertical.
text_alignment="bottom",
)
- ver_line_slider_text_left = ui.LineSlider2D(
+ ver_line_slider_text_left = fury.ui.LineSlider2D(
center=(100, 400),
initial_value=0,
orientation="vertical",
@@ -111,7 +110,7 @@ By default the alignments are 'bottom' for horizontal and 'top' for vertical.
text_alignment="left",
)
- ver_line_slider_text_right = ui.LineSlider2D(
+ ver_line_slider_text_right = fury.ui.LineSlider2D(
center=(150, 400),
initial_value=0,
orientation="vertical",
@@ -122,11 +121,11 @@ By default the alignments are 'bottom' for horizontal and 'top' for vertical.
-.. GENERATED FROM PYTHON SOURCE LINES 82-83
+.. GENERATED FROM PYTHON SOURCE LINES 81-82
We can use a callback to rotate the cube with the ring slider.
-.. GENERATED FROM PYTHON SOURCE LINES 83-94
+.. GENERATED FROM PYTHON SOURCE LINES 82-93
.. code-block:: Python
@@ -142,11 +141,11 @@ We can use a callback to rotate the cube with the ring slider.
ring_slider.on_change = rotate_cube
-.. GENERATED FROM PYTHON SOURCE LINES 95-96
+.. GENERATED FROM PYTHON SOURCE LINES 94-95
Similarly, we can translate the cube with the line slider.
-.. GENERATED FROM PYTHON SOURCE LINES 96-113
+.. GENERATED FROM PYTHON SOURCE LINES 95-112
.. code-block:: Python
@@ -168,7 +167,7 @@ Similarly, we can translate the cube with the line slider.
ver_line_slider_text_right.on_change = translate_cube_ver
-.. GENERATED FROM PYTHON SOURCE LINES 114-119
+.. GENERATED FROM PYTHON SOURCE LINES 113-118
Show Manager
==================================
@@ -176,13 +175,13 @@ Show Manager
Now that all the elements have been initialised, we add them to the show
manager.
-.. GENERATED FROM PYTHON SOURCE LINES 119-131
+.. GENERATED FROM PYTHON SOURCE LINES 118-130
.. code-block:: Python
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title="FURY Cube Example")
+ show_manager = fury.window.ShowManager(size=current_size, title="FURY Cube Example")
show_manager.scene.add(cube)
show_manager.scene.add(ring_slider)
@@ -193,11 +192,11 @@ manager.
-.. GENERATED FROM PYTHON SOURCE LINES 132-133
+.. GENERATED FROM PYTHON SOURCE LINES 131-132
Visibility by default is True
-.. GENERATED FROM PYTHON SOURCE LINES 133-141
+.. GENERATED FROM PYTHON SOURCE LINES 132-140
.. code-block:: Python
@@ -210,11 +209,11 @@ Visibility by default is True
ver_line_slider_text_right.set_visibility(True)
-.. GENERATED FROM PYTHON SOURCE LINES 142-143
+.. GENERATED FROM PYTHON SOURCE LINES 141-142
Set camera for better visualization
-.. GENERATED FROM PYTHON SOURCE LINES 143-154
+.. GENERATED FROM PYTHON SOURCE LINES 142-153
.. code-block:: Python
@@ -228,7 +227,7 @@ Set camera for better visualization
if interactive:
show_manager.start()
- window.record(show_manager.scene, size=current_size, out_path="viz_slider.png")
+ fury.window.record(show_manager.scene, size=current_size, out_path="viz_slider.png")
.. _sphx_glr_download_auto_examples_07_ui_viz_ui_slider.py:
diff --git a/dev/_sources/auto_examples/10_animation/viz_hierarchical_animation.rst.txt b/dev/_sources/auto_examples/10_animation/viz_hierarchical_animation.rst.txt
index 6bab48c90..9ec339a1b 100644
--- a/dev/_sources/auto_examples/10_animation/viz_hierarchical_animation.rst.txt
+++ b/dev/_sources/auto_examples/10_animation/viz_hierarchical_animation.rst.txt
@@ -24,69 +24,68 @@ Keyframe hierarchical Animation
Creating hierarchical keyframes animation in fury
-.. GENERATED FROM PYTHON SOURCE LINES 8-21
+.. GENERATED FROM PYTHON SOURCE LINES 8-20
.. code-block:: Python
import numpy as np
- from fury import actor, window
- from fury.animation import Animation
+ import fury
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
showm.initialize()
-.. GENERATED FROM PYTHON SOURCE LINES 22-23
+.. GENERATED FROM PYTHON SOURCE LINES 21-22
Creating the road
-.. GENERATED FROM PYTHON SOURCE LINES 23-27
+.. GENERATED FROM PYTHON SOURCE LINES 22-26
.. code-block:: Python
- road = actor.box(
+ road = fury.actor.box(
np.array([[0, 0, 0]]), colors=np.array([[1, 1, 1]]), scales=np.array([[22, 0.1, 5]])
)
-.. GENERATED FROM PYTHON SOURCE LINES 28-29
+.. GENERATED FROM PYTHON SOURCE LINES 27-28
Constructing the car geometry
-.. GENERATED FROM PYTHON SOURCE LINES 29-36
+.. GENERATED FROM PYTHON SOURCE LINES 28-35
.. code-block:: Python
- body_actor = actor.box(
+ body_actor = fury.actor.box(
np.array([[0, 0.5, 0], [-0.2, 1, 0]]),
scales=((4, 1, 2), (2.5, 1.5, 1.8)),
colors=(0.6, 0.3, 0.1),
)
-.. GENERATED FROM PYTHON SOURCE LINES 37-38
+.. GENERATED FROM PYTHON SOURCE LINES 36-37
Adding the the car's body to an Animation to be able to animate it later.
-.. GENERATED FROM PYTHON SOURCE LINES 38-40
+.. GENERATED FROM PYTHON SOURCE LINES 37-39
.. code-block:: Python
- car_anim = Animation(body_actor)
+ car_anim = fury.animation.Animation(body_actor)
-.. GENERATED FROM PYTHON SOURCE LINES 41-42
+.. GENERATED FROM PYTHON SOURCE LINES 40-41
Creating the wheels of the car
-.. GENERATED FROM PYTHON SOURCE LINES 42-65
+.. GENERATED FROM PYTHON SOURCE LINES 41-64
.. code-block:: Python
@@ -101,7 +100,7 @@ Creating the wheels of the car
]
wheels = [
- actor.cylinder(
+ fury.actor.cylinder(
wheel_center,
wheel_direction,
(0.1, 0.7, 0.3),
@@ -114,17 +113,17 @@ Creating the wheels of the car
]
-.. GENERATED FROM PYTHON SOURCE LINES 66-68
+.. GENERATED FROM PYTHON SOURCE LINES 65-67
Animating each wheel and setting its position to the right position using a
single keyframe that will not change.
-.. GENERATED FROM PYTHON SOURCE LINES 68-76
+.. GENERATED FROM PYTHON SOURCE LINES 67-75
.. code-block:: Python
- wheels_animations = [Animation(wheel) for wheel in wheels]
+ wheels_animations = [fury.animation.Animation(wheel) for wheel in wheels]
for wheel_anim in wheels_animations:
wheel_anim.set_position(0.0, wheel_positions.pop())
@@ -132,51 +131,51 @@ single keyframe that will not change.
wheel_anim.set_rotation(1.0, [0, 0, 1, -1])
-.. GENERATED FROM PYTHON SOURCE LINES 77-78
+.. GENERATED FROM PYTHON SOURCE LINES 76-77
Creating a radar on top of the car
-.. GENERATED FROM PYTHON SOURCE LINES 80-81
+.. GENERATED FROM PYTHON SOURCE LINES 79-80
First we create the shaft holding and rotating the radar
-.. GENERATED FROM PYTHON SOURCE LINES 81-85
+.. GENERATED FROM PYTHON SOURCE LINES 80-84
.. code-block:: Python
- radar_shaft = actor.cylinder(
+ radar_shaft = fury.actor.cylinder(
np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), (0, 1, 0), heights=1
)
-.. GENERATED FROM PYTHON SOURCE LINES 86-87
+.. GENERATED FROM PYTHON SOURCE LINES 85-86
In order to animate the shaft actor we have to add it to an Animation
-.. GENERATED FROM PYTHON SOURCE LINES 87-89
+.. GENERATED FROM PYTHON SOURCE LINES 86-88
.. code-block:: Python
- radar_shaft_anim = Animation(radar_shaft)
+ radar_shaft_anim = fury.animation.Animation(radar_shaft)
-.. GENERATED FROM PYTHON SOURCE LINES 90-92
+.. GENERATED FROM PYTHON SOURCE LINES 89-91
Setting a single position keyframe will make sure the actor will be placed at
that position
-.. GENERATED FROM PYTHON SOURCE LINES 92-94
+.. GENERATED FROM PYTHON SOURCE LINES 91-93
.. code-block:: Python
radar_shaft_anim.set_position(0.0, [0, 2, 0])
-.. GENERATED FROM PYTHON SOURCE LINES 95-96
+.. GENERATED FROM PYTHON SOURCE LINES 94-95
Rotating the shaft around Y axis
-.. GENERATED FROM PYTHON SOURCE LINES 96-100
+.. GENERATED FROM PYTHON SOURCE LINES 95-99
.. code-block:: Python
@@ -185,33 +184,35 @@ Rotating the shaft around Y axis
radar_shaft_anim.set_rotation(2.0, [0, -250, 0])
-.. GENERATED FROM PYTHON SOURCE LINES 101-102
+.. GENERATED FROM PYTHON SOURCE LINES 100-101
Now we create the radar itself
-.. GENERATED FROM PYTHON SOURCE LINES 102-104
+.. GENERATED FROM PYTHON SOURCE LINES 101-105
.. code-block:: Python
- radar = actor.cone(np.array([[0, 0, 0]]), directions=(0, 0, 0), colors=(0.2, 0.2, 0.9))
+ radar = fury.actor.cone(
+ np.array([[0, 0, 0]]), directions=(0, 0, 0), colors=(0.2, 0.2, 0.9)
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 105-106
+.. GENERATED FROM PYTHON SOURCE LINES 106-107
Then add it to an animation in order to rotate it
-.. GENERATED FROM PYTHON SOURCE LINES 106-108
+.. GENERATED FROM PYTHON SOURCE LINES 107-109
.. code-block:: Python
- radar_animation = Animation(radar)
+ radar_animation = fury.animation.Animation(radar)
-.. GENERATED FROM PYTHON SOURCE LINES 109-110
+.. GENERATED FROM PYTHON SOURCE LINES 110-111
Set position and rotation as done above with the shaft.
-.. GENERATED FROM PYTHON SOURCE LINES 110-115
+.. GENERATED FROM PYTHON SOURCE LINES 111-116
.. code-block:: Python
@@ -221,37 +222,37 @@ Set position and rotation as done above with the shaft.
radar_animation.set_rotation(2.0, [0, 0, 0])
-.. GENERATED FROM PYTHON SOURCE LINES 116-119
+.. GENERATED FROM PYTHON SOURCE LINES 117-120
Now, we want the radar to rotate when the shaft rotates in hierarchical way.
To do that we must add the radar animation as a child animation of the shaft
animation as below:
-.. GENERATED FROM PYTHON SOURCE LINES 119-121
+.. GENERATED FROM PYTHON SOURCE LINES 120-122
.. code-block:: Python
radar_shaft_anim.add_child_animation(radar_animation)
-.. GENERATED FROM PYTHON SOURCE LINES 122-125
+.. GENERATED FROM PYTHON SOURCE LINES 123-126
After that we want everything to animate related to the car.
The wheels should always be attached to the car no matter where it moves.
we do that by adding them as child animations of the car's body animation
-.. GENERATED FROM PYTHON SOURCE LINES 125-127
+.. GENERATED FROM PYTHON SOURCE LINES 126-128
.. code-block:: Python
car_anim.add_child_animation([wheels_animations, radar_shaft_anim])
-.. GENERATED FROM PYTHON SOURCE LINES 128-129
+.. GENERATED FROM PYTHON SOURCE LINES 129-130
Moving the car
-.. GENERATED FROM PYTHON SOURCE LINES 129-132
+.. GENERATED FROM PYTHON SOURCE LINES 130-133
.. code-block:: Python
@@ -259,11 +260,11 @@ Moving the car
car_anim.set_position(6.0, [10, 0.5, 0])
-.. GENERATED FROM PYTHON SOURCE LINES 133-134
+.. GENERATED FROM PYTHON SOURCE LINES 134-135
Adding the car Animation to the show manager
-.. GENERATED FROM PYTHON SOURCE LINES 134-146
+.. GENERATED FROM PYTHON SOURCE LINES 135-147
.. code-block:: Python
@@ -276,7 +277,7 @@ Adding the car Animation to the show manager
if interactive:
showm.start()
- window.record(
+ fury.window.record(
scene, out_path="viz_keyframe_hierarchical_animation.png", size=(900, 768)
)
diff --git a/dev/_sources/auto_examples/10_animation/viz_introduction.rst.txt b/dev/_sources/auto_examples/10_animation/viz_introduction.rst.txt
index e870fdec0..dbe40545e 100644
--- a/dev/_sources/auto_examples/10_animation/viz_introduction.rst.txt
+++ b/dev/_sources/auto_examples/10_animation/viz_introduction.rst.txt
@@ -76,24 +76,23 @@ will be interpolated.
For this tutorial, we are going to use the FURY animation module to translate
FURY sphere actor.
-.. GENERATED FROM PYTHON SOURCE LINES 57-69
+.. GENERATED FROM PYTHON SOURCE LINES 57-68
.. code-block:: Python
import numpy as np
- from fury import actor, window
- from fury.animation import Animation
+ import fury
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(scene, size=(900, 768))
+ showm = fury.window.ShowManager(scene, size=(900, 768))
showm.initialize()
-.. GENERATED FROM PYTHON SOURCE LINES 70-76
+.. GENERATED FROM PYTHON SOURCE LINES 69-75
Translating a sphere
====================
@@ -102,43 +101,43 @@ This is a quick demo showing how to translate a sphere from (0, 0, 0) to
(1, 1, 1).
First, we create an ``Animation``. See ``viz_interpolators.py`` tutorial
-.. GENERATED FROM PYTHON SOURCE LINES 76-78
+.. GENERATED FROM PYTHON SOURCE LINES 75-77
.. code-block:: Python
- animation = Animation()
+ animation = fury.animation.Animation()
-.. GENERATED FROM PYTHON SOURCE LINES 79-80
+.. GENERATED FROM PYTHON SOURCE LINES 78-79
We also create the FURY sphere actor that will be animated.
-.. GENERATED FROM PYTHON SOURCE LINES 80-82
+.. GENERATED FROM PYTHON SOURCE LINES 79-81
.. code-block:: Python
- sphere = actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))
+ sphere = fury.actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))
-.. GENERATED FROM PYTHON SOURCE LINES 83-84
+.. GENERATED FROM PYTHON SOURCE LINES 82-83
Then lets add the sphere actor to the ``Animation``
-.. GENERATED FROM PYTHON SOURCE LINES 84-86
+.. GENERATED FROM PYTHON SOURCE LINES 83-85
.. code-block:: Python
animation.add_actor(sphere)
-.. GENERATED FROM PYTHON SOURCE LINES 87-91
+.. GENERATED FROM PYTHON SOURCE LINES 86-90
Then, we set our position keyframes at different timestamps
Here we want the sphere's position at the beginning to be [0, 0, 0]. And then
at time equals 3 seconds to be at [1, 1, 0] then finally at the end
(time equals 6) to return to the initial position which is [0, 0, 0] again.
-.. GENERATED FROM PYTHON SOURCE LINES 91-96
+.. GENERATED FROM PYTHON SOURCE LINES 90-95
.. code-block:: Python
@@ -148,11 +147,11 @@ at time equals 3 seconds to be at [1, 1, 0] then finally at the end
animation.set_position(6.0, [-1, -1, 0])
-.. GENERATED FROM PYTHON SOURCE LINES 97-98
+.. GENERATED FROM PYTHON SOURCE LINES 96-97
The ``Animation`` must be added to the ``ShowManager`` as follows:
-.. GENERATED FROM PYTHON SOURCE LINES 98-101
+.. GENERATED FROM PYTHON SOURCE LINES 97-100
.. code-block:: Python
@@ -160,17 +159,17 @@ The ``Animation`` must be added to the ``ShowManager`` as follows:
scene.camera().SetPosition(0, 0, 10)
-.. GENERATED FROM PYTHON SOURCE LINES 102-104
+.. GENERATED FROM PYTHON SOURCE LINES 101-103
Animation can be added to the scene instead of the ``ShowManager`` but, the
animation will need to be updated and then render the scene manually.
-.. GENERATED FROM PYTHON SOURCE LINES 107-109
+.. GENERATED FROM PYTHON SOURCE LINES 106-108
No need to add the sphere actor to scene, since it's now a part of the
``Animation``.
-.. GENERATED FROM PYTHON SOURCE LINES 109-118
+.. GENERATED FROM PYTHON SOURCE LINES 108-117
.. code-block:: Python
@@ -180,7 +179,7 @@ No need to add the sphere actor to scene, since it's now a part of the
if interactive:
showm.start()
- window.record(
+ fury.window.record(
scene, out_path="viz_keyframe_animation_introduction.png", size=(900, 768)
)
diff --git a/dev/_sources/auto_examples/10_animation/viz_robot_arm_animation.rst.txt b/dev/_sources/auto_examples/10_animation/viz_robot_arm_animation.rst.txt
index 3079f1b7a..5bdc8a0e1 100644
--- a/dev/_sources/auto_examples/10_animation/viz_robot_arm_animation.rst.txt
+++ b/dev/_sources/auto_examples/10_animation/viz_robot_arm_animation.rst.txt
@@ -24,45 +24,47 @@ Arm Robot Animation
Tutorial on making a robot arm animation in FURY.
-.. GENERATED FROM PYTHON SOURCE LINES 8-23
+.. GENERATED FROM PYTHON SOURCE LINES 8-21
.. code-block:: Python
import numpy as np
- from fury import actor, window
- from fury.animation import Animation, Timeline
- from fury.utils import set_actor_origin
+ import fury
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
showm.initialize()
-.. GENERATED FROM PYTHON SOURCE LINES 24-25
+.. GENERATED FROM PYTHON SOURCE LINES 22-23
Creating robot arm components
-.. GENERATED FROM PYTHON SOURCE LINES 25-43
+.. GENERATED FROM PYTHON SOURCE LINES 23-45
.. code-block:: Python
- base = actor.cylinder(
+ base = fury.actor.cylinder(
np.array([[0, 0, 0]]), np.array([[0, 1, 0]]), colors=(0, 1, 0), radius=1
)
- main_arm = actor.box(np.array([[0, 0, 0]]), colors=(1, 0.5, 0), scales=(12, 1, 1))
+ main_arm = fury.actor.box(np.array([[0, 0, 0]]), colors=(1, 0.5, 0), scales=(12, 1, 1))
- sub_arm = actor.box(np.array([[0, 0, 0]]), colors=(0, 0.5, 0.8), scales=(8, 0.7, 0.7))
- joint_1 = actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]), radii=1.2)
- joint_2 = actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]))
+ sub_arm = fury.actor.box(
+ np.array([[0, 0, 0]]), colors=(0, 0.5, 0.8), scales=(8, 0.7, 0.7)
+ )
+ joint_1 = fury.actor.sphere(
+ np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]), radii=1.2
+ )
+ joint_2 = fury.actor.sphere(np.array([[0, 0, 0]]), colors=np.array([1, 0, 1]))
- end = actor.cone(
+ end = fury.actor.cone(
np.array([[0, 0, 0]]),
np.array([[1, 0, 0]]),
np.array([[1, 0, 0]]),
@@ -71,48 +73,48 @@ Creating robot arm components
)
-.. GENERATED FROM PYTHON SOURCE LINES 44-45
+.. GENERATED FROM PYTHON SOURCE LINES 46-47
Setting the center of both shafts to the beginning.
-.. GENERATED FROM PYTHON SOURCE LINES 45-48
+.. GENERATED FROM PYTHON SOURCE LINES 47-50
.. code-block:: Python
- set_actor_origin(main_arm, np.array([-6, 0, 0]))
- set_actor_origin(sub_arm, np.array([-4, 0, 0]))
+ fury.utils.set_actor_origin(main_arm, np.array([-6, 0, 0]))
+ fury.utils.set_actor_origin(sub_arm, np.array([-4, 0, 0]))
-.. GENERATED FROM PYTHON SOURCE LINES 49-50
+.. GENERATED FROM PYTHON SOURCE LINES 51-52
Creating a timeline
-.. GENERATED FROM PYTHON SOURCE LINES 50-52
+.. GENERATED FROM PYTHON SOURCE LINES 52-54
.. code-block:: Python
- timeline = Timeline(playback_panel=True)
+ timeline = fury.animation.Timeline(playback_panel=True)
-.. GENERATED FROM PYTHON SOURCE LINES 53-54
+.. GENERATED FROM PYTHON SOURCE LINES 55-56
Creating animations
-.. GENERATED FROM PYTHON SOURCE LINES 54-59
+.. GENERATED FROM PYTHON SOURCE LINES 56-61
.. code-block:: Python
- main_arm_animation = Animation([main_arm, joint_1], length=2 * np.pi)
- child_arm_animation = Animation([sub_arm, joint_2])
- drill_animation = Animation(end)
+ main_arm_animation = fury.animation.Animation([main_arm, joint_1], length=2 * np.pi)
+ child_arm_animation = fury.animation.Animation([sub_arm, joint_2])
+ drill_animation = fury.animation.Animation(end)
-.. GENERATED FROM PYTHON SOURCE LINES 60-61
+.. GENERATED FROM PYTHON SOURCE LINES 62-63
Adding other Animations in hierarchical order
-.. GENERATED FROM PYTHON SOURCE LINES 61-65
+.. GENERATED FROM PYTHON SOURCE LINES 63-67
.. code-block:: Python
@@ -121,11 +123,11 @@ Adding other Animations in hierarchical order
-.. GENERATED FROM PYTHON SOURCE LINES 66-67
+.. GENERATED FROM PYTHON SOURCE LINES 68-69
Creating Arm joints time dependent animation functions.
-.. GENERATED FROM PYTHON SOURCE LINES 67-81
+.. GENERATED FROM PYTHON SOURCE LINES 69-83
.. code-block:: Python
@@ -144,46 +146,46 @@ Creating Arm joints time dependent animation functions.
-.. GENERATED FROM PYTHON SOURCE LINES 82-84
+.. GENERATED FROM PYTHON SOURCE LINES 84-86
Setting timelines (joints) relative position
1- Placing the main arm on the cube static base.
-.. GENERATED FROM PYTHON SOURCE LINES 84-86
+.. GENERATED FROM PYTHON SOURCE LINES 86-88
.. code-block:: Python
main_arm_animation.set_position(0, np.array([0, 1.3, 0]))
-.. GENERATED FROM PYTHON SOURCE LINES 87-89
+.. GENERATED FROM PYTHON SOURCE LINES 89-91
2- Translating the timeline containing the sub arm to the end of the first
arm.
-.. GENERATED FROM PYTHON SOURCE LINES 89-91
+.. GENERATED FROM PYTHON SOURCE LINES 91-93
.. code-block:: Python
child_arm_animation.set_position(0, np.array([12, 0, 0]))
-.. GENERATED FROM PYTHON SOURCE LINES 92-93
+.. GENERATED FROM PYTHON SOURCE LINES 94-95
3- Translating the timeline containing the drill to the end of the sub arm.
-.. GENERATED FROM PYTHON SOURCE LINES 93-95
+.. GENERATED FROM PYTHON SOURCE LINES 95-97
.. code-block:: Python
drill_animation.set_position(0, np.array([8, 0, 0]))
-.. GENERATED FROM PYTHON SOURCE LINES 96-97
+.. GENERATED FROM PYTHON SOURCE LINES 98-99
Setting rotation time-based evaluators
-.. GENERATED FROM PYTHON SOURCE LINES 97-101
+.. GENERATED FROM PYTHON SOURCE LINES 99-103
.. code-block:: Python
@@ -192,44 +194,44 @@ Setting rotation time-based evaluators
drill_animation.set_rotation_interpolator(rot_drill, is_evaluator=True)
-.. GENERATED FROM PYTHON SOURCE LINES 102-103
+.. GENERATED FROM PYTHON SOURCE LINES 104-105
Setting camera position to observe the robot arm.
-.. GENERATED FROM PYTHON SOURCE LINES 103-105
+.. GENERATED FROM PYTHON SOURCE LINES 105-107
.. code-block:: Python
scene.camera().SetPosition(0, 0, 90)
-.. GENERATED FROM PYTHON SOURCE LINES 106-107
+.. GENERATED FROM PYTHON SOURCE LINES 108-109
Adding the base actor to the scene
-.. GENERATED FROM PYTHON SOURCE LINES 107-109
+.. GENERATED FROM PYTHON SOURCE LINES 109-111
.. code-block:: Python
scene.add(base)
-.. GENERATED FROM PYTHON SOURCE LINES 110-111
+.. GENERATED FROM PYTHON SOURCE LINES 112-113
Adding the main parent animation to the Timeline.
-.. GENERATED FROM PYTHON SOURCE LINES 111-113
+.. GENERATED FROM PYTHON SOURCE LINES 113-115
.. code-block:: Python
timeline.add_animation(main_arm_animation)
-.. GENERATED FROM PYTHON SOURCE LINES 114-115
+.. GENERATED FROM PYTHON SOURCE LINES 116-117
Now we add the timeline to the ShowManager
-.. GENERATED FROM PYTHON SOURCE LINES 115-123
+.. GENERATED FROM PYTHON SOURCE LINES 117-125
.. code-block:: Python
@@ -240,7 +242,7 @@ Now we add the timeline to the ShowManager
if interactive:
showm.start()
- window.record(scene, out_path="viz_robot_arm.png", size=(900, 768))
+ fury.window.record(scene, out_path="viz_robot_arm.png", size=(900, 768))
.. _sphx_glr_download_auto_examples_10_animation_viz_robot_arm_animation.py:
diff --git a/dev/_sources/auto_examples/10_animation/viz_spline_interpolator.rst.txt b/dev/_sources/auto_examples/10_animation/viz_spline_interpolator.rst.txt
index aaa6af963..31b586046 100644
--- a/dev/_sources/auto_examples/10_animation/viz_spline_interpolator.rst.txt
+++ b/dev/_sources/auto_examples/10_animation/viz_spline_interpolator.rst.txt
@@ -24,31 +24,29 @@ Keyframes Spline Interpolator
Tutorial on making keyframe-based animation in FURY using Spline interpolators.
-.. GENERATED FROM PYTHON SOURCE LINES 8-22
+.. GENERATED FROM PYTHON SOURCE LINES 8-20
.. code-block:: Python
import numpy as np
- from fury import actor, window
- from fury.animation import Animation, Timeline
- from fury.animation.interpolator import spline_interpolator
+ import fury
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
-.. GENERATED FROM PYTHON SOURCE LINES 23-25
+.. GENERATED FROM PYTHON SOURCE LINES 21-23
Position keyframes as a dict object containing timestamps as keys and
positions as values.
-.. GENERATED FROM PYTHON SOURCE LINES 25-34
+.. GENERATED FROM PYTHON SOURCE LINES 23-32
.. code-block:: Python
@@ -62,110 +60,110 @@ positions as values.
}
-.. GENERATED FROM PYTHON SOURCE LINES 35-36
+.. GENERATED FROM PYTHON SOURCE LINES 33-34
creating FURY dots to visualize the position values.
-.. GENERATED FROM PYTHON SOURCE LINES 36-38
+.. GENERATED FROM PYTHON SOURCE LINES 34-36
.. code-block:: Python
- pos_dots = actor.dot(np.array(list(position_keyframes.values())))
+ pos_dots = fury.actor.dot(np.array(list(position_keyframes.values())))
-.. GENERATED FROM PYTHON SOURCE LINES 39-41
+.. GENERATED FROM PYTHON SOURCE LINES 37-39
creating two timelines (one uses linear and the other uses' spline
interpolator), each timeline controls a sphere actor
-.. GENERATED FROM PYTHON SOURCE LINES 41-49
+.. GENERATED FROM PYTHON SOURCE LINES 39-47
.. code-block:: Python
- sphere_linear = actor.sphere(np.array([[0, 0, 0]]), (1, 0.5, 0.2), 0.5)
+ sphere_linear = fury.actor.sphere(np.array([[0, 0, 0]]), (1, 0.5, 0.2), 0.5)
- linear_anim = Animation()
+ linear_anim = fury.animation.Animation()
linear_anim.add_actor(sphere_linear)
linear_anim.set_position_keyframes(position_keyframes)
-.. GENERATED FROM PYTHON SOURCE LINES 50-52
+.. GENERATED FROM PYTHON SOURCE LINES 48-50
Note: linear_interpolator is used by default. So, no need to set it for this
first animation that we need to linearly interpolate positional animation.
-.. GENERATED FROM PYTHON SOURCE LINES 54-56
+.. GENERATED FROM PYTHON SOURCE LINES 52-54
creating a second timeline that translates another larger sphere actor using
spline interpolator.
-.. GENERATED FROM PYTHON SOURCE LINES 56-60
+.. GENERATED FROM PYTHON SOURCE LINES 54-58
.. code-block:: Python
- sphere_spline = actor.sphere(np.array([[0, 0, 0]]), (0.3, 0.9, 0.6), 1)
- spline_anim = Animation(sphere_spline)
+ sphere_spline = fury.actor.sphere(np.array([[0, 0, 0]]), (0.3, 0.9, 0.6), 1)
+ spline_anim = fury.animation.Animation(sphere_spline)
spline_anim.set_position_keyframes(position_keyframes)
-.. GENERATED FROM PYTHON SOURCE LINES 61-62
+.. GENERATED FROM PYTHON SOURCE LINES 59-60
Setting 5th degree spline interpolator for position keyframes.
-.. GENERATED FROM PYTHON SOURCE LINES 62-64
+.. GENERATED FROM PYTHON SOURCE LINES 60-62
.. code-block:: Python
- spline_anim.set_position_interpolator(spline_interpolator, degree=5)
+ spline_anim.set_position_interpolator(fury.animation.spline_interpolator, degree=5)
-.. GENERATED FROM PYTHON SOURCE LINES 65-69
+.. GENERATED FROM PYTHON SOURCE LINES 63-67
Wrapping animations up!
=============================================================================
Adding everything to a ``Timeline`` to control the two timelines.
-.. GENERATED FROM PYTHON SOURCE LINES 71-72
+.. GENERATED FROM PYTHON SOURCE LINES 69-70
First we create a timeline with a playback panel:
-.. GENERATED FROM PYTHON SOURCE LINES 72-74
+.. GENERATED FROM PYTHON SOURCE LINES 70-72
.. code-block:: Python
- timeline = Timeline(playback_panel=True)
+ timeline = fury.animation.Timeline(playback_panel=True)
-.. GENERATED FROM PYTHON SOURCE LINES 75-76
+.. GENERATED FROM PYTHON SOURCE LINES 73-74
Add visualization dots actor to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 76-78
+.. GENERATED FROM PYTHON SOURCE LINES 74-76
.. code-block:: Python
scene.add(pos_dots)
-.. GENERATED FROM PYTHON SOURCE LINES 79-80
+.. GENERATED FROM PYTHON SOURCE LINES 77-78
Adding the animations to the timeline (so that it controls their playback).
-.. GENERATED FROM PYTHON SOURCE LINES 80-82
+.. GENERATED FROM PYTHON SOURCE LINES 78-80
.. code-block:: Python
timeline.add_animation([linear_anim, spline_anim])
-.. GENERATED FROM PYTHON SOURCE LINES 83-84
+.. GENERATED FROM PYTHON SOURCE LINES 81-82
Adding the timeline to the show manager.
-.. GENERATED FROM PYTHON SOURCE LINES 84-87
+.. GENERATED FROM PYTHON SOURCE LINES 82-85
.. code-block:: Python
@@ -173,12 +171,12 @@ Adding the timeline to the show manager.
-.. GENERATED FROM PYTHON SOURCE LINES 88-90
+.. GENERATED FROM PYTHON SOURCE LINES 86-88
Now that these two animations are added to timeline, if the timeline
is played, paused, ..., all these changes will reflect on the animations.
-.. GENERATED FROM PYTHON SOURCE LINES 90-98
+.. GENERATED FROM PYTHON SOURCE LINES 88-96
.. code-block:: Python
@@ -189,7 +187,7 @@ is played, paused, ..., all these changes will reflect on the animations.
if interactive:
showm.start()
- window.record(scene, out_path="viz_keyframe_animation_spline.png", size=(900, 768))
+ fury.window.record(scene, out_path="viz_keyframe_animation_spline.png", size=(900, 768))
.. _sphx_glr_download_auto_examples_10_animation_viz_spline_interpolator.py:
diff --git a/dev/_sources/auto_examples/10_animation/viz_timeline.rst.txt b/dev/_sources/auto_examples/10_animation/viz_timeline.rst.txt
index 7ac047a94..4b2728ef8 100644
--- a/dev/_sources/auto_examples/10_animation/viz_timeline.rst.txt
+++ b/dev/_sources/auto_examples/10_animation/viz_timeline.rst.txt
@@ -35,32 +35,31 @@ What is ``Timeline``?
``Timeline`` has playback methods such as ``play``, ``pause``, ``stop``, ...
which can be used to control the animation.
-.. GENERATED FROM PYTHON SOURCE LINES 18-24
+.. GENERATED FROM PYTHON SOURCE LINES 18-23
.. code-block:: Python
import numpy as np
- from fury import actor, window
- from fury.animation import Animation, Timeline
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 25-26
+.. GENERATED FROM PYTHON SOURCE LINES 24-25
We create our ``Scene`` and ``ShowManager`` as usual.
-.. GENERATED FROM PYTHON SOURCE LINES 26-31
+.. GENERATED FROM PYTHON SOURCE LINES 25-30
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(scene, size=(900, 768))
+ showm = fury.window.ShowManager(scene, size=(900, 768))
showm.initialize()
-.. GENERATED FROM PYTHON SOURCE LINES 32-37
+.. GENERATED FROM PYTHON SOURCE LINES 31-36
Creating a ``Timeline``
=======================
@@ -68,34 +67,34 @@ Creating a ``Timeline``
FURY ``Timeline`` has the option to attaches a very useful panel for
controlling the animation by setting ``playback_panel=True``.
-.. GENERATED FROM PYTHON SOURCE LINES 39-40
+.. GENERATED FROM PYTHON SOURCE LINES 38-39
Creating a ``Timeline`` with a PlaybackPanel.
-.. GENERATED FROM PYTHON SOURCE LINES 40-42
+.. GENERATED FROM PYTHON SOURCE LINES 39-41
.. code-block:: Python
- timeline = Timeline(playback_panel=True)
+ timeline = fury.animation.Timeline(playback_panel=True)
-.. GENERATED FROM PYTHON SOURCE LINES 43-44
+.. GENERATED FROM PYTHON SOURCE LINES 42-43
Creating a Fury Animation as usual
-.. GENERATED FROM PYTHON SOURCE LINES 44-51
+.. GENERATED FROM PYTHON SOURCE LINES 43-50
.. code-block:: Python
- anim = Animation()
- sphere = actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))
+ anim = fury.animation.Animation()
+ sphere = fury.actor.sphere(np.zeros([1, 3]), np.ones([1, 3]))
anim.add_actor(sphere)
# Now that the actor is add to the ``Animation``, setting keyframes to the
# Animation will animate the actor accordingly.
-.. GENERATED FROM PYTHON SOURCE LINES 52-60
+.. GENERATED FROM PYTHON SOURCE LINES 51-59
Setting Keyframes
=================
@@ -106,21 +105,21 @@ There are multiple ways to set keyframes:
where is the name of the property to be set. I.e. setting position
to (1, 2, 3) at time 0.0 would be as following:
-.. GENERATED FROM PYTHON SOURCE LINES 60-62
+.. GENERATED FROM PYTHON SOURCE LINES 59-61
.. code-block:: Python
anim.set_position(0.0, np.array([1, 2, 3]))
-.. GENERATED FROM PYTHON SOURCE LINES 63-67
+.. GENERATED FROM PYTHON SOURCE LINES 62-66
Supported properties are: **position, rotation, scale, color, and opacity**.
2- To set multiple keyframes at once, you may use
``animation.set__keyframes(keyframes)``.
-.. GENERATED FROM PYTHON SOURCE LINES 67-71
+.. GENERATED FROM PYTHON SOURCE LINES 66-70
.. code-block:: Python
@@ -129,28 +128,28 @@ Supported properties are: **position, rotation, scale, color, and opacity**.
anim.set_position_keyframes(keyframes)
-.. GENERATED FROM PYTHON SOURCE LINES 72-73
+.. GENERATED FROM PYTHON SOURCE LINES 71-72
That's it! Now we are done setting keyframes.
-.. GENERATED FROM PYTHON SOURCE LINES 75-77
+.. GENERATED FROM PYTHON SOURCE LINES 74-76
In order to control this animation by the timeline we created earlier, this
animation must be added to the timeline.
-.. GENERATED FROM PYTHON SOURCE LINES 77-79
+.. GENERATED FROM PYTHON SOURCE LINES 76-78
.. code-block:: Python
timeline.add_animation(anim)
-.. GENERATED FROM PYTHON SOURCE LINES 80-82
+.. GENERATED FROM PYTHON SOURCE LINES 79-81
Now we add only the ``Timeline`` to the ``ShowManager`` the same way we add
``Animation`` to the ``ShowManager``.
-.. GENERATED FROM PYTHON SOURCE LINES 82-92
+.. GENERATED FROM PYTHON SOURCE LINES 81-93
.. code-block:: Python
@@ -163,7 +162,9 @@ Now we add only the ``Timeline`` to the ``ShowManager`` the same way we add
if interactive:
showm.start()
- window.record(scene, out_path="viz_keyframe_animation_timeline.png", size=(900, 768))
+ fury.window.record(
+ scene, out_path="viz_keyframe_animation_timeline.png", size=(900, 768)
+ )
.. _sphx_glr_download_auto_examples_10_animation_viz_timeline.py:
diff --git a/dev/_sources/auto_examples/10_animation/viz_using_time_equations.rst.txt b/dev/_sources/auto_examples/10_animation/viz_using_time_equations.rst.txt
index b7ff4a87e..cf58c6935 100644
--- a/dev/_sources/auto_examples/10_animation/viz_using_time_equations.rst.txt
+++ b/dev/_sources/auto_examples/10_animation/viz_using_time_equations.rst.txt
@@ -24,43 +24,42 @@ Keyframe animation
Tutorial on making keyframe-based animation in FURY using custom functions.
-.. GENERATED FROM PYTHON SOURCE LINES 8-23
+.. GENERATED FROM PYTHON SOURCE LINES 8-22
.. code-block:: Python
import numpy as np
- from fury import actor, window
- from fury.animation import Animation
+ import fury
- scene = window.Scene()
+ scene = fury.window.Scene()
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
- cube = actor.cube(np.array([[0, 0, 0]]), (0, 0, 0), (1, 0, 1), scales=6)
+ cube = fury.actor.cube(np.array([[0, 0, 0]]), (0, 0, 0), (1, 0, 1), scales=6)
-.. GENERATED FROM PYTHON SOURCE LINES 24-25
+.. GENERATED FROM PYTHON SOURCE LINES 23-24
Creating an ``Animation`` to animate the actor and show its motion path.
-.. GENERATED FROM PYTHON SOURCE LINES 25-27
+.. GENERATED FROM PYTHON SOURCE LINES 24-26
.. code-block:: Python
- anim = Animation(length=2 * np.pi, loop=True, motion_path_res=200)
+ anim = fury.animation.Animation(length=2 * np.pi, loop=True, motion_path_res=200)
-.. GENERATED FROM PYTHON SOURCE LINES 28-30
+.. GENERATED FROM PYTHON SOURCE LINES 27-29
Adding the sphere actor to the timeline
This could've been done during initialization.
-.. GENERATED FROM PYTHON SOURCE LINES 30-33
+.. GENERATED FROM PYTHON SOURCE LINES 29-32
.. code-block:: Python
@@ -68,11 +67,11 @@ This could've been done during initialization.
-.. GENERATED FROM PYTHON SOURCE LINES 34-35
+.. GENERATED FROM PYTHON SOURCE LINES 33-34
Creating time dependent functions.
-.. GENERATED FROM PYTHON SOURCE LINES 35-57
+.. GENERATED FROM PYTHON SOURCE LINES 34-56
.. code-block:: Python
@@ -99,13 +98,13 @@ Creating time dependent functions.
-.. GENERATED FROM PYTHON SOURCE LINES 58-61
+.. GENERATED FROM PYTHON SOURCE LINES 57-60
Setting evaluator functions is the same as setting interpolators, but with
one extra argument: `is_evaluator=True` since these functions does not need
keyframes as input.
-.. GENERATED FROM PYTHON SOURCE LINES 61-66
+.. GENERATED FROM PYTHON SOURCE LINES 60-65
.. code-block:: Python
@@ -115,22 +114,22 @@ keyframes as input.
anim.set_interpolator("scale", scale_eval, is_evaluator=True)
-.. GENERATED FROM PYTHON SOURCE LINES 67-68
+.. GENERATED FROM PYTHON SOURCE LINES 66-67
changing camera position to observe the animation better.
-.. GENERATED FROM PYTHON SOURCE LINES 68-70
+.. GENERATED FROM PYTHON SOURCE LINES 67-69
.. code-block:: Python
scene.set_camera(position=(0, 0, 90))
-.. GENERATED FROM PYTHON SOURCE LINES 71-72
+.. GENERATED FROM PYTHON SOURCE LINES 70-71
Adding the animation to the show manager.
-.. GENERATED FROM PYTHON SOURCE LINES 72-81
+.. GENERATED FROM PYTHON SOURCE LINES 71-82
.. code-block:: Python
@@ -142,7 +141,9 @@ Adding the animation to the show manager.
if interactive:
showm.start()
- window.record(scene, out_path="viz_keyframe_animation_evaluators.png", size=(900, 768))
+ fury.window.record(
+ scene, out_path="viz_keyframe_animation_evaluators.png", size=(900, 768)
+ )
.. _sphx_glr_download_auto_examples_10_animation_viz_using_time_equations.py:
diff --git a/dev/_sources/auto_examples/13_shaders/index.rst.txt b/dev/_sources/auto_examples/13_shaders/index.rst.txt
index 580f69172..e48c182ae 100644
--- a/dev/_sources/auto_examples/13_shaders/index.rst.txt
+++ b/dev/_sources/auto_examples/13_shaders/index.rst.txt
@@ -54,7 +54,7 @@ These tutorials show:
.. raw:: html
-
+
.. only:: html
diff --git a/dev/_sources/auto_examples/13_shaders/viz_pbr_spheres.rst.txt b/dev/_sources/auto_examples/13_shaders/viz_pbr_spheres.rst.txt
index c75c37967..ccfb82352 100644
--- a/dev/_sources/auto_examples/13_shaders/viz_pbr_spheres.rst.txt
+++ b/dev/_sources/auto_examples/13_shaders/viz_pbr_spheres.rst.txt
@@ -33,40 +33,35 @@ using the PBR material.
Let's start by importing the necessary modules:
-.. GENERATED FROM PYTHON SOURCE LINES 17-27
+.. GENERATED FROM PYTHON SOURCE LINES 17-22
.. code-block:: Python
import numpy as np
- from fury import actor, material, window
- from fury.utils import (
- normals_from_actor,
- tangents_from_direction_of_anisotropy,
- tangents_to_actor,
- )
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 28-29
+.. GENERATED FROM PYTHON SOURCE LINES 23-24
Now set up a new scene.
-.. GENERATED FROM PYTHON SOURCE LINES 29-33
+.. GENERATED FROM PYTHON SOURCE LINES 24-28
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background((0.9, 0.9, 0.9))
-.. GENERATED FROM PYTHON SOURCE LINES 34-36
+.. GENERATED FROM PYTHON SOURCE LINES 29-31
Let's define the parameters we are going to showcase in this tutorial.
These subset of parameters have their values constrained in the 0 to 1 range.
-.. GENERATED FROM PYTHON SOURCE LINES 36-49
+.. GENERATED FROM PYTHON SOURCE LINES 31-44
.. code-block:: Python
@@ -84,13 +79,13 @@ These subset of parameters have their values constrained in the 0 to 1 range.
]
-.. GENERATED FROM PYTHON SOURCE LINES 50-53
+.. GENERATED FROM PYTHON SOURCE LINES 45-48
Now we can start to add our actors to the scene and see how different values
of the parameters produce interesting effects. For the purpose of this
tutorial, we will see the effect of 11 different values of each parameter.
-.. GENERATED FROM PYTHON SOURCE LINES 53-71
+.. GENERATED FROM PYTHON SOURCE LINES 48-68
.. code-block:: Python
@@ -103,22 +98,24 @@ tutorial, we will see the effect of 11 different values of each parameter.
center = [[0, -5 * i, 0]]
for j in range(num_values):
center[0][0] = -25 + 5 * j
- sphere = actor.sphere(center, color, radii=2, theta=32, phi=32)
- normals = normals_from_actor(sphere)
- tangents = tangents_from_direction_of_anisotropy(normals, (0, 1, 0.5))
- tangents_to_actor(sphere, tangents)
+ sphere = fury.actor.sphere(center, color, radii=2, theta=32, phi=32)
+ normals = fury.utils.normals_from_actor(sphere)
+ tangents = fury.utils.tangents_from_direction_of_anisotropy(
+ normals, (0, 1, 0.5)
+ )
+ fury.utils.tangents_to_actor(sphere, tangents)
keys = list(params)
params[keys[0]] = np.round(0.1 * j, decimals=1)
- material.manifest_pbr(sphere, **params)
+ fury.material.manifest_pbr(sphere, **params)
scene.add(sphere)
-.. GENERATED FROM PYTHON SOURCE LINES 72-74
+.. GENERATED FROM PYTHON SOURCE LINES 69-71
For interpretability purposes we will add some labels to guide us through our
visualization.
-.. GENERATED FROM PYTHON SOURCE LINES 74-99
+.. GENERATED FROM PYTHON SOURCE LINES 71-98
.. code-block:: Python
@@ -134,12 +131,14 @@ visualization.
for i, name in enumerate(labels):
pos = [-40, -5 * i, 0]
- label = actor.vector_text(name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0))
+ label = fury.actor.vector_text(
+ name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)
+ )
scene.add(label)
for j in range(num_values):
pos = [-26 + 5 * j, 3, 0]
- label = actor.vector_text(
+ label = fury.actor.vector_text(
str(np.round(j * 0.1, decimals=1)),
pos=pos,
scale=(0.8, 0.8, 0.8),
@@ -148,14 +147,14 @@ visualization.
scene.add(label)
-.. GENERATED FROM PYTHON SOURCE LINES 100-104
+.. GENERATED FROM PYTHON SOURCE LINES 99-103
Some parameters of this material have their values constrained to be between
1 and 2.3. These parameters are the Base Index of Refraction (IOR) and the
Clear coat Index of Refraction (IOR). Therefore, we will interpolate some
values within this range and see how they affect the rendering.
-.. GENERATED FROM PYTHON SOURCE LINES 104-132
+.. GENERATED FROM PYTHON SOURCE LINES 103-131
.. code-block:: Python
@@ -181,18 +180,18 @@ values within this range and see how they affect the rendering.
center = [[0, -35 - (5 * i), 0]]
for j in range(num_values):
center[0][0] = -25 + 5 * j
- sphere = actor.sphere(center, color, radii=2, theta=32, phi=32)
+ sphere = fury.actor.sphere(center, color, radii=2, theta=32, phi=32)
keys = list(params)
params[keys[0]] = iors[j]
- material.manifest_pbr(sphere, **params)
+ fury.material.manifest_pbr(sphere, **params)
scene.add(sphere)
-.. GENERATED FROM PYTHON SOURCE LINES 133-134
+.. GENERATED FROM PYTHON SOURCE LINES 132-133
Let's add the respective labels to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 134-149
+.. GENERATED FROM PYTHON SOURCE LINES 133-150
.. code-block:: Python
@@ -201,31 +200,33 @@ Let's add the respective labels to the scene.
for i, name in enumerate(labels):
pos = [-40, -35 - (5 * i), 0]
- label = actor.vector_text(name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0))
+ label = fury.actor.vector_text(
+ name, pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)
+ )
scene.add(label)
for j in range(num_values):
pos = [-26 + 5 * j, -32, 0]
- label = actor.vector_text(
+ label = fury.actor.vector_text(
"{:.02f}".format(iors[j]), pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)
)
scene.add(label)
-.. GENERATED FROM PYTHON SOURCE LINES 150-151
+.. GENERATED FROM PYTHON SOURCE LINES 151-152
Finally, let's visualize our tutorial.
-.. GENERATED FROM PYTHON SOURCE LINES 151-157
+.. GENERATED FROM PYTHON SOURCE LINES 152-158
.. code-block:: Python
interactive = False
if interactive:
- window.show(scene)
+ fury.window.show(scene)
- window.record(scene, size=(600, 600), out_path="viz_pbr_spheres.png")
+ fury.window.record(scene, size=(600, 600), out_path="viz_pbr_spheres.png")
.. _sphx_glr_download_auto_examples_13_shaders_viz_pbr_spheres.py:
diff --git a/dev/_sources/auto_examples/13_shaders/viz_principled_spheres.rst.txt b/dev/_sources/auto_examples/13_shaders/viz_principled_spheres.rst.txt
index 8842b1922..c2f4cfa5e 100644
--- a/dev/_sources/auto_examples/13_shaders/viz_principled_spheres.rst.txt
+++ b/dev/_sources/auto_examples/13_shaders/viz_principled_spheres.rst.txt
@@ -44,7 +44,7 @@ Let's start by importing the necessary modules:
import numpy as np
- from fury import actor, material, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 27-28
@@ -56,7 +56,7 @@ Now set up a new scene.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background((0.9, 0.9, 0.9))
@@ -100,12 +100,12 @@ the parameters produce interesting effects.
center = np.array([[0, -5 * i, 0]])
for j in range(11):
center[0][0] = -25 + 5 * j
- sphere = actor.sphere(
+ sphere = fury.actor.sphere(
center, colors=material_params[i][0], radii=2, theta=32, phi=32
)
keys = list(material_params[i][1])
material_params[i][1][keys[0]] = np.round(0.1 * j, decimals=1)
- material.manifest_principled(sphere, **material_params[i][1])
+ fury.material.manifest_principled(sphere, **material_params[i][1])
scene.add(sphere)
@@ -133,14 +133,14 @@ Finally, let's add some labels to guide us through our visualization.
for i in range(10):
pos = [-40, -5 * i, 0]
- label = actor.vector_text(
+ label = fury.actor.vector_text(
labels[i], pos=pos, scale=(0.8, 0.8, 0.8), color=(0, 0, 0)
)
scene.add(label)
for j in range(11):
pos = [-26 + 5 * j, 5, 0]
- label = actor.vector_text(
+ label = fury.actor.vector_text(
str(np.round(j * 0.1, decimals=1)),
pos=pos,
scale=(0.8, 0.8, 0.8),
@@ -160,9 +160,9 @@ And visualize our demo.
interactive = False
if interactive:
- window.show(scene)
+ fury.window.show(scene)
- window.record(scene, size=(600, 600), out_path="viz_principled_spheres.png")
+ fury.window.record(scene, size=(600, 600), out_path="viz_principled_spheres.png")
.. _sphx_glr_download_auto_examples_13_shaders_viz_principled_spheres.py:
diff --git a/dev/_sources/auto_examples/13_shaders/viz_sdf_cylinder.rst.txt b/dev/_sources/auto_examples/13_shaders/viz_sdf_cylinder.rst.txt
index 795bf3ce8..922d1c292 100644
--- a/dev/_sources/auto_examples/13_shaders/viz_sdf_cylinder.rst.txt
+++ b/dev/_sources/auto_examples/13_shaders/viz_sdf_cylinder.rst.txt
@@ -33,7 +33,7 @@ implementation inside.
We start by importing the necessary modules:
-.. GENERATED FROM PYTHON SOURCE LINES 17-30
+.. GENERATED FROM PYTHON SOURCE LINES 17-24
.. code-block:: Python
@@ -42,16 +42,10 @@ We start by importing the necessary modules:
import numpy as np
- from fury import actor, window
- from fury.shaders import (
- attribute_to_actor,
- compose_shader,
- import_fury_shader,
- shader_to_actor,
- )
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 31-42
+.. GENERATED FROM PYTHON SOURCE LINES 25-36
Cylinder using polygons
=======================
@@ -65,7 +59,7 @@ rendering time to display the object.
Now we define some properties of our actors, use them to create a set of
cylinders, and add them to the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 42-85
+.. GENERATED FROM PYTHON SOURCE LINES 36-79
.. code-block:: Python
@@ -113,18 +107,18 @@ cylinders, and add them to the scene.
height = 1
-.. GENERATED FROM PYTHON SOURCE LINES 86-89
+.. GENERATED FROM PYTHON SOURCE LINES 80-83
In order to see how cylinders are made, we set different resolutions (number
of sides used to define the bases of the cylinder) to see how it changes the
surface of the primitive.
-.. GENERATED FROM PYTHON SOURCE LINES 89-118
+.. GENERATED FROM PYTHON SOURCE LINES 83-112
.. code-block:: Python
- cylinders_8 = actor.cylinder(
+ cylinders_8 = fury.actor.cylinder(
centers[:3],
dirs[:3],
colors[:3],
@@ -133,7 +127,7 @@ surface of the primitive.
capped=True,
resolution=8,
)
- cylinders_16 = actor.cylinder(
+ cylinders_16 = fury.actor.cylinder(
centers[3:6],
dirs[3:6],
colors[3:6],
@@ -142,7 +136,7 @@ surface of the primitive.
capped=True,
resolution=16,
)
- cylinders_32 = actor.cylinder(
+ cylinders_32 = fury.actor.cylinder(
centers[6:9],
dirs[6:9],
colors[6:9],
@@ -153,16 +147,16 @@ surface of the primitive.
)
-.. GENERATED FROM PYTHON SOURCE LINES 119-120
+.. GENERATED FROM PYTHON SOURCE LINES 113-114
Next, we set up a new scene to add and visualize the actors created.
-.. GENERATED FROM PYTHON SOURCE LINES 120-134
+.. GENERATED FROM PYTHON SOURCE LINES 114-128
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(cylinders_8)
scene.add(cylinders_16)
@@ -171,16 +165,16 @@ Next, we set up a new scene to add and visualize the actors created.
interactive = False
if interactive:
- window.show(scene)
+ fury.window.show(scene)
- window.record(scene, size=(600, 600), out_path="viz_poly_cylinder.png")
+ fury.window.record(scene, size=(600, 600), out_path="viz_poly_cylinder.png")
-.. GENERATED FROM PYTHON SOURCE LINES 135-136
+.. GENERATED FROM PYTHON SOURCE LINES 129-130
Visualize the surface geometry representation for the object.
-.. GENERATED FROM PYTHON SOURCE LINES 136-146
+.. GENERATED FROM PYTHON SOURCE LINES 130-140
.. code-block:: Python
@@ -190,17 +184,17 @@ Visualize the surface geometry representation for the object.
cylinders_32.GetProperty().SetRepresentationToWireframe()
if interactive:
- window.show(scene)
+ fury.window.show(scene)
- window.record(scene, size=(600, 600), out_path="viz_poly_cylinder_geom.png")
+ fury.window.record(scene, size=(600, 600), out_path="viz_poly_cylinder_geom.png")
-.. GENERATED FROM PYTHON SOURCE LINES 147-149
+.. GENERATED FROM PYTHON SOURCE LINES 141-143
Then we clean the scene to render the boxes we will use to render our
SDF-based actors.
-.. GENERATED FROM PYTHON SOURCE LINES 149-152
+.. GENERATED FROM PYTHON SOURCE LINES 143-146
.. code-block:: Python
@@ -208,7 +202,7 @@ SDF-based actors.
scene.clear()
-.. GENERATED FROM PYTHON SOURCE LINES 153-165
+.. GENERATED FROM PYTHON SOURCE LINES 147-159
Cylinder using SDF
==================
@@ -223,17 +217,17 @@ SDF, and because we don’t use polygonal meshes it is possible to define
perfectly smooth surfaces and allows a faster rendering in comparison to
polygon-based modeling (more details in [Hart1996]_).
-.. GENERATED FROM PYTHON SOURCE LINES 167-169
+.. GENERATED FROM PYTHON SOURCE LINES 161-163
Now we create cylinders using box actor and SDF implementation on shaders.
For this, we first create a box actor.
-.. GENERATED FROM PYTHON SOURCE LINES 169-177
+.. GENERATED FROM PYTHON SOURCE LINES 163-171
.. code-block:: Python
- box_actor = actor.box(
+ box_actor = fury.actor.box(
centers=centers,
directions=dirs,
colors=colors,
@@ -241,7 +235,7 @@ For this, we first create a box actor.
)
-.. GENERATED FROM PYTHON SOURCE LINES 178-184
+.. GENERATED FROM PYTHON SOURCE LINES 172-178
Now we use attribute_to_actor to link a NumPy array, with the centers and
directions data, with a vertex attribute. We do this to pass the data to
@@ -250,7 +244,7 @@ the vertex shader, with the corresponding attribute name.
We need to associate the data to each of the 8 vertices that make up the box
since we handle the processing of individual vertices in the vertex shader.
-.. GENERATED FROM PYTHON SOURCE LINES 184-195
+.. GENERATED FROM PYTHON SOURCE LINES 178-189
.. code-block:: Python
@@ -260,13 +254,13 @@ since we handle the processing of individual vertices in the vertex shader.
rep_radii = np.repeat(np.repeat(radius, 9), 8, axis=0)
rep_heights = np.repeat(np.repeat(height, 9), 8, axis=0)
- attribute_to_actor(box_actor, rep_centers, "center")
- attribute_to_actor(box_actor, rep_directions, "direction")
- attribute_to_actor(box_actor, rep_radii, "radius")
- attribute_to_actor(box_actor, rep_heights, "height")
+ fury.shaders.attribute_to_actor(box_actor, rep_centers, "center")
+ fury.shaders.attribute_to_actor(box_actor, rep_directions, "direction")
+ fury.shaders.attribute_to_actor(box_actor, rep_radii, "radius")
+ fury.shaders.attribute_to_actor(box_actor, rep_heights, "height")
-.. GENERATED FROM PYTHON SOURCE LINES 196-201
+.. GENERATED FROM PYTHON SOURCE LINES 190-195
Then we have the shader code implementation corresponding to vertex and
fragment shader. Here we are passing data to the fragment shader through
@@ -274,7 +268,7 @@ the vertex shader.
Vertex shaders perform basic processing of each individual vertex.
-.. GENERATED FROM PYTHON SOURCE LINES 201-223
+.. GENERATED FROM PYTHON SOURCE LINES 195-217
.. code-block:: Python
@@ -301,21 +295,21 @@ Vertex shaders perform basic processing of each individual vertex.
"""
-.. GENERATED FROM PYTHON SOURCE LINES 224-227
+.. GENERATED FROM PYTHON SOURCE LINES 218-221
Then we add the vertex shader code to the box_actor. We use shader_to_actor
to apply our implementation to the shader creation process, this function
joins our code to the shader template that FURY has by default.
-.. GENERATED FROM PYTHON SOURCE LINES 227-230
+.. GENERATED FROM PYTHON SOURCE LINES 221-224
.. code-block:: Python
- shader_to_actor(box_actor, "vertex", decl_code=vs_dec, impl_code=vs_impl)
+ fury.shaders.shader_to_actor(box_actor, "vertex", decl_code=vs_dec, impl_code=vs_impl)
-.. GENERATED FROM PYTHON SOURCE LINES 231-239
+.. GENERATED FROM PYTHON SOURCE LINES 225-233
Fragment shaders are used to define the colors of each pixel being processed,
the program runs on each of the pixels that the object occupies on the
@@ -326,7 +320,7 @@ lighting, and color in a scene. In this case, we are using vertex shader not
just to define the colors of the cylinders but to manipulate its position in
world space, rotation with respect to the box, and lighting of the scene.
-.. GENERATED FROM PYTHON SOURCE LINES 239-250
+.. GENERATED FROM PYTHON SOURCE LINES 233-244
.. code-block:: Python
@@ -342,39 +336,39 @@ world space, rotation with respect to the box, and lighting of the scene.
"""
-.. GENERATED FROM PYTHON SOURCE LINES 251-254
+.. GENERATED FROM PYTHON SOURCE LINES 245-248
We use this function to generate an appropriate rotation matrix which help us
to transform our position vectors in order to align the direction of
cylinder with respect to the box.
-.. GENERATED FROM PYTHON SOURCE LINES 254-259
+.. GENERATED FROM PYTHON SOURCE LINES 248-253
.. code-block:: Python
- vec_to_vec_rot_mat = import_fury_shader(
+ vec_to_vec_rot_mat = fury.shaders.import_fury_shader(
os.path.join("utils", "vec_to_vec_rot_mat.glsl")
)
-.. GENERATED FROM PYTHON SOURCE LINES 260-261
+.. GENERATED FROM PYTHON SOURCE LINES 254-255
We calculate the distance using the SDF function for the cylinder.
-.. GENERATED FROM PYTHON SOURCE LINES 261-264
+.. GENERATED FROM PYTHON SOURCE LINES 255-258
.. code-block:: Python
- sd_cylinder = import_fury_shader(os.path.join("sdf", "sd_cylinder.frag"))
+ sd_cylinder = fury.shaders.import_fury_shader(os.path.join("sdf", "sd_cylinder.frag"))
-.. GENERATED FROM PYTHON SOURCE LINES 265-266
+.. GENERATED FROM PYTHON SOURCE LINES 259-260
This is used on calculations for surface normals of the cylinder.
-.. GENERATED FROM PYTHON SOURCE LINES 266-283
+.. GENERATED FROM PYTHON SOURCE LINES 260-277
.. code-block:: Python
@@ -396,54 +390,58 @@ This is used on calculations for surface normals of the cylinder.
"""
-.. GENERATED FROM PYTHON SOURCE LINES 284-285
+.. GENERATED FROM PYTHON SOURCE LINES 278-279
We use central differences technique for computing surface normals.
-.. GENERATED FROM PYTHON SOURCE LINES 285-288
+.. GENERATED FROM PYTHON SOURCE LINES 279-284
.. code-block:: Python
- central_diffs_normal = import_fury_shader(os.path.join("sdf", "central_diffs.frag"))
+ central_diffs_normal = fury.shaders.import_fury_shader(
+ os.path.join("sdf", "central_diffs.frag")
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 289-290
+.. GENERATED FROM PYTHON SOURCE LINES 285-286
We use cast_ray for the implementation of Ray Marching.
-.. GENERATED FROM PYTHON SOURCE LINES 290-293
+.. GENERATED FROM PYTHON SOURCE LINES 286-291
.. code-block:: Python
- cast_ray = import_fury_shader(os.path.join("ray_marching", "cast_ray.frag"))
+ cast_ray = fury.shaders.import_fury_shader(
+ os.path.join("ray_marching", "cast_ray.frag")
+ )
-.. GENERATED FROM PYTHON SOURCE LINES 294-295
+.. GENERATED FROM PYTHON SOURCE LINES 292-293
For the illumination of the scene we use the Blinn-Phong model.
-.. GENERATED FROM PYTHON SOURCE LINES 295-300
+.. GENERATED FROM PYTHON SOURCE LINES 293-298
.. code-block:: Python
- blinn_phong_model = import_fury_shader(
+ blinn_phong_model = fury.shaders.import_fury_shader(
os.path.join("lighting", "blinn_phong_model.frag")
)
-.. GENERATED FROM PYTHON SOURCE LINES 301-302
+.. GENERATED FROM PYTHON SOURCE LINES 299-300
Now we use compose_shader to join our pieces of GLSL shader code.
-.. GENERATED FROM PYTHON SOURCE LINES 302-317
+.. GENERATED FROM PYTHON SOURCE LINES 300-315
.. code-block:: Python
- fs_dec = compose_shader(
+ fs_dec = fury.shaders.compose_shader(
[
fs_vars_dec,
vec_to_vec_rot_mat,
@@ -455,15 +453,15 @@ Now we use compose_shader to join our pieces of GLSL shader code.
]
)
- shader_to_actor(box_actor, "fragment", decl_code=fs_dec)
+ fury.shaders.shader_to_actor(box_actor, "fragment", decl_code=fs_dec)
-.. GENERATED FROM PYTHON SOURCE LINES 318-320
+.. GENERATED FROM PYTHON SOURCE LINES 316-318
Here we have the implementation of all the previous code with all the
necessary variables and functions to build the cylinders.
-.. GENERATED FROM PYTHON SOURCE LINES 320-355
+.. GENERATED FROM PYTHON SOURCE LINES 318-355
.. code-block:: Python
@@ -500,7 +498,9 @@ necessary variables and functions to build the cylinders.
}
"""
- shader_to_actor(box_actor, "fragment", impl_code=sdf_cylinder_frag_impl, block="light")
+ fury.shaders.shader_to_actor(
+ box_actor, "fragment", impl_code=sdf_cylinder_frag_impl, block="light"
+ )
.. GENERATED FROM PYTHON SOURCE LINES 356-357
@@ -515,9 +515,9 @@ Finally, we visualize the cylinders made using ray marching and SDFs.
scene.add(box_actor)
if interactive:
- window.show(scene)
+ fury.window.show(scene)
- window.record(scene, size=(600, 600), out_path="viz_sdf_cylinder.png")
+ fury.window.record(scene, size=(600, 600), out_path="viz_sdf_cylinder.png")
.. GENERATED FROM PYTHON SOURCE LINES 366-373
diff --git a/dev/_sources/auto_examples/13_shaders/viz_sdfactor.rst.txt b/dev/_sources/auto_examples/13_shaders/viz_sdfactor.rst.txt
index 6f9994db0..46c32f21f 100644
--- a/dev/_sources/auto_examples/13_shaders/viz_sdfactor.rst.txt
+++ b/dev/_sources/auto_examples/13_shaders/viz_sdfactor.rst.txt
@@ -39,7 +39,7 @@ shapes using shaders
import numpy as np
- from fury import actor, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 22-23
@@ -67,7 +67,7 @@ Create SDF Actor
.. code-block:: Python
- sdfactor = actor.sdf(
+ sdfactor = fury.actor.sdf(
centers=centers,
directions=dirs,
colors=colors,
@@ -85,7 +85,7 @@ Create a scene
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.background((1.0, 0.8, 0.8))
scene.add(sdfactor)
@@ -104,14 +104,14 @@ manager.
current_size = (1024, 720)
- showm = window.ShowManager(scene, size=current_size, title="Visualize SDF Actor")
+ showm = fury.window.ShowManager(scene, size=current_size, title="Visualize SDF Actor")
interactive = False
if interactive:
showm.start()
- window.record(scene, out_path="viz_sdfactor.png", size=current_size)
+ fury.window.record(scene, out_path="viz_sdfactor.png", size=current_size)
.. _sphx_glr_download_auto_examples_13_shaders_viz_sdfactor.py:
diff --git a/dev/_sources/auto_examples/13_shaders/viz_shader.rst.txt b/dev/_sources/auto_examples/13_shaders/viz_shader.rst.txt
index 9c6e1f376..874e9ed7a 100644
--- a/dev/_sources/auto_examples/13_shaders/viz_shader.rst.txt
+++ b/dev/_sources/auto_examples/13_shaders/viz_shader.rst.txt
@@ -25,58 +25,56 @@ Varying Color
This example shows how to use shaders to generate a shaded output. We will
demonstrate how to load polydata then use a custom shader calls to render
a custom shaded model.
-First, a bunch of imports.
+First, let's import FURY
-.. GENERATED FROM PYTHON SOURCE LINES 12-17
+.. GENERATED FROM PYTHON SOURCE LINES 12-15
.. code-block:: Python
- from fury import io, ui, utils, window
- from fury.data.fetcher import fetch_viz_models, read_viz_models
- from fury.shaders import add_shader_callback, shader_to_actor
+ import fury
-.. GENERATED FROM PYTHON SOURCE LINES 18-19
+.. GENERATED FROM PYTHON SOURCE LINES 16-17
Let's download and load the model
-.. GENERATED FROM PYTHON SOURCE LINES 19-25
+.. GENERATED FROM PYTHON SOURCE LINES 17-23
.. code-block:: Python
- fetch_viz_models()
- model = read_viz_models("utah.obj")
+ fury.data.fetch_viz_models()
+ model = fury.data.read_viz_models("utah.obj")
-.. GENERATED FROM PYTHON SOURCE LINES 26-29
+.. GENERATED FROM PYTHON SOURCE LINES 24-27
Let's start by loading the polydata of choice.
For this example we use the standard utah teapot model.
currently supported formats include OBJ, VTK, FIB, PLY, STL and XML
-.. GENERATED FROM PYTHON SOURCE LINES 30-37
+.. GENERATED FROM PYTHON SOURCE LINES 28-35
.. code-block:: Python
- utah = io.load_polydata(model)
- utah = utils.get_polymapper_from_polydata(utah)
- utah = utils.get_actor_from_polymapper(utah)
+ utah = fury.io.load_polydata(model)
+ utah = fury.utils.get_polymapper_from_polydata(utah)
+ utah = fury.utils.get_actor_from_polymapper(utah)
mapper = utah.GetMapper()
-.. GENERATED FROM PYTHON SOURCE LINES 38-41
+.. GENERATED FROM PYTHON SOURCE LINES 36-39
To change the default shader we add a shader replacement.
Specify vertex shader using vtkShader.Vertex
Specify fragment shader using vtkShader.Fragment
-.. GENERATED FROM PYTHON SOURCE LINES 41-67
+.. GENERATED FROM PYTHON SOURCE LINES 39-67
.. code-block:: Python
@@ -100,11 +98,13 @@ Specify fragment shader using vtkShader.Fragment
fragOutput0 = vec4(col, fragOutput0.a);
"""
- shader_to_actor(
+ fury.shaders.shader_to_actor(
utah, "vertex", impl_code=vertex_shader_code_impl, decl_code=vertex_shader_code_decl
)
- shader_to_actor(utah, "fragment", decl_code=fragment_shader_code_decl)
- shader_to_actor(utah, "fragment", impl_code=fragment_shader_code_impl, block="light")
+ fury.shaders.shader_to_actor(utah, "fragment", decl_code=fragment_shader_code_decl)
+ fury.shaders.shader_to_actor(
+ utah, "fragment", impl_code=fragment_shader_code_impl, block="light"
+ )
.. GENERATED FROM PYTHON SOURCE LINES 68-69
@@ -116,7 +116,7 @@ Let's create a scene.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
global timer
timer = 0
@@ -161,7 +161,7 @@ the timer variable.
pass
- add_shader_callback(utah, shader_callback)
+ fury.shaders.add_shader_callback(utah, shader_callback)
.. GENERATED FROM PYTHON SOURCE LINES 103-104
@@ -172,7 +172,7 @@ Let's add a textblock to the scene with a custom message
.. code-block:: Python
- tb = ui.TextBlock2D()
+ tb = fury.ui.TextBlock2D()
tb.message = "Hello Shaders"
@@ -189,7 +189,7 @@ manager.
current_size = (1024, 720)
- showm = window.ShowManager(scene, size=current_size, reset_camera=False)
+ showm = fury.window.ShowManager(scene, size=current_size, reset_camera=False)
showm.add_timer_callback(True, 30, timer_callback)
@@ -201,7 +201,7 @@ manager.
if interactive:
showm.start()
- window.record(showm.scene, size=current_size, out_path="viz_shader.png")
+ fury.window.record(showm.scene, size=current_size, out_path="viz_shader.png")
.. _sphx_glr_download_auto_examples_13_shaders_viz_shader.py:
diff --git a/dev/_sources/auto_examples/17_pybullet/viz_domino.rst.txt b/dev/_sources/auto_examples/17_pybullet/viz_domino.rst.txt
index 2fe50b935..9285183dd 100644
--- a/dev/_sources/auto_examples/17_pybullet/viz_domino.rst.txt
+++ b/dev/_sources/auto_examples/17_pybullet/viz_domino.rst.txt
@@ -38,7 +38,7 @@ First some imports.
import numpy as np
import pybullet as p
- from fury import actor, ui, utils, window
+ import fury
# Next, we initialize a pybullet client to render the physics.
# We use `DIRECT` mode to initialize pybullet without a GUI.
@@ -65,7 +65,7 @@ Set the Number of Dominoes for Simulation.
base_orientation = np.array([0, 0, 0, 1])
# Render a BASE plane to support the Dominoes.
- base_actor = actor.box(
+ base_actor = fury.actor.box(
centers=np.array([[0, 0, 0]]),
directions=[0, 0, 0],
scales=base_size,
@@ -131,7 +131,7 @@ us to tweak the simulation.
p.changeDynamics(dominos[i], -1, lateralFriction=0.2, restitution=0.1)
- domino_actor = actor.box(
+ domino_actor = fury.actor.box(
centers=domino_centers,
directions=domino_directions,
scales=domino_sizes,
@@ -147,13 +147,13 @@ Now, we define a scene and add actors to it.
.. code-block:: Python
- scene = window.Scene()
- scene.add(actor.axes())
+ scene = fury.window.Scene()
+ scene.add(fury.actor.axes())
scene.add(base_actor)
scene.add(domino_actor)
# Create show manager.
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
@@ -179,7 +179,7 @@ Now, we define methods to sync objects between fury and Pybullet.
# Calculate the vertices of the dominos.
- vertices = utils.vertices_from_actor(domino_actor)
+ vertices = fury.utils.vertices_from_actor(domino_actor)
num_vertices = vertices.shape[0]
num_objects = domino_centers.shape[0]
sec = int(num_vertices / num_objects)
@@ -238,7 +238,7 @@ Here, we define a textblock to display the Avg. FPS and simulation steps.
fpss = np.array([])
- tb = ui.TextBlock2D(
+ tb = fury.ui.TextBlock2D(
text="Avg. FPS: \nSim Steps: ", position=(0, 680), font_size=30, color=(1, 0.5, 0)
)
scene.add(tb)
@@ -303,7 +303,7 @@ simulation methods.
# Updating the position and orientation of individual dominos.
for idx, domino in enumerate(dominos):
sync_domino(idx, domino)
- utils.update_actor(domino_actor)
+ fury.utils.update_actor(domino_actor)
# Simulate a step.
p.stepSimulation()
@@ -323,7 +323,7 @@ simulation methods.
if interactive:
showm.start()
- window.record(scene, out_path="viz_domino.png", size=(900, 768))
+ fury.window.record(scene, out_path="viz_domino.png", size=(900, 768))
.. _sphx_glr_download_auto_examples_17_pybullet_viz_domino.py:
diff --git a/dev/_sources/auto_examples/17_pybullet/viz_wrecking_ball.rst.txt b/dev/_sources/auto_examples/17_pybullet/viz_wrecking_ball.rst.txt
index 298b113a6..492dbefd3 100644
--- a/dev/_sources/auto_examples/17_pybullet/viz_wrecking_ball.rst.txt
+++ b/dev/_sources/auto_examples/17_pybullet/viz_wrecking_ball.rst.txt
@@ -38,7 +38,7 @@ First some imports.
import numpy as np
import pybullet as p
- from fury import actor, ui, utils, window
+ import fury
.. GENERATED FROM PYTHON SOURCE LINES 21-22
@@ -96,7 +96,7 @@ Creating the base plane actor.
# Base
- base_actor = actor.box(
+ base_actor = fury.actor.box(
centers=np.array([[0, 0, 0]]),
directions=[0, 0, 0],
scales=(5, 5, 0.2),
@@ -166,7 +166,7 @@ generate the actor.
p.changeDynamics(bricks[idx], -1, lateralFriction=0.1, restitution=0.1)
idx += 1
- brick_actor = actor.box(
+ brick_actor = fury.actor.box(
centers=brick_centers,
directions=brick_directions,
scales=brick_sizes,
@@ -225,7 +225,7 @@ Now we render the wrecking ball consisting of a fixed hinge, a ball and rope.
link_heights = np.zeros(n_links)
link_heights[:] = dx_link
- rope_actor = actor.cylinder(
+ rope_actor = fury.actor.cylinder(
centers=linkPositions,
directions=linkDirections,
colors=np.random.rand(n_links, 3),
@@ -292,14 +292,14 @@ We add the following constraint to keep the cubical hinge fixed.
rope, -1, -1, -1, p.JOINT_FIXED, [0, 0, 0], [0, 0, 0], [0, 0, 2]
)
- box_actor = actor.box(
+ box_actor = fury.actor.box(
centers=np.array([[0, 0, 0]]),
directions=np.array([[0, 0, 0]]),
scales=(0.02, 0.02, 0.02),
colors=np.array([[1, 0, 0]]),
)
- ball_actor = actor.sphere(
+ ball_actor = fury.actor.sphere(
centers=np.array([[0, 0, 0]]), radii=ball_radius, colors=np.array([1, 0, 1])
)
@@ -314,12 +314,12 @@ visualization.
.. code-block:: Python
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.set_camera((10.28, -7.10, 6.39), (0.0, 0.0, 0.4), (-0.35, 0.26, 1.0))
- scene.add(actor.axes(scale=(0.5, 0.5, 0.5)), base_actor, brick_actor)
+ scene.add(fury.actor.axes(scale=(0.5, 0.5, 0.5)), base_actor, brick_actor)
scene.add(rope_actor, box_actor, ball_actor)
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
@@ -347,7 +347,7 @@ Calculate the vertices of the bricks.
.. code-block:: Python
- brick_vertices = utils.vertices_from_actor(brick_actor)
+ brick_vertices = fury.utils.vertices_from_actor(brick_actor)
num_vertices = brick_vertices.shape[0]
num_objects = brick_centers.shape[0]
brick_sec = int(num_vertices / num_objects)
@@ -362,7 +362,7 @@ Calculate the vertices of the wrecking ball.
.. code-block:: Python
- chain_vertices = utils.vertices_from_actor(rope_actor)
+ chain_vertices = fury.utils.vertices_from_actor(rope_actor)
num_vertices = chain_vertices.shape[0]
num_objects = brick_centers.shape[0]
chain_sec = int(num_vertices / num_objects)
@@ -437,7 +437,7 @@ Some helper tools to keep track of avg. FPS and simulation steps.
counter = itertools.count()
fpss = np.array([])
- tb = ui.TextBlock2D(
+ tb = fury.ui.TextBlock2D(
position=(0, 680), font_size=30, color=(1, 0.5, 0), text="Avg. FPS: \nSim Steps: "
)
scene.add(tb)
@@ -483,8 +483,8 @@ Timer callback to sync objects, simulate steps and apply force.
pos = p.getLinkState(rope, p.getNumJoints(rope) - 1)[4]
ball_actor.SetPosition(*pos)
sync_chain(rope_actor, rope)
- utils.update_actor(brick_actor)
- utils.update_actor(rope_actor)
+ fury.utils.update_actor(brick_actor)
+ fury.utils.update_actor(rope_actor)
# Simulate a step.
p.stepSimulation()
@@ -503,7 +503,7 @@ Timer callback to sync objects, simulate steps and apply force.
if interactive:
showm.start()
- window.record(scene, size=(900, 768), out_path="viz_wrecking_ball.png")
+ fury.window.record(scene, size=(900, 768), out_path="viz_wrecking_ball.png")
.. _sphx_glr_download_auto_examples_17_pybullet_viz_wrecking_ball.py:
diff --git a/dev/_sources/auto_examples/20_stream/viz_interaction.rst.txt b/dev/_sources/auto_examples/20_stream/viz_interaction.rst.txt
index 27964b3c9..97e0045d3 100644
--- a/dev/_sources/auto_examples/20_stream/viz_interaction.rst.txt
+++ b/dev/_sources/auto_examples/20_stream/viz_interaction.rst.txt
@@ -48,7 +48,7 @@ OS X
`brew install ffmpeg opus libvpx pkg-config`
-.. GENERATED FROM PYTHON SOURCE LINES 33-147
+.. GENERATED FROM PYTHON SOURCE LINES 33-145
.. code-block:: Python
@@ -58,13 +58,11 @@ OS X
import numpy as np
- from fury import actor, window
- from fury.stream.client import FuryStreamClient, FuryStreamInteraction
+ import fury
# if this example it's not working for you and you're using MacOs
# uncomment the following line
# multiprocessing.set_start_method('spawn')
- from fury.stream.server.main import WEBRTC_AVAILABLE, web_server, web_server_raw_array
if __name__ == "__main__":
interactive = False
@@ -99,23 +97,23 @@ OS X
centers = np.array([[0, 0, 0], [-1, 0, 0], [1, 0, 0]])
colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
- actors = actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)
- scene = window.Scene()
+ actors = fury.actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)
+ scene = fury.window.Scene()
scene.add(actors)
- showm = window.ShowManager(scene, size=(window_size[0], window_size[1]))
+ showm = fury.window.ShowManager(scene, size=(window_size[0], window_size[1]))
- stream = FuryStreamClient(
+ stream = fury.stream.FuryStreamClient(
showm, max_window_size=max_window_size, use_raw_array=use_raw_array
)
- stream_interaction = FuryStreamInteraction(
+ stream_interaction = fury.stream.client.FuryStreamInteraction(
showm, max_queue_size=max_queue_size, use_raw_array=use_raw_array
)
if use_raw_array:
p = multiprocessing.Process(
- target=web_server_raw_array,
+ target=fury.stream.server.web_server_raw_array,
args=(
stream.img_manager.image_buffers,
stream.img_manager.info_buffer,
@@ -124,13 +122,13 @@ OS X
8000,
"localhost",
True,
- WEBRTC_AVAILABLE,
+ fury.stream.server.main.WEBRTC_AVAILABLE,
),
)
else:
p = multiprocessing.Process(
- target=web_server,
+ target=fury.stream.server.web_server,
args=(
stream.img_manager.image_buffer_names,
stream.img_manager.info_buffer_name,
@@ -139,7 +137,7 @@ OS X
8000,
"localhost",
True,
- WEBRTC_AVAILABLE,
+ fury.stream.server.main.WEBRTC_AVAILABLE,
),
)
p.start()
@@ -165,7 +163,7 @@ OS X
stream.cleanup()
stream_interaction.cleanup()
- window.record(showm.scene, size=window_size, out_path="viz_interaction.png")
+ fury.window.record(showm.scene, size=window_size, out_path="viz_interaction.png")
.. _sphx_glr_download_auto_examples_20_stream_viz_interaction.py:
diff --git a/dev/_sources/auto_examples/20_stream/viz_no_interaction.rst.txt b/dev/_sources/auto_examples/20_stream/viz_no_interaction.rst.txt
index fc8a2f24f..9b1773d1d 100644
--- a/dev/_sources/auto_examples/20_stream/viz_no_interaction.rst.txt
+++ b/dev/_sources/auto_examples/20_stream/viz_no_interaction.rst.txt
@@ -22,7 +22,7 @@
Streaming FURY with WebRTC/MJPEG
====================================
-.. GENERATED FROM PYTHON SOURCE LINES 6-104
+.. GENERATED FROM PYTHON SOURCE LINES 6-103
.. code-block:: Python
@@ -35,10 +35,7 @@ Streaming FURY with WebRTC/MJPEG
# multiprocessing.set_start_method('spawn')
import numpy as np
- from fury import actor, colormap as cmap, window
- from fury.data.fetcher import fetch_viz_wiki_nw
- from fury.stream.client import FuryStreamClient
- from fury.stream.server.main import web_server_raw_array
+ import fury
if __name__ == "__main__":
interactive = False
@@ -47,7 +44,7 @@ Streaming FURY with WebRTC/MJPEG
window_size = (400, 400)
- files, folder = fetch_viz_wiki_nw()
+ files, folder = fury.data.fetch_viz_wiki_nw()
categories_file, edges_file, positions_file = sorted(files.keys())
positions = np.loadtxt(pjoin(folder, positions_file))
categories = np.loadtxt(pjoin(folder, categories_file), dtype=str)
@@ -56,7 +53,9 @@ Streaming FURY with WebRTC/MJPEG
index2category = np.unique(categories)
- categoryColors = cmap.distinguishable_colormap(nb_colors=len(index2category))
+ categoryColors = fury.colormap.distinguishable_colormap(
+ nb_colors=len(index2category)
+ )
colors = np.array(
[categoryColors[category2index[category]] for category in categories]
@@ -72,19 +71,19 @@ Streaming FURY with WebRTC/MJPEG
edgesPositions = np.array(edgesPositions)
edgesColors = np.average(np.array(edgesColors), axis=1)
- sphere_actor = actor.sdf(
+ sphere_actor = fury.actor.sdf(
centers=positions,
colors=colors,
primitives="sphere",
scales=radii * 0.5,
)
- lines_actor = actor.line(
+ lines_actor = fury.actor.line(
edgesPositions,
colors=edgesColors,
opacity=0.1,
)
- scene = window.Scene()
+ scene = fury.window.Scene()
scene.add(lines_actor)
scene.add(sphere_actor)
@@ -93,7 +92,7 @@ Streaming FURY with WebRTC/MJPEG
position=(0, 0, 1000), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 0.0, 0.0)
)
- showm = window.ShowManager(
+ showm = fury.window.ShowManager(
scene,
reset_camera=False,
size=(window_size[0], window_size[1]),
@@ -105,9 +104,9 @@ Streaming FURY with WebRTC/MJPEG
ms = 0
- stream = FuryStreamClient(showm, use_raw_array=True)
+ stream = fury.stream.FuryStreamClient(showm, use_raw_array=True)
p = multiprocessing.Process(
- target=web_server_raw_array,
+ target=fury.stream.server.web_server_raw_array,
args=(
stream.img_manager.image_buffers,
stream.img_manager.info_buffer,
@@ -123,7 +122,7 @@ Streaming FURY with WebRTC/MJPEG
stream.stop()
stream.cleanup()
- window.record(showm.scene, size=window_size, out_path="viz_no_interaction.png")
+ fury.window.record(showm.scene, size=window_size, out_path="viz_no_interaction.png")
.. _sphx_glr_download_auto_examples_20_stream_viz_no_interaction.py:
diff --git a/dev/_sources/auto_examples/20_stream/viz_widget.rst.txt b/dev/_sources/auto_examples/20_stream/viz_widget.rst.txt
index 9f4740014..5660a0b12 100644
--- a/dev/_sources/auto_examples/20_stream/viz_widget.rst.txt
+++ b/dev/_sources/auto_examples/20_stream/viz_widget.rst.txt
@@ -53,7 +53,7 @@ Notes
-----
For this example your python version should be 3.8 or greater
-.. GENERATED FROM PYTHON SOURCE LINES 38-58
+.. GENERATED FROM PYTHON SOURCE LINES 38-57
.. code-block:: Python
@@ -64,30 +64,29 @@ For this example your python version should be 3.8 or greater
import numpy as np
- from fury import actor, window
- from fury.stream.widget import Widget
+ import fury
interactive = False
window_size = (720, 500)
N = 4
centers = np.random.normal(size=(N, 3))
colors = np.random.uniform(0.1, 1.0, size=(N, 3))
- actors = actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)
- scene = window.Scene()
+ actors = fury.actor.sphere(centers, opacity=0.5, radii=0.4, colors=colors)
+ scene = fury.window.Scene()
scene.add(actors)
- showm = window.ShowManager(scene, size=(window_size[0], window_size[1]))
+ showm = fury.window.ShowManager(scene, size=(window_size[0], window_size[1]))
-.. GENERATED FROM PYTHON SOURCE LINES 59-60
+.. GENERATED FROM PYTHON SOURCE LINES 58-59
Create a stream widget
-.. GENERATED FROM PYTHON SOURCE LINES 60-69
+.. GENERATED FROM PYTHON SOURCE LINES 59-68
.. code-block:: Python
- widget = Widget(showm, port=8000)
+ widget = fury.stream.Widget(showm, port=8000)
# if you want to use webRTC, you can pass the argument to choose this encoding
# which is a more robust option.
@@ -96,13 +95,13 @@ Create a stream widget
time_sleep = 1000 if interactive else 1
-.. GENERATED FROM PYTHON SOURCE LINES 70-73
+.. GENERATED FROM PYTHON SOURCE LINES 69-72
If you want to use the widget in a Windows environment without the WSL
you need to use the asyncio version of the widget.
-.. GENERATED FROM PYTHON SOURCE LINES 73-90
+.. GENERATED FROM PYTHON SOURCE LINES 72-89
.. code-block:: Python
@@ -122,7 +121,7 @@ you need to use the asyncio version of the widget.
time.sleep(time_sleep)
widget.stop()
- window.record(showm.scene, size=window_size, out_path="viz_widget.png")
+ fury.window.record(showm.scene, size=window_size, out_path="viz_widget.png")
.. _sphx_glr_download_auto_examples_20_stream_viz_widget.py:
diff --git a/dev/_sources/auto_examples/index.rst.txt b/dev/_sources/auto_examples/index.rst.txt
index ce2456f5c..358334c6a 100644
--- a/dev/_sources/auto_examples/index.rst.txt
+++ b/dev/_sources/auto_examples/index.rst.txt
@@ -707,35 +707,35 @@ These tutorials show how to create user interfaces elements.
.. raw:: html
-
+
.. only:: html
- .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_shapes_thumb.png
+ .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_drawpanel_thumb.png
:alt:
- :ref:`sphx_glr_auto_examples_07_ui_viz_shapes.py`
+ :ref:`sphx_glr_auto_examples_07_ui_viz_drawpanel.py`
.. raw:: html
- Simple Shapes
+ DrawPanel
.. raw:: html
-
+
.. only:: html
- .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_drawpanel_thumb.png
+ .. image:: /auto_examples/07_ui/images/thumb/sphx_glr_viz_shapes_thumb.png
:alt:
- :ref:`sphx_glr_auto_examples_07_ui_viz_drawpanel.py`
+ :ref:`sphx_glr_auto_examples_07_ui_viz_shapes.py`
.. raw:: html
- DrawPanel
+ Simple Shapes
@@ -1193,7 +1193,7 @@ These tutorials show:
.. raw:: html
-
+
.. only:: html
diff --git a/dev/_static/documentation_options.js b/dev/_static/documentation_options.js
index ca3c0958b..35b3a866a 100644
--- a/dev/_static/documentation_options.js
+++ b/dev/_static/documentation_options.js
@@ -1,5 +1,5 @@
const DOCUMENTATION_OPTIONS = {
- VERSION: '0.11.0.dev66+g69f3b1c9',
+ VERSION: '0.11.0.dev67+gb909ea32',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
diff --git a/dev/auto_examples/01_introductory/index.html b/dev/auto_examples/01_introductory/index.html
index 769adb85c..67dd5f7d3 100644
--- a/dev/auto_examples/01_introductory/index.html
+++ b/dev/auto_examples/01_introductory/index.html
@@ -8,7 +8,7 @@
- Introductory — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ Introductory — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -44,7 +44,7 @@
-
+
diff --git a/dev/auto_examples/01_introductory/sg_execution_times.html b/dev/auto_examples/01_introductory/sg_execution_times.html
index e29ebe900..a390eb906 100644
--- a/dev/auto_examples/01_introductory/sg_execution_times.html
+++ b/dev/auto_examples/01_introductory/sg_execution_times.html
@@ -8,7 +8,7 @@
- Computation times — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ Computation times — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -44,7 +44,7 @@
-
+
diff --git a/dev/auto_examples/01_introductory/viz_arrow.html b/dev/auto_examples/01_introductory/viz_arrow.html
index a62b79049..51e000b1a 100644
--- a/dev/auto_examples/01_introductory/viz_arrow.html
+++ b/dev/auto_examples/01_introductory/viz_arrow.html
@@ -8,7 +8,7 @@
- Fury Arrow Actor — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ Fury Arrow Actor — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -44,7 +44,7 @@
-
+
diff --git a/dev/auto_examples/01_introductory/viz_cone.html b/dev/auto_examples/01_introductory/viz_cone.html
index faa75dada..4dd103ea7 100644
--- a/dev/auto_examples/01_introductory/viz_cone.html
+++ b/dev/auto_examples/01_introductory/viz_cone.html
@@ -8,7 +8,7 @@
- Fury Cone Actor — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ Fury Cone Actor — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -44,7 +44,7 @@
-
+
diff --git a/dev/auto_examples/01_introductory/viz_earth_animation.html b/dev/auto_examples/01_introductory/viz_earth_animation.html
index 833a1ba96..9eb631fbf 100644
--- a/dev/auto_examples/01_introductory/viz_earth_animation.html
+++ b/dev/auto_examples/01_introductory/viz_earth_animation.html
@@ -8,7 +8,7 @@
- Texture Sphere Animation — FURY 0.11.0.dev66+g69f3b1c9 documentation
+ Texture Sphere Animation — FURY 0.11.0.dev67+gb909ea32 documentation
@@ -44,7 +44,7 @@
-
+
@@ -398,17 +398,11 @@ Table of Contents
import numpy as np
-from fury import actor, io, utils, window
-from fury.data import (
- fetch_viz_models,
- fetch_viz_textures,
- read_viz_models,
- read_viz_textures,
-)
+import fury
Create a scene to start.
-scene = window.Scene()
+scene = fury.window.Scene()
Next, load in a texture for each of the actors. For this tutorial, we will
@@ -416,21 +410,21 @@
Table of Contents
Collect the Earth texture from the FURY github using fetch_viz_textures
and read_viz_textures
, then use io.load_image
to load in the
image.
-fetch_viz_textures()
-earth_filename = read_viz_textures("1_earth_8k.jpg")
-earth_image = io.load_image(earth_filename)
+fury.data.fetch_viz_textures()
+earth_filename = fury.data.read_viz_textures("1_earth_8k.jpg")
+earth_image = fury.io.load_image(earth_filename)
Using actor.texture_on_sphere()
, create an earth_actor with your newly
loaded texture.
-earth_actor = actor.texture_on_sphere(earth_image)
+earth_actor = fury.actor.texture_on_sphere(earth_image)
Then, do the same for the moon.
-moon_filename = read_viz_textures("moon-8k.jpg")
-moon_image = io.load_image(moon_filename)
+moon_filename = fury.data.read_viz_textures("moon-8k.jpg")
+moon_image = fury.io.load_image(moon_filename)
-moon_actor = actor.texture_on_sphere(moon_image)
+moon_actor = fury.actor.texture_on_sphere(moon_image)
Add both actors to the already existing scene.
@@ -444,12 +438,12 @@ Table of Contents
correctly align the texture.
moon_actor.SetPosition(1, 0.1, 0.5)
moon_actor.SetScale(0.25, 0.25, 0.25)
-utils.rotate(earth_actor, (-90, 1, 0, 0))
+fury.utils.rotate(earth_actor, (-90, 1, 0, 0))
The ShowManager class is the interface between the scene, the window and the
interactor.
-showm = window.ShowManager(
+showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
@@ -473,21 +467,21 @@ Table of Contents
on the Earth’s surface on Bloomington, IN, home of FURY’s headquarters!
center = np.array([[-0.39, 0.3175, 0.025]])
radius = 0.002
-sphere_actor = actor.sphere(center, window.colors.blue_medium, radius)
+sphere_actor = fury.actor.sphere(center, fury.window.colors.blue_medium, radius)
Also creating a text actor to add below the sphere.
-text_actor = actor.text_3d(
- "Bloomington, Indiana", (-0.42, 0.31, 0.03), window.colors.white, 0.004
+text_actor = fury.actor.text_3d(
+ "Bloomington, Indiana", (-0.42, 0.31, 0.03), fury.window.colors.white, 0.004
)
-utils.rotate(text_actor, (-90, 0, 1, 0))
+fury.utils.rotate(text_actor, (-90, 0, 1, 0))
Let’s also import a model of a satellite to visualize circling the moon.
-fetch_viz_models()
-satellite_filename = read_viz_models("satellite_obj.obj")
-satellite = io.load_polydata(satellite_filename)
-satellite_actor = utils.get_actor_from_polydata(satellite)
+fury.data.fetch_viz_models()
+satellite_filename = fury.data.read_viz_models("satellite_obj.obj")
+satellite = fury.io.load_polydata(satellite_filename)
+satellite_actor = fury.utils.get_actor_from_polydata(satellite)
satellite_actor.SetPosition(-0.75, 0.1, 0.4)
satellite_actor.SetScale(0.005, 0.005, 0.005)
@@ -501,7 +495,7 @@ Table of Contents
cnt = next(counter)
showm.render()
if cnt < 450:
- utils.rotate(earth_actor, (1, 0, 1, 0))
+ fury.utils.rotate(earth_actor, (1, 0, 1, 0))
if cnt % 5 == 0 and cnt < 450:
showm.scene.azimuth(-1)
if cnt == 300:
@@ -526,15 +520,15 @@ Table of Contents
)
scene.zoom(0.03)
scene.add(satellite_actor)
- utils.rotate(satellite_actor, (180, 0, 1, 0))
+ fury.utils.rotate(satellite_actor, (180, 0, 1, 0))
scene.rm(earth_actor)
if cnt > 575 and cnt < 750:
showm.scene.azimuth(-2)
- utils.rotate(moon_actor, (-2, 0, 1, 0))
+ fury.utils.rotate(moon_actor, (-2, 0, 1, 0))
satellite_actor.SetPosition(-0.8, 0.1 - cnt / 10000, 0.4)
if cnt >= 750 and cnt < 1100:
showm.scene.azimuth(-2)
- utils.rotate(moon_actor, (-2, 0, 1, 0))
+ fury.utils.rotate(moon_actor, (-2, 0, 1, 0))
satellite_actor.SetPosition(-0.8, -0.07 + cnt / 10000, 0.4)
if cnt == 1100:
showm.exit()
@@ -543,7 +537,7 @@ Table of Contents
Watch your new animation take place!
showm.add_timer_callback(True, 35, timer_callback)
showm.start()
-window.record(showm.scene, size=(900, 768), out_path="viz_earth_animation.png")
+fury.window.record(showm.scene, size=(900, 768), out_path="viz_earth_animation.png")
Create a new scene, and load in the image of the Earth using
fetch_viz_textures
and read_viz_textures
. We will use a 16k
resolution texture for maximum detail.
-scene = window.Scene()
+scene = fury.window.Scene()
-fetch_viz_textures()
-earth_file = read_viz_textures("1_earth_16k.jpg")
-earth_image = io.load_image(earth_file)
-earth_actor = actor.texture_on_sphere(earth_image)
+fury.data.fetch_viz_textures()
+earth_file = fury.data.read_viz_textures("1_earth_16k.jpg")
+earth_image = fury.io.load_image(earth_file)
+earth_actor = fury.actor.texture_on_sphere(earth_image)
scene.add(earth_actor)
Rotate the Earth to make sure the texture is correctly oriented. Change it’s
scale using actor.SetScale()
.
-utils.rotate(earth_actor, (-90, 1, 0, 0))
-utils.rotate(earth_actor, (180, 0, 1, 0))
+fury.utils.rotate(earth_actor, (-90, 1, 0, 0))
+fury.utils.rotate(earth_actor, (180, 0, 1, 0))
earth_actor.SetScale(2, 2, 2)
@@ -454,38 +453,38 @@ Table of Contents
centers = np.array([[*locationone], [*locationtwo], [*locationthree]])
colors = np.random.rand(3, 3)
radii = np.array([0.005, 0.005, 0.005])
-sphere_actor = actor.sphere(centers, colors, radii)
+sphere_actor = fury.actor.sphere(centers, colors, radii)
scene.add(sphere_actor)
Create some text actors to add to the scene indicating each location and its
geographical coordinates.
-nyc_actor = actor.text_3d(
+nyc_actor = fury.actor.text_3d(
"New York City, New York\n40.7128° N, 74.0060° W",
(locationone[0] - 0.04, locationone[1], locationone[2] + 0.07),
- window.colors.white,
+ fury.window.colors.white,
0.01,
)
-paris_actor = actor.text_3d(
+paris_actor = fury.actor.text_3d(
"Paris, France\n48.8566° N, 2.3522° E",
(locationthree[0] - 0.04, locationthree[1], locationthree[2] - 0.07),
- window.colors.white,
+ fury.window.colors.white,
0.01,
)
-beijing_actor = actor.text_3d(
+beijing_actor = fury.actor.text_3d(
"Beijing, China\n39.9042° N, 116.4074° E",
(locationtwo[0] - 0.06, locationtwo[1], locationtwo[2] - 0.07),
- window.colors.white,
+ fury.window.colors.white,
0.01,
)
-utils.rotate(paris_actor, (85, 0, 1, 0))
-utils.rotate(beijing_actor, (180, 0, 1, 0))
-utils.rotate(nyc_actor, (5, 1, 0, 0))
+fury.utils.rotate(paris_actor, (85, 0, 1, 0))
+fury.utils.rotate(beijing_actor, (180, 0, 1, 0))
+fury.utils.rotate(nyc_actor, (5, 1, 0, 0))
Create a ShowManager object, which acts as the interface between the scene,
the window and the interactor.
-showm = window.ShowManager(
+showm = fury.window.ShowManager(
scene, size=(900, 768), reset_camera=False, order_transparent=True
)
@@ -532,7 +531,7 @@ Table of Contents
showm.add_timer_callback(True, 25, timer_callback)
showm.start()
-window.record(showm.scene, size=(900, 768), out_path="viz_earth_coordinates.png")
+fury.window.record(showm.scene, size=(900, 768), out_path="viz_earth_coordinates.png")