
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "generated/gallery/12-mprage/mprage_stack_of_spirals3D_sequence.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_generated_gallery_12-mprage_mprage_stack_of_spirals3D_sequence.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_generated_gallery_12-mprage_mprage_stack_of_spirals3D_sequence.py:


============================
3D stack-of-spirals MPRAGE
============================

An inversion preparation is followed by a train of low-flip-angle spoiled
spiral gradient echoes with Cartesian partition encoding. Interleaf and
partition order determine the recovery time of the acquired data within and
between inversion cycles. Stack-of-spirals MPRAGE provides rapid T1-weighted
3D structural imaging.

.. GENERATED FROM PYTHON SOURCE LINES 12-68








.. GENERATED FROM PYTHON SOURCE LINES 69-76

Timing structure
----------------

Each cycle comprises inversion, inversion delay, an interleaf train at one
partition and a recovery interval. ``ti=None`` and ``tr=None`` use the
shortest timing supported by the modules. Four interleaves per partition
produce a compact timing diagram.

.. GENERATED FROM PYTHON SOURCE LINES 76-89

.. code-block:: Python


    import pypulseqpp as pp
    from pypulseqpp.sequences import mprage_stack_of_spirals3D_sequence

    compact = mprage_stack_of_spirals3D_sequence(
        n=96, n_z=4, n_shots=4, ti=None, tr=None, n_dummy=0
    )
    print(
        f"{compact.num_blocks} blocks, {compact.duration()[0]:.2f} s, "
        f"TI {compact.get_definition('TI')[0] * 1e3:.0f} ms, "
        f"TR {compact.get_definition('TR')[0] * 1e3:.0f} ms"
    )





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    80 blocks, 0.27 s, TI 8 ms, TR 67 ms




.. GENERATED FROM PYTHON SOURCE LINES 90-92

.. code-block:: Python

    compact.paper_plot()




.. image-sg:: /generated/gallery/12-mprage/images/sphx_glr_mprage_stack_of_spirals3D_sequence_001.png
   :alt: mprage stack of spirals3D sequence
   :srcset: /generated/gallery/12-mprage/images/sphx_glr_mprage_stack_of_spirals3D_sequence_001.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 93-101

Sampling order
--------------

Each inversion cycle acquires the interleaves of one partition, so the cycle
is constant along each row. The interleaf train contains substantially fewer
readouts than an equivalent Cartesian line train, reducing the range of
inversion-recovery weighting. ``TI`` ends at the first excitation-pulse
centre; the first interleaf reaches the centre of k-space at ``TI + TE``.

.. GENERATED FROM PYTHON SOURCE LINES 101-110

.. code-block:: Python


    protocol = mprage_stack_of_spirals3D_sequence(
        n=192, n_z=16, n_shots=16, ti=0.9, tr=2.3, n_dummy=0
    )





.. image-sg:: /generated/gallery/12-mprage/images/sphx_glr_mprage_stack_of_spirals3D_sequence_002.png
   :alt: mprage stack of spirals3D sequence
   :srcset: /generated/gallery/12-mprage/images/sphx_glr_mprage_stack_of_spirals3D_sequence_002.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 111-117

Trajectory
----------

The interleaves of every partition, over the three k-space axes, coloured by
shot. Each interleaf is the same spiral gradient waveform rotated to its own
angle; the rotated set covers the in-plane k-space disc.

.. GENERATED FROM PYTHON SOURCE LINES 117-120

.. code-block:: Python


    pp.plot.plot_kspace(protocol, color_by="shot")




.. image-sg:: /generated/gallery/12-mprage/images/sphx_glr_mprage_stack_of_spirals3D_sequence_003.png
   :alt: mprage stack of spirals3D sequence
   :srcset: /generated/gallery/12-mprage/images/sphx_glr_mprage_stack_of_spirals3D_sequence_003.png
   :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 11.342 seconds)


.. _sphx_glr_download_generated_gallery_12-mprage_mprage_stack_of_spirals3D_sequence.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: mprage_stack_of_spirals3D_sequence.ipynb <mprage_stack_of_spirals3D_sequence.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: mprage_stack_of_spirals3D_sequence.py <mprage_stack_of_spirals3D_sequence.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: mprage_stack_of_spirals3D_sequence.zip <mprage_stack_of_spirals3D_sequence.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
