.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "demos\01_basics\d02_SampleData.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_demos_01_basics_d02_SampleData.py: Load the sample data ==================== Load the head phantom and the other images that ship with TIGRE. Source: `Python/demos/d02_SampleData.py `__ ยท `MATLAB/Demos/d02_SampleData.m `__ .. dropdown:: MATLAB version of this demo :icon: code .. literalinclude:: /../MATLAB/Demos/d02_SampleData.m :language: matlab .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python import tigre from tigre.utilities import sample_loader from tigre.utilities import sl3d .. GENERATED FROM PYTHON SOURCE LINES 21-23 Define geometry --------------- .. GENERATED FROM PYTHON SOURCE LINES 23-26 .. code-block:: Python geo = tigre.geometry_default(high_resolution=False) .. GENERATED FROM PYTHON SOURCE LINES 27-52 .. code-block:: Python # -------------------------------------------------------------------------- # 3D Shepp-Logan # # Type of shepp logan phantom. The shape will be the same, but Hounsfield # values will be different # Options: # phantom_type: str # One of {"kak-slaney", "yu-ye-wang", "toft-schabel"}, optional # Default is "yu-ye-wang" # The type of phantom. # size_out : int or list whose length is three, optional # Default is [128, 128, 128] # The number of voxels of phantom. [nVoxelZ, nVoxelY, nVoxelX] # -------------------------------------------------------------------------- # phantom_type="kak-slaney" # Air is 0. Water is 1. Proportional to Hounsfield value. phantom_type = ( "yu-ye-wang" # Default of Python TIGRE Shepp-Logan phantom. Improved visual perception ) # phantom_type="toft-schabel" # Default of MATLAB TIGRE Shepp-Logan phantom. shepp = sl3d.shepp_logan_3d( geo.nVoxel, phantom_type=phantom_type ) # Default are 128^3 and "yu-ye-wang" tigre.plotImg(shepp, dim="z") .. image-sg:: /demos/01_basics/images/sphx_glr_d02_SampleData_001.gif :alt: d02 SampleData :srcset: /demos/01_basics/images/sphx_glr_d02_SampleData_001.gif :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 53-55 load head phantom ----------------- .. GENERATED FROM PYTHON SOURCE LINES 55-61 .. code-block:: Python head = sample_loader.load_head_phantom(geo.nVoxel) # check the shape print(head.shape) # show it tigre.plotImg(head, dim="z") .. image-sg:: /demos/01_basics/images/sphx_glr_d02_SampleData_002.gif :alt: d02 SampleData :srcset: /demos/01_basics/images/sphx_glr_d02_SampleData_002.gif :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (64, 64, 64) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 8.773 seconds) .. _sphx_glr_download_demos_01_basics_d02_SampleData.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: d02_SampleData.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: d02_SampleData.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: d02_SampleData.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_