NMR and MRI physics · Introductory

Slice-selective excitation: sinc RF plus slice gradient

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

In MRI, a slice is chosen by applying a linear gradient along one axis so that resonance frequency varies with position, while a shaped radiofrequency (RF) pulse with a limited frequency band excites only the spins whose frequencies fall in that band. A sinc-shaped pulse has a nearly rectangular frequency spectrum, so it excites a sharp, flat slice. Slice thickness depends on RF bandwidth and gradient strength; slice position depends on the RF center frequency.

Intuition

Think of the patient as a long row of tuning forks, all identical at rest. The slice gradient makes each fork slightly different in pitch according to where it sits along the axis. An RF pulse is like a sound containing only a narrow range of pitches. Only forks tuned within that range ring, so only one slab of tissue responds. The Fourier transform links the pulse shape in time to its frequency content: a sinc in time gives a rectangle in frequency, which gives a rectangle of excited positions. Making the pulse more narrowband, or the gradient weaker, gives a thicker slice. Moving the carrier frequency slides the slice along the gradient axis.

Key equations

ω(z)=γ(B0+Gzz)
(1)

Larmor frequency varies linearly with position z in the presence of the slice gradient G_z.

Δz=2πΔfγGzorΔz=Δfγ‾Gz
(2)

Slice thickness equals RF bandwidth divided by γ‾ times gradient strength (γ‾=γ2π, about 42.58 MHz/T for protons).

z0=fc−f0γ‾Gz
(3)

Slice center is set by the offset of the RF carrier frequency from the central Larmor frequency.

B1(t)∝sinc(πΔft)⟺rect(fΔf)
(4)

Small-flip-angle excitation profile is approximately the Fourier transform of the RF envelope.

Derivation

  1. With gradient on, spins at position z precess at f(z)=f0+γ‾Gz.
  2. In the small-flip-angle approximation, the transverse magnetization profile is approximately the Fourier transform of B1(t).
  3. A sinc envelope with main-lobe-defined bandwidth Δf has a rectangular spectrum of width Δf centered on the carrier frequency fc.
  4. Spins are excited where f(z) lies within fc ± Δf/2.
  5. Solving γ‾×G×z=fc−f0±Δf/2 gives center z0 and thickness Δz=Δf/(γ‾×G).
  6. In practice the sinc is truncated and apodized (e.g., Hamming window), and a rephasing gradient lobe of opposite sign, half the area, follows to refocus phase across the slice.

Worked example

Problem

A 1 ms sinc pulse has a bandwidth of 2 kHz. The slice gradient is 10 mT/m. What is the slice thickness for protons, and what carrier offset moves the slice 3 cm from isocenter?

  1. γ‾=42.58 MHz/T=42.58 kHz/mT.
  2. Gradient in frequency per distance: 42.58 kHz/mT × 10 mT/m = 425.8 kHz/m = 0.4258 kHz/mm.
  3. Thickness = 2 kHz / 0.4258 kHz/mm ≈ 4.7 mm.
  4. Offset for 30 mm shift = 0.4258 kHz/mm × 30 mm ≈ 12.8 kHz.

Answer Thickness about 4.7 mm; carrier offset about +12.8 kHz (sign depends on gradient polarity).

Common mistakes

  • Thinking the RF pulse itself is spatially selective; it is the gradient that maps frequency to position.
  • Forgetting that a longer pulse has narrower bandwidth, giving a thicker slice at fixed gradient.
  • Confusing γ with γ‾ and mixing rad/s with Hz.
  • Omitting the rephasing gradient lobe, which causes signal loss from dephasing across the slice.
  • Assuming a real truncated sinc gives perfectly sharp edges; the profile has ripples and transition bands.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(107 lines)
from manim import *
import numpy as np
import sys
from blocks import *
from mri_blocks import *

# ---- physics setup (times in ms, frequencies in kHz) ----
T_RF = 2.0          # sinc pulse duration
N_RF = 40           # RF time steps
DT = T_RF / N_RF
G = 6.0             # slice gradient: kHz per unit position
N_REPH = 20         # rephaser steps (half the slice-select area)
Z = np.linspace(-1, 1, 81)


def build_events():
    """Hard-pulse approximation of a 3-lobe-per-side sinc under a slice gradient, then rephaser."""
    tc = (np.arange(N_RF) + 0.5) * DT
    u = 6.0 * (tc - T_RF / 2) / T_RF
    w = np.sinc(u)
    flips = (np.pi / 2) * w / w.sum()          # total area = 90 degrees
    ev = []
    for f in flips:
        ev.append({"type": "rf", "flip": float(f)})
        ev.append({"type": "grad", "dt": DT, "g": G, "pos": Z})
    for _ in range(N_REPH):
        ev.append({"type": "grad", "dt": DT, "g": -G, "pos": Z})
    return ev


def simulate():
    """Return snapshot times and (|Mxy|, in-phase) profiles after each time step."""
    times, hist = bloch_simulate(build_events(), [0, 0, 1], np.inf, np.inf, np.zeros(len(Z)))
    snaps_t, mag, inph = [0.0], [np.zeros(len(Z))], [np.zeros(len(Z))]
    for k in range(1, len(times)):
        if k % 2 == 1 and k < 2 * N_RF:   # skip state right after rf (same time)
            continue
        M = hist[:, k, :]
        snaps_t.append(times[k])
        mag.append(np.hypot(M[:, 0], M[:, 1]))
        inph.append(-M[:, 1])              # rot_x tips z toward -y
    return np.array(snaps_t), np.array(mag), np.array(inph)


TS, MAG, INPH = simulate()
T_MAX = T_RF + N_REPH * DT


class Main(Scene):
    def construct(self):
        title = TitleCard(self, "Slice-selective excitation", "sinc RF pulse + slice gradient Gz")

        # timing diagram (upper part)
        psd = PulseSequenceDiagram(rows=("RF", "Gz"), t_max=T_MAX, width=11, height=2.0)
        psd.move_to([0, 1.85, 0])
        rf = psd.add_rf(0.0, T_RF, kind="sinc", amp=1.0)
        gss = psd.add_gradient("Gz", 0.0, T_RF, amp=0.8, shape="rect")
        greph = psd.add_gradient("Gz", T_RF, T_MAX, amp=-0.8, shape="rect", color=C_BAD)
        cursor = psd.time_cursor()

        # slice profile plot (lower part)
        sp = SignalPlot(x_range=(-1, 1, 0.5), y_range=(-1, 1, 0.5), x_label="z",
                        y_label="Mxy", width=7, height=2.4)
        sp.move_to([-1.6, -1.45, 0])
        leg1 = Text("|Mxy|", font_size=24, color=C_MAIN)
        leg2 = Text("in-phase", font_size=24, color=C_ACCENT)
        leg = VGroup(leg1, leg2).arrange(DOWN, aligned_edge=LEFT).next_to(sp, RIGHT, buff=0.6)

        self.play(Create(psd), FadeIn(sp), FadeIn(leg), run_time=1.2)
        self.play(Create(rf), FadeIn(gss), FadeIn(greph), run_time=1.0)
        self.add(cursor)
        c_mag = sp.plot(Z, MAG[0], color=C_MAIN)
        c_in = sp.plot(Z, INPH[0], color=C_ACCENT)
        self.add(c_mag, c_in)
        StepCaption(self, "Gz makes frequency depend on z; the sinc excites only a band")

        # step through recorded snapshots, cursor in sync with simulated time
        idx = list(range(0, len(TS), 5))
        if idx[-1] != len(TS) - 1:
            idx.append(len(TS) - 1)
        for n, k in enumerate(idx[1:]):
            if abs(TS[k] - T_RF) < 1e-9 or (TS[k] > T_RF and TS[idx[n]] < T_RF):
                pass
            self.play(psd.cursor_to(TS[k]),
                      c_mag.animate.become(sp.plot(Z, MAG[k], color=C_MAIN)),
                      c_in.animate.become(sp.plot(Z, INPH[k], color=C_ACCENT)),
                      run_time=0.8, rate_func=linear)
            if abs(TS[k] - T_RF) < 1e-9:
                StepCaption(self, "After RF: phase twists across the slice (signal cancels)")
        StepCaption(self, "Negative rephaser lobe unwinds the twist: slice in phase")
        self.wait(1.0)
        StepCaption(self, "Takeaway: RF bandwidth / gradient strength = slice thickness")
        self.wait(1.2)


if __name__ == "__main__" and "--selftest" in sys.argv:
    mag, inph = MAG[-1], INPH[-1]
    c = len(Z) // 2
    assert abs(TS[-1] - T_MAX) < 1e-9
    assert np.all(MAG[0] == 0)
    assert mag[c] > 0.9, mag[c]                       # ~90 deg flip at slice centre
    assert np.all(mag[np.abs(Z) > 0.6] < 0.2)          # little excitation outside slice
    k_end_rf = int(np.argmin(np.abs(TS - T_RF)))
    band = np.abs(Z) < 0.15
    assert inph[band].mean() > INPH[k_end_rf][band].mean()  # rephaser restores coherence
    assert inph[band].mean() > 0.8
    print("selftest ok")

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.