.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "demos\03_geometry\d18_ArbitraryAxisOfRotation.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_03_geometry_d18_ArbitraryAxisOfRotation.py: Arbitrary axis of rotation ========================== Trajectories that are not a circle around z, given as Euler angles. Source: `Python/demos/d18_ArbitraryAxisOfRotation.py `__ ยท `MATLAB/Demos/d18_ArbitraryAxisOfRotation.m `__ .. dropdown:: MATLAB version of this demo :icon: code .. literalinclude:: /../MATLAB/Demos/d18_ArbitraryAxisOfRotation.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-61 .. code-block:: Python ## Define angles numProjs = 100 anglesY = np.linspace(0, 2 * np.pi, numProjs, endpoint=False) anglesZ2 = anglesY anglesZ1 = np.pi * np.sin(anglesY) angles = np.vstack([anglesZ1, anglesY, anglesZ2]).T ## Get Image head = sample_loader.load_head_phantom(geo.nVoxel) ## Project projections = tigre.Ax(head, geo, angles) tigre.plotproj(projections, anglesY) # angle information not right in the title ## Reconstruct: # Note, FDK will not work. imgSIRT = algs.sirt(projections, geo, angles, 50) imgCGLS = algs.cgls(projections, geo, angles, 10) tigre.plotimg(np.concatenate([head, imgSIRT, imgCGLS], axis=1), dim="z") .. rst-class:: sphx-glr-horizontal * .. image-sg:: /demos/03_geometry/images/sphx_glr_d18_ArbitraryAxisOfRotation_001.gif :alt: d18 ArbitraryAxisOfRotation :srcset: /demos/03_geometry/images/sphx_glr_d18_ArbitraryAxisOfRotation_001.gif :class: sphx-glr-multi-img * .. image-sg:: /demos/03_geometry/images/sphx_glr_d18_ArbitraryAxisOfRotation_002.gif :alt: d18 ArbitraryAxisOfRotation :srcset: /demos/03_geometry/images/sphx_glr_d18_ArbitraryAxisOfRotation_002.gif :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none SIRT algorithm in progress. Estimated time until completion : 00:00:02 Algorithm will finish at : 16:55:53 CGLS algorithm in progress. Estimated time until completion : 00:00:00 Algorithm will finish at : 16:55:52 Average time taken for each iteration for CGLS:0.012445609999122097(s) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 16.945 seconds) .. _sphx_glr_download_demos_03_geometry_d18_ArbitraryAxisOfRotation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: d18_ArbitraryAxisOfRotation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: d18_ArbitraryAxisOfRotation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: d18_ArbitraryAxisOfRotation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_