Algorithmadvanced
Synthetic aperture focusing technique
Also called SAFT.
Focus a single moving transducer after the scan by summing its recorded echoes along the hyperbolic delay curve of each image point. A K-position scan costs O(K n^2) for n x n pixels.
- Solves
- Beamforming
- Time
- O(K n^2) worst
- Space
- O(1) extraO(K T) data
- Where
- K = the number of scan positions; T = the number of samples per trace; n = the number of pixels along one side of the image
- Model
- Real RAM
- Properties
- deterministicnot exactlinear in dataiterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Steven R. Doctor, Thomas E. Hall, Larry D. Reid, 1986
The synthetic aperture focusing technique (SAFT) makes a focused image from the traces of one transducer that is moved along a line. At each position the transducer sends a pulse and records the echoes at the same place. A point scatterer then appears in the raw scan (the B-scan) along a hyperbola, because its two-way time grows as the transducer moves away. SAFT sums, for each pixel, the traces along the hyperbola of that pixel. The echoes of a scatterer at the pixel add in phase, so the scan acts like one large focused aperture: the synthetic aperture. SAFT is the monostatic case, transmitter equal to receiver, of the total focusing method, which uses every pair of an array. It is the ultrasonic version of synthetic aperture radar focusing by back-projection.
In plain words
A small transducer has a wide beam, so it hears a small reflector from many places along its path. In the raw scan the reflector looks like a long arc, not a point. If you know where the reflector would be, you know exactly when each recording should contain its echo. Add up all recordings at those moments. At the right place the echoes line up and give a strong value. At a wrong place they do not line up and cancel. Doing this for every point turns each arc back into a small spot.
The problem
The input is traces recorded at the positions , as complex baseband (IQ) samples at , with the analytic RF signal . The medium has a constant speed of sound . The output is an image on an grid of pixels , large where a scatterer is. An optional half angle models the beam of the transducer: position can see the pixel only if .
The algorithm
SAFT(r_1 … r_K, q_1 … q_K, pixels, c, θ) ▷ returns the image I- 1
for each pixel p = (x, z) do - 2
acc ← 0 - 3
for k ← 1 to K do - 4
if θ is given and |x - x_k| > z tan θ then skip k - 5
t ← 2 |p - q_k| / c ▷ the hyperbola of p - 6
acc ← acc + SAMPLE(r_k, t) - 7
I(p) ← |acc| SAMPLE(b, t) ▷ analytic RF value of an IQ trace- 8
u ← (t - t_0) f_s; m ← ⌊u⌋; φ ← u - m - 9
if m < 0 or m + 1 ≥ T then return 0 - 10
return ((1 - φ) b[m] + φ b[m+1]) · e^{i 2π f_0 t}
Line L5 is the only geometry: the round trip from the position to the pixel and back on the same path. Line L4 drops positions that cannot see the pixel, which keeps noise from those traces out of the sum and makes the synthetic aperture grow with depth. SAMPLE interpolates the baseband trace and restores the carrier phase, as in TFM.
Example
The tests scan positions with a step of 0.15 mm, from to mm. The speed of sound is mm/us, MHz (wavelength 0.308 mm), MHz, and the Gaussian pulse envelope has us. One scatterer of amplitude 1 is at mm.
The echo arrives at us at the center position and at us at the end positions. The difference, us, is periods of the carrier, so the plain sum of the traces at a fixed time would cancel. Along the hyperbola of , all 21 terms are close to , and the pixel value is against for exact samples.
The width of the peak shrinks as the synthetic aperture grows. At mm, on 15 pixels from to mm with a step of 0.1 mm, the number of pixels at or above half of the peak is:
| positions K | 5 | 11 | 21 | 41 |
|---|---|---|---|---|
| aperture length (mm) | 0.6 | 1.5 | 3.0 | 6.0 |
| pixels at or above half the peak | 13 | 7 | 3 | 1 |
The unfocused B-scan, the envelope of each trace at the depth of the pixel without the hyperbola, is above half its peak at all 15 pixels. With a half angle of degrees, only the 11 positions with mm enter the sum at the scatterer, and its value is close to 11. These widths are measurements on this simulation.
Correctness
Before the modulus, SAFT is linear in the traces, and the code checks it against its exact adjoint. For a point scatterer and exact samples, every term at the scatterer equals the amplitude times , so the peak is times the number of positions in the sum. No pixel is larger, and with two positions at different the maximum is only at the scatterer. In the far field, a step between positions acts like an array with spacing , because the path is two-way; a step of at most a quarter wavelength gives no grating lobe at any angle. The proofs are in proofs/correctness.md. These results hold for the model: point scatterers, single scattering, a known constant and a straight scan line.
Proof: SAFT is linear in the data and focuses a point scatterer to a unique maximum equal to the number of positions in the sumfull
We prove three facts about SAFT as written on the main page (lines L1 to L10), for the monostatic pulse-echo model: one transducer at the positions , , point scatterers, constant speed of sound , and no spreading loss or beam pattern in the data. These are theorems about that model.
Setting. Trace is a complex baseband signal sampled at . SAMPLE (lines L8 to L10) returns with the linear interpolation of the samples, and outside the window. For a pixel , , let be the set of positions that pass line L4: all without a half angle, and the with with a half angle . SAFT returns with .
Theorem 1 (linearity and the adjoint). is linear in the traces. The map that adds with the weights and to the two samples read for each is its exact adjoint.
Proof. The set and the read time depend only on the geometry, not on the data. For fixed and , SAMPLE is a linear form with fixed weights, and its adjoint puts on sample . Summing over and over pixels keeps both properties.
Theorem 2 (a point scatterer). Let the traces be exact samples of one scatterer at , : with , a real envelope with for , and no interpolation error. Then with , and:
- ;
- for every ;
- if holds two positions with different , equality in part 2 holds only at .
Proof. At the read time the analytic value is , which gives the sum. At all are . The triangle inequality gives part 2. Equality needs for all , that is . For two positions with , subtracting the two squared equations gives , so , and then because both are positive.
Without a half angle, is all positions, so the peak is , the unique maximum. The test with measures , the loss coming from the interpolation.
Theorem 3 (no grating lobe for a step of at most a quarter wavelength). Consider a narrowband far-field point at the direction seen from the center of the scan and a pixel at the same range in the direction . Under the far-field approximation , the terms of the sum have the phase for a step between positions. This is the beam pattern of a uniform linear array with the spacing in units of the wavelength. By the grating lobe theorem of delay-and-sum beamforming with replaced by , there is no grating lobe for any when , that is , and for there is none when .
Proof. With and plus a constant, plus a constant phase, which is the steered array factor of a uniform line with spacing .
The factor 2 comes from the two-way path: moving the transducer by changes the path by up to .
Cost. Lines L3 to L6 run at most times per pixel, so an image costs in the real-RAM model, and the extra space is per pixel besides the samples of data.
Complexity
In the real-RAM model, lines L3 to L6 run at most times per pixel at each, so an image costs . With a half angle, the number of positions per pixel is about for a step , which grows with depth. The extra space is per pixel, besides the samples of data. Frequency-domain versions of SAFT (wavenumber migration) cost on a regular grid with an FFT.
Properties
- Linear in the data before the modulus, with an exact adjoint.
- Gain for a point scatterer against for one trace, when all positions see it.
- Lateral resolution set by the synthetic aperture, not by the transducer. A rule of thumb from the far-field approximation, as for strip-map synthetic aperture radar: the beam of a transducer of width spreads over an angle of about , so the synthetic aperture at depth is about long, and the two-way resolution does not depend on depth. This is a heuristic estimate, not a theorem of this page.
- Only one element fires and receives at a time, so the hardware is simple and the signal-to-noise ratio per trace is low.
Variants and improvements
- Frequency domain SAFT. For a straight scan and constant , the hyperbola sums become a remapping in the 2D Fourier domain of the B-scan, as in Stolt migration of seismic data, at a cost of FFTs.
- Arrays. With an array, TFM uses all transmit and receive pairs; SAFT uses only the diagonal, so it needs one channel.
- Virtual sources. In medical ultrasound, the focal point of a focused transmit can be treated as a virtual source, and the same summation extends the focus beyond the focal zone.
- Weights. Apodization over the positions, or a coherence factor per pixel, lowers side lobes.
- Curved surfaces and layers. The times in L5 can follow refracted paths through a coupling layer.
When to use it
Use SAFT when only one transducer is available, or when a mechanical scan is cheaper than an array, and the target does not move during the scan. It is used in ultrasonic testing of thick parts and in other one-channel pulse-echo systems. If an array is available, TFM or plane-wave compounding uses more of its data.
Pitfalls
- Motion and position errors. An error of a quarter wavelength in the position or a motion of the target changes the phase of the terms by about and destroys the focus.
- Step too large. The two-way path doubles the phase step, so the step must be smaller than for a receive-only array; see Theorem 3 of the proof.
- No half angle. Positions outside the beam add only noise. Without L4 the noise level of deep pixels grows.
- Wrong speed of sound. It moves and blurs the focus, worse for long synthetic apertures.
- RF interpolation. Linear interpolation of RF samples at a few samples per period lowers the gain; interpolate IQ data as in L10.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/saft/. The authors are listed in prov/4W5EDR.jsonl.
"""Synthetic aperture focusing technique (SAFT), time domain.
Units: millimetres, microseconds and megahertz; 1540 m/s is 1.54 mm/us.
One transducer sits in turn at the positions (x_k, 0), sends a pulse and
records the echo at the same position (monostatic, pulse-echo). Trace k is a
complex baseband (IQ) signal b_k sampled at t0 + q / fs; the analytic RF signal
is r_k(t) = b_k(t) exp(i 2 pi f0 t).
At each pixel p = (x, z), SAFT sums r_k at the two-way time 2 |p - (x_k, 0)| / c,
that is along the hyperbola that a point at p draws in the B-scan, and takes
the modulus. An optional half angle limits the sum to the positions that see
p inside the beam of the transducer: |x - x_k| <= z tan(half_angle).
"""
import cmath
import math
SOUND_SPEED = 1.54 # mm per microsecond
def scan_positions(k_count, step):
"""x positions of the scan, centered at x = 0."""
return [(k - (k_count - 1) / 2) * step for k in range(k_count)]
def simulate_bscan(positions, scatterers, f0, sigma_t, fs, t0, ns, c=SOUND_SPEED):
"""Monostatic traces of point scatterers (x, z, a) with a Gaussian envelope.
No spreading loss and no beam directivity: every position sees every point.
"""
traces = []
for xk in positions:
tr = [0j] * ns
for (sx, sz, amp) in scatterers:
tau = 2 * math.hypot(sx - xk, sz) / c
rot = amp * cmath.exp(-2j * math.pi * f0 * tau)
lo = max(0, math.ceil((tau - 5 * sigma_t - t0) * fs))
hi = min(ns - 1, math.floor((tau + 5 * sigma_t - t0) * fs))
for q in range(lo, hi + 1):
dt = t0 + q / fs - tau
tr[q] += rot * math.exp(-dt * dt / (2 * sigma_t * sigma_t))
traces.append(tr)
return traces
def sample(trace, t, t0, fs, f0):
"""The analytic RF value r(t) of a baseband trace, by linear interpolation."""
u = (t - t0) * fs # @line L8
q = math.floor(u)
phi = u - q
if q < 0 or q + 1 >= len(trace): # @line L9
return 0j
return ((1 - phi) * trace[q] + phi * trace[q + 1]) * cmath.exp(2j * math.pi * f0 * t) # @line L10
def saft_complex(traces, positions, xs, zs, t0, fs, f0, half_angle=None, c=SOUND_SPEED):
"""The complex SAFT image before the modulus; rows follow zs, columns follow xs."""
tan_half = None if half_angle is None else math.tan(half_angle)
image = []
for pz in zs: # @line L1
row = []
for px in xs:
acc = 0j # @line L2
for xk, tr in zip(positions, traces): # @line L3
if tan_half is not None and abs(px - xk) > pz * tan_half: # @line L4
continue
t = 2 * math.hypot(px - xk, pz) / c # @line L5
acc += sample(tr, t, t0, fs, f0) # @line L6
row.append(acc)
image.append(row)
return image
def saft(traces, positions, xs, zs, t0, fs, f0, half_angle=None, c=SOUND_SPEED):
"""The SAFT image |sum_k r_k(2 d_k(p))| on the grid xs by zs."""
return [[abs(v) for v in row]
for row in saft_complex(traces, positions, xs, zs, t0, fs, f0, half_angle, c)] # @line L7
def saft_adjoint(image, positions, xs, zs, t0, fs, f0, ns, half_angle=None, c=SOUND_SPEED):
"""The exact adjoint of saft_complex: a discrete monostatic pulse-echo model."""
tan_half = None if half_angle is None else math.tan(half_angle)
traces = [[0j] * ns for _ in positions]
for iz, pz in enumerate(zs):
for ix, px in enumerate(xs):
v = image[iz][ix]
for k, xk in enumerate(positions):
if tan_half is not None and abs(px - xk) > pz * tan_half:
continue
t = 2 * math.hypot(px - xk, pz) / c
u = (t - t0) * fs
q = math.floor(u)
if q < 0 or q + 1 >= ns:
continue
phi = u - q
w = v * cmath.exp(-2j * math.pi * f0 * t)
traces[k][q] += (1 - phi) * w
traces[k][q + 1] += phi * w
return traces
def envelope_bscan(traces, positions, xs, zs, t0, fs, f0, c=SOUND_SPEED):
"""The unfocused B-scan: the envelope of the trace nearest to each column, at t = 2 z / c."""
out = []
for pz in zs:
row = []
for px in xs:
k = min(range(len(positions)), key=lambda q: abs(positions[q] - px))
row.append(abs(sample(traces[k], 2 * pz / c, t0, fs, f0)))
out.append(row)
return out
test_saft.py 85 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/saft/. The authors are listed in prov/4W5EDR.jsonl.
import cmath
import math
import random
from saft import envelope_bscan, saft, saft_adjoint, saft_complex, scan_positions, simulate_bscan
F0, SIGMA, FS, T0, NS = 5.0, 0.1, 40.0, 7.0, 140
XS = [round(-0.7 + 0.1 * k, 10) for k in range(15)]
def test_peak_at_the_scatterer_with_gain_equal_to_the_number_of_positions() -> None:
pos = scan_positions(21, 0.15)
tr = simulate_bscan(pos, [(0.0, 6.0, 1.0)], F0, SIGMA, FS, T0, NS)
zs = [5.9, 5.95, 6.0, 6.05, 6.1]
img = saft(tr, pos, XS, zs, T0, FS, F0)
v, i, j = max((v, i, j) for i, row in enumerate(img) for j, v in enumerate(row))
assert (zs[i], XS[j]) == (6.0, 0.0)
assert abs(v - 21) < 0.01 * 21
def test_matches_the_analytic_sum_without_sampling() -> None:
pos = scan_positions(15, 0.2)
scat = [(0.0, 6.0, 1.0), (0.5, 6.3, 0.6)]
tr = simulate_bscan(pos, scat, F0, SIGMA, FS, T0, NS)
zs = [5.95, 6.0, 6.3]
got = saft_complex(tr, pos, XS[::2], zs, T0, FS, F0)
for a, pz in enumerate(zs):
for b, px in enumerate(XS[::2]):
want = 0j
for xk in pos:
t = 2 * math.hypot(px - xk, pz) / 1.54
for sx, sz, amp in scat:
dt = t - 2 * math.hypot(sx - xk, sz) / 1.54
want += amp * math.exp(-dt * dt / (2 * SIGMA ** 2)) * cmath.exp(2j * math.pi * F0 * dt)
assert abs(got[a][b] - want) < 0.01 * len(pos)
def test_adjoint() -> None:
rng = random.Random(4402)
pos = scan_positions(7, 0.3)
ns = 50
xs, zs = [-0.4, 0.0, 0.3], [4.0, 4.2]
t0 = 5.0
tr = [[complex(rng.gauss(0, 1), rng.gauss(0, 1)) for _ in range(ns)] for _ in pos]
img = [[complex(rng.gauss(0, 1), rng.gauss(0, 1)) for _ in xs] for _ in zs]
for half in (None, 0.12):
a = saft_complex(tr, pos, xs, zs, t0, FS, F0, half)
b = saft_adjoint(img, pos, xs, zs, t0, FS, F0, ns, half)
lhs = sum(a[i][j].conjugate() * img[i][j] for i in range(len(zs)) for j in range(len(xs)))
rhs = sum(tr[k][q].conjugate() * b[k][q] for k in range(len(pos)) for q in range(ns))
na = math.sqrt(sum(abs(v) ** 2 for row in a for v in row))
ni = math.sqrt(sum(abs(v) ** 2 for row in img for v in row))
assert abs(lhs - rhs) <= 1e-10 * na * ni
def test_longer_synthetic_aperture_gives_a_narrower_peak() -> None:
widths = []
for k_count in (5, 11, 21, 41):
pos = scan_positions(k_count, 0.15)
tr = simulate_bscan(pos, [(0.0, 6.0, 1.0)], F0, SIGMA, FS, T0, NS)
prof = saft(tr, pos, XS, [6.0], T0, FS, F0)[0]
widths.append(sum(1 for v in prof if v >= 0.5 * max(prof)))
assert all(w1 > w2 for w1, w2 in zip(widths, widths[1:]))
def test_narrower_than_the_unfocused_bscan() -> None:
pos = scan_positions(21, 0.15)
tr = simulate_bscan(pos, [(0.0, 6.0, 1.0)], F0, SIGMA, FS, T0, NS)
focused = saft(tr, pos, XS, [6.0], T0, FS, F0)[0]
raw = envelope_bscan(tr, pos, XS, [6.0], T0, FS, F0)[0]
assert sum(1 for v in focused if v >= 0.5 * max(focused)) <= 3
assert sum(1 for v in raw if v >= 0.5 * max(raw)) == len(XS)
def test_half_angle_limits_the_positions_in_the_sum() -> None:
pos = scan_positions(21, 0.15)
tr = simulate_bscan(pos, [(0.0, 6.0, 1.0)], F0, SIGMA, FS, T0, NS)
half = math.atan(0.8 / 6.0) # positions with |x_k| <= 0.8 mm: 11 of them
used = sum(1 for xk in pos if abs(xk) <= 6.0 * math.tan(half))
assert used == 11
v = saft(tr, pos, [0.0], [6.0], T0, FS, F0, half)[0][0]
assert abs(v - used) < 0.01 * used
History
Synthetic aperture radar showed that a moving antenna with a wide beam, together with coherent processing, can give a resolution much finer than its real aperture. SAFT applies the same idea to pulse-echo ultrasound. Doctor, Hall and Reid (1986) described how SAFT grew into a signal processing technology for ultrasonic testing. With digital arrays, the same summation over transmit and receive pairs became synthetic transmit aperture imaging in medicine and the total focusing method in nondestructive testing.
References
- Steven R. Doctor, Thomas E. Hall and Larry D. Reid, SAFT, the evolution of a signal processing technology for ultrasonic testing, NDT International 19(3), 1986, 163 to 167, the principle of SAFT (summing along the hyperbola of each point) and its development for inspection (general locator)
- Bruce W. Drinkwater and Paul D. Wilcox, Ultrasonic arrays for non-destructive evaluation: A review, NDT and E International 39(7), 2006, 525 to 541, the part on synthetic aperture processing of array data, of which SAFT is the monostatic case (general locator)
- Jorgen Arendt Jensen, Svetoslav Ivanov Nikolov, Kim Lokke Gammelmark and Morten Hogholm Pedersen, Synthetic aperture ultrasound imaging, Ultrasonics 44 (supplement), 2006, e5 to e15, the overview of synthetic aperture methods in medical ultrasound, including the monostatic case (general locator)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 4W5EDR Edit this page History Report an error Markdown