.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "demos\01_basics\d04_SimpleReconstruction.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_d04_SimpleReconstruction.py: A first reconstruction ====================== Reconstruct simulated data with FDK and OS-SART and compare the results. Source: `Python/demos/d04_SimpleReconstruction.py `__ ยท `MATLAB/Demos/d04_SimpleReconstruction.m `__ .. dropdown:: MATLAB version of this demo :icon: code .. literalinclude:: /../MATLAB/Demos/d04_SimpleReconstruction.m :language: matlab .. GENERATED FROM PYTHON SOURCE LINES 17-19 Initialize ---------- .. GENERATED FROM PYTHON SOURCE LINES 19-26 .. code-block:: Python import tigre import numpy as np from tigre.utilities import sample_loader from tigre.utilities import CTnoise import tigre.algorithms as algs .. GENERATED FROM PYTHON SOURCE LINES 27-29 Geometry -------- .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python geo = tigre.geometry_default(high_resolution=False) .. GENERATED FROM PYTHON SOURCE LINES 33-35 Load data and generate projections ---------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 35-45 .. code-block:: Python # define angles angles = np.linspace(0, 2 * np.pi, 100, endpoint=False) # Load thorax phantom data head = sample_loader.load_head_phantom(geo.nVoxel) # generate projections projections = tigre.Ax(head, geo, angles) # add noise noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10])) .. GENERATED FROM PYTHON SOURCE LINES 46-48 Reconstruct image using OS-SART and FDK --------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 48-56 .. code-block:: Python # FDK imgFDK = algs.fdk(noise_projections, geo, angles) # OS-SART niter = 50 imgOSSART = algs.ossart(noise_projections, geo, angles, niter) .. rst-class:: sphx-glr-script-out .. code-block:: none OSSART algorithm in progress. Estimated time until completion : 00:00:03 Algorithm will finish at : 16:47:58 .. GENERATED FROM PYTHON SOURCE LINES 57-59 Show the results ---------------- .. GENERATED FROM PYTHON SOURCE LINES 59-61 .. code-block:: Python tigre.plotimg(np.concatenate([imgFDK, imgOSSART], axis=1), dim="z") .. image-sg:: /demos/01_basics/images/sphx_glr_d04_SimpleReconstruction_001.gif :alt: d04 SimpleReconstruction :srcset: /demos/01_basics/images/sphx_glr_d04_SimpleReconstruction_001.gif :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.223 seconds) .. _sphx_glr_download_demos_01_basics_d04_SimpleReconstruction.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: d04_SimpleReconstruction.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: d04_SimpleReconstruction.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: d04_SimpleReconstruction.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_