.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_introductory/viz_texture.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_introductory_viz_texture.py: =============== Sphere Texture =============== In this tutorial, we will show how to create a sphere with a texture. .. GENERATED FROM PYTHON SOURCE LINES 7-10 .. code-block:: Python import fury .. GENERATED FROM PYTHON SOURCE LINES 11-12 Create a scene to start. .. GENERATED FROM PYTHON SOURCE LINES 12-15 .. code-block:: Python scene = fury.window.Scene() .. 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 20-25 .. code-block:: Python fury.data.fetch_viz_textures() filename = fury.data.read_viz_textures("1_earth_8k.jpg") image = fury.io.load_image(filename) .. rst-class:: sphx-glr-script-out .. code-block:: none Dataset is already in place. If you want to fetch it again please first remove the folder /Users/skoudoro/.fury/textures .. GENERATED FROM PYTHON SOURCE LINES 26-30 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 ``fury.actor.texture`` instead. .. GENERATED FROM PYTHON SOURCE LINES 30-33 .. code-block:: Python scene.add(fury.actor.texture_on_sphere(image)) .. 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 36-41 .. code-block:: Python interactive = False if interactive: fury.window.show(scene, size=(600, 600), reset_camera=False) fury.window.record(scene, size=(900, 768), out_path="viz_texture.png") .. image-sg:: /auto_examples/01_introductory/images/sphx_glr_viz_texture_001.png :alt: viz texture :srcset: /auto_examples/01_introductory/images/sphx_glr_viz_texture_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/homebrew/Caskroom/miniforge/base/envs/py39/lib/python3.9/site-packages/sphinx_gallery/gen_rst.py:722: UserWarning: We'll no longer accept the way you call the record function in future versions of FURY. Here's how to call the Function record: record(scene='value', cam_pos='value', cam_focal='value', cam_view='value', out_path='value', path_numbering='value', n_frames='value', az_ang='value', magnification='value', size='value', reset_camera='value', screen_clip='value', stereo='value', verbose='value') exec(self.code, self.fake_main.__dict__) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.245 seconds) .. _sphx_glr_download_auto_examples_01_introductory_viz_texture.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_texture.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_texture.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_