.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/fusion3D.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_fusion3D.py: Fusion3D example ================ Fusion3D (mesh + texture from a volume) in Anatomist .. GENERATED FROM PYTHON SOURCE LINES 39-88 .. image-sg:: /auto_examples/images/sphx_glr_fusion3D_001.png :alt: fusion3D :srcset: /auto_examples/images/sphx_glr_fusion3D_001.png :class: sphx-glr-single-img .. code-block:: default import anatomist.api as anatomist # to expand the mesh bigger from soma import aims from soma.qt_gui.qt_backend import Qt import numpy as np import sys runloop = False if Qt.QApplication.instance() is None: runloop = True # initialize Anatomist a = anatomist.Anatomist() # load a volume in anatomist avol = a.loadObject('irm.ima') amesh = a.loadObject('test.mesh') # this is to make the mesh bigger compared to the volume size tr = aims.AffineTransformation3d() tr.fromMatrix(np.matrix([[8., 0, 0, 204.4], [0, 8., 0, 132.5], [0, 0, 8., 68.4]])) aims.SurfaceManip.meshTransform(amesh.toAimsObject(), tr) amesh.UpdateMinAndMax() # fusion the objects fusion = a.fusionObjects(objects=[avol, amesh], method="Fusion3DMethod") # params of the fusion a.execute("Fusion3DParams", object=fusion, method="line", submethod="mean", depth=4, step=1) # open a window win = a.createWindow('Axial') # put volume in window a.addObjects([fusion], [win]) # export the fusion texture in a file. fusion.exportTexture("fusion.tex") # display in matplotlib for sphinx_gallery win.sphinx_gallery_snapshot() if runloop and 'sphinx_gallery' not in sys.modules: Qt.QApplication.instance().exec_() if runloop or 'sphinx_gallery' in sys.modules: del fusion, win, amesh, avol, tr .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.781 seconds) .. _sphx_glr_download_auto_examples_fusion3D.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: fusion3D.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: fusion3D.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_