.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "demos\03_geometry\d13_HelicalGeometry.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_d13_HelicalGeometry.py: Helical scans ============= Move the image along the rotation axis at each angle. Source: `Python/demos/d13_HelicalGeometry.py `__ ยท `MATLAB/Demos/d13_HelicalGeometry.m `__ .. dropdown:: MATLAB version of this demo :icon: code .. literalinclude:: /../MATLAB/Demos/d13_HelicalGeometry.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 import tigre.algorithms as algs import time .. GENERATED FROM PYTHON SOURCE LINES 27-29 Geometry -------- .. GENERATED FROM PYTHON SOURCE LINES 29-65 .. code-block:: Python geo = tigre.geometry_default(high_resolution=False) angles = np.linspace(0, 2 * np.pi, 100, endpoint=False) angles = np.hstack([angles, angles, angles]) # loop 3 times # Load thorax phantom data head = sample_loader.load_head_phantom(geo.nVoxel) # This makes it helical. # # NOTE the component ordering: the Python bindings map offOrigin as # (z, y, x) - matching numpy's volume index order - so the axial (helix) # motion goes in column 0. This differs from MATLAB, whose offOrigin is # (x, y, z) and whose version of this demo therefore uses offOrigin(3,:). # Porting by keeping the index silently translates the volume along the # BEAM instead of along the rotation axis. geo.offOrigin = np.zeros((angles.shape[0], 3)) geo.offOrigin[:, 0] = np.linspace( -1024 / 2 + 128, 1024 / 2 - 128, angles.shape[0] ) # about 256^3 images fit int he detector with this size. # project data data = tigre.Ax(head, geo, angles) # Uncomment if you want to see the data # plotProj(data,angles); ## Reconstruct Helical SIRTimg = algs.sirt(data, geo, angles, 30) # SARTimg=SART(data,geo,angles,30); # takes time CGLSimg = algs.cgls(data, geo, angles, 20) ## Plot results # CGLS and SIRT tigre.plotImg(np.concatenate([head, SIRTimg, CGLSimg], axis=1), dim="z", step=3, clims=[0, 1]) .. image-sg:: /demos/03_geometry/images/sphx_glr_d13_HelicalGeometry_001.gif :alt: d13 HelicalGeometry :srcset: /demos/03_geometry/images/sphx_glr_d13_HelicalGeometry_001.gif :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none SIRT algorithm in progress. Estimated time until completion : 00:00:03 Algorithm will finish at : 16:51:21 CGLS algorithm in progress. Estimated time until completion : 00:00:01 Algorithm will finish at : 16:51:20 Average time taken for each iteration for CGLS:0.026790394998533883(s) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.054 seconds) .. _sphx_glr_download_demos_03_geometry_d13_HelicalGeometry.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: d13_HelicalGeometry.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: d13_HelicalGeometry.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: d13_HelicalGeometry.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_