.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/example_remeshing.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_example_remeshing.py: .. _example_remeshing: =================================== Remeshing example in slam =================================== .. GENERATED FROM PYTHON SOURCE LINES 8-16 .. code-block:: Python # Authors: # Guillaume Auzias # Julien Barrès # License: MIT # sphinx_gallery_thumbnail_number = 2 .. GENERATED FROM PYTHON SOURCE LINES 17-21 NOTE: there is no visualization tool in slam, but we provide at the end of this script exemplare code to do the visualization with an external solution ############################################################################## .. GENERATED FROM PYTHON SOURCE LINES 23-24 Importation of slam modules .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: Python import slam.io as sio import slam.remeshing as srem .. GENERATED FROM PYTHON SOURCE LINES 28-29 Source object files .. GENERATED FROM PYTHON SOURCE LINES 29-33 .. code-block:: Python source_mesh_file = "../examples/data/example_mesh.gii" source_texture_file = "../examples/data/example_texture.gii" source_spherical_mesh_file = "../examples/data/example_mesh_spherical.gii" .. GENERATED FROM PYTHON SOURCE LINES 34-35 Target object files .. GENERATED FROM PYTHON SOURCE LINES 35-49 .. code-block:: Python target_mesh_file = "../examples/data/example_mesh_2.gii" target_spherical_mesh_file = "../examples/data/example_mesh_2_spherical.gii" source_mesh = sio.load_mesh(source_mesh_file) source_tex = sio.load_texture(source_texture_file) source_spherical_mesh = sio.load_mesh(source_spherical_mesh_file) target_mesh = sio.load_mesh(target_mesh_file) target_spherical_mesh = sio.load_mesh(target_spherical_mesh_file) interpolated_tex_values = srem.spherical_interpolation_nearest_neigbhor( source_spherical_mesh, target_spherical_mesh, source_tex.darray[0] ) .. GENERATED FROM PYTHON SOURCE LINES 50-76 VISUALIZATION USING EXTERNAL TOOLS ############################################################################ # Visualization with visbrain import slam.plot as splt ############################################################################### visb_sc = splt.visbrain_plot( mesh=source_mesh, tex=source_tex.darray[0], caption="source with curvature", cblabel="curvature", ) visb_sc = splt.visbrain_plot( mesh=source_spherical_mesh, tex=source_tex.darray[0], caption="spherical source mesh", cblabel="curvature", visb_sc=visb_sc, ) visb_sc = splt.visbrain_plot( mesh=target_mesh, tex=interpolated_tex_values, caption="target mesh with curvature " "from source mesh", cblabel="curvature", visb_sc=visb_sc, ) visb_sc.preview() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.009 seconds) .. _sphx_glr_download_auto_examples_example_remeshing.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_remeshing.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_remeshing.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_remeshing.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_