Algorithm Search⌘K

Algorithmadvanced

Universal back-projection

Also called Xu-Wang back-projection.

Reconstruct photoacoustic images by back-projecting b = 2p - 2t dp/dt, which combines the pressure and its time derivative, with solid angle weights. Exact for a sphere, cylinder or plane in 3D.

Time
O(D T + V D) worst
Space
O(D T) extra
Where
D = the number of detectors; T = the number of time samples per detector; V = the number of image points
Properties
deterministicexactlinear in dataiterative
Origin
Minghua Xu, Lihong V. Wang, 2005

Universal back-projection reconstructs the initial pressure p0p_0 of photoacoustic tomography from the pressure p(r0,t)p(r_0, t) that point detectors record on a surface around the object. Each detector signal is turned into the back-projection term b=2p−2t ∂p/∂tb = 2p - 2t\, \partial p / \partial t, which combines the pressure and its time derivative. Each image point then sums bb at the time of flight from every detector, weighted by the solid angle under which the point sees that detector element. Xu and Wang (2005) showed that this one formula is exact in three dimensions for a sphere, an infinite cylinder and an infinite plane, hence the name "universal". The cost is that of a back-projection: O(VD)O(V D) for VV image points and DD detectors, with no filter in the Fourier domain. In two dimensions the same formula is only approximate. Exact formulas for even dimensions have a different form (Finch, Haltmeier and Rakesh 2007).

In plain words

A short laser pulse heats the tissue a little, and every absorbing spot becomes a small source of sound. Detectors around the tissue record the sound for a short time.

To find the strength of the source at one point, look at each detector at the moment the sound from that point arrived there. Take twice the signal minus twice the time multiplied by the slope of the signal. Add these numbers over all the detectors, weighted by how large each detector looks from the point, and divide by the full solid angle. On a closed sphere, the parts that come from other points cancel exactly, and only the source at that point is left.

The problem

Model. The initial pressure p0p_0 has compact support inside the detection surface. The pressure p(x,t)p(x, t) solves the wave equation ptt=c2Δpp_{tt} = c^2 \Delta p with p(x,0)=p0(x)p(x, 0) = p_0(x) and zero initial velocity pt(x,0)=0p_t(x, 0) = 0. The speed cc is known and constant; the code uses c=1.54c = 1.54 mm/µs, the usual soft tissue convention of 1540 m/s.

Input. Samples p(r0,tk)p(r_0, t_k), tk=k Δtt_k = k\, \Delta t, at DD point detectors on a surface SS. Each detector has the position r0r_0, the unit normal n0n_0 that points toward the object, and the area dS0dS_0 of its surface element. The record must last until the sound from the far side has passed, 2R/c2R/c for a sphere of radius RR.

Output. p0(r)p_0(r) at VV image points inside SS.

Formula. With the solid angle element dΩ0=dS0 n0⋅(r−r0)/∣r−r0∣3d\Omega_0 = dS_0\, n_0 \cdot (r - r_0) / |r - r_0|^3 and the solid angle Ω0\Omega_0 of the whole surface seen from rr (4π4\pi for a sphere or a cylinder, 2π2\pi for a plane),

p0(r)=1Ω0∫Sb(r0,∣r−r0∣c) dΩ0,b(r0,t)=2p(r0,t)−2t ∂p(r0,t)∂t.p_0(r) = \frac{1}{\Omega_0} \int_S b\Big(r_0, \frac{|r - r_0|}{c}\Big)\, d\Omega_0, \qquad b(r_0, t) = 2p(r_0, t) - 2t\, \frac{\partial p(r_0, t)}{\partial t}.

The algorithm

  1. UBP(p, detectors, Δt, c, points)
  2. 1for each detector d: compute b_d from p_d
  3. 2b_d(t_k) ← 2 p_d(t_k) - 2 t_k (p_d(t_{k+1}) - p_d(t_{k-1})) / (2Δt)
  4. 3for each image point r
  5. 4for each detector d with position r0, normal n0 and area a
  6. 5dΩ ← a n0·(r - r0) / |r - r0|^3
  7. 6sum ← sum + dΩ · b_d(|r - r0| / c) ▷ linear interpolation in t
  8. 7Ω ← Ω + dΩ
  9. 8p0(r) ← sum / Ω ▷ or sum / Ω0
  10. 9return p0

Line L2 uses the central difference inside the record and one sided differences at its two ends, where the signal is zero. Line L6 reads bdb_d at the time of flight and interpolates linearly between samples; outside the record it uses zero. Line L8 divides by the sum of the solid angle elements. For a point inside a closed surface that sum is 4π4\pi up to the quadrature error, so the result is the same, and the division corrects part of the quadrature error. For a partial surface the choice matters (see Pitfalls).

The code places the detectors on a sphere at the nodes of a Gauss-Legendre rule in cos⁡θ\cos\theta times a uniform rule in the azimuth, and uses the weights of that product rule as the areas.

Example

A ball at the centre, by hand. Let p0(x)=exp⁡(−∣x∣2/(2s2))p_0(x) = \exp(-|x|^2 / (2 s^2)) with s=0.8s = 0.8 mm, a sphere of radius R=10R = 10 mm and c=1.54c = 1.54 mm/µs. The wave of a radial initial pressure has a closed form, and at a detector at distance RR it is

p(R,t)=(R−ct) g(R−ct)+(R+ct) g(R+ct)2R,g(u)=e−u2/(2s2).p(R, t) = \frac{(R - ct)\, g(R - ct) + (R + ct)\, g(R + ct)}{2R}, \qquad g(u) = e^{-u^2 / (2s^2)}.

For the image point at the centre, every detector is at the distance RR, so line L6 reads every signal at t=R/c=6.494t = R/c = 6.494 µs. There p=1.9×10−136p = 1.9 \times 10^{-136}, practically zero, and ∂p/∂t=−c/(2R)=−0.077\partial p / \partial t = -c/(2R) = -0.077 per µs. So b=0−2⋅6.494⋅(−0.077)=1.000b = 0 - 2 \cdot 6.494 \cdot (-0.077) = 1.000 at every detector. The solid angle elements sum to 4π4\pi, and line L8 gives p0(0)=1p_0(0) = 1, the true value. All the information comes from the derivative term, because the pressure itself is zero at that time.

A ball away from the centre. Move the centre of the ball to (2,−1,1.5)(2, -1, 1.5) mm and use 800 detectors (20 rings by 40 azimuths). With the exact bb from the closed form, the reconstruction at the centre of the ball, at (2.5,−1,1.5)(2.5, -1, 1.5) and at (3,0,1)(3, 0, 1) matches the true values 1, 0.8226 and 0.1724 to 10−1510^{-15}. With sampled data and central differences at Δt=0.02\Delta t = 0.02 µs, the value at the centre of the ball is 0.9989, and at Δt=0.04\Delta t = 0.04 µs it is 0.9956: the error falls by 4 when the step is halved. Dropping the term 2p2p and keeping only −2t ∂p/∂t-2t\, \partial p / \partial t changes the value at (2.5,−1,1.5)(2.5, -1, 1.5) by 0.004.

Correctness

The proof in proofs/correctness.md covers the sphere in three dimensions. Exactness for the cylinder and the plane is stated by Xu and Wang (2005) and is not proved there.

  1. Divergence form (theorem). With q=p/tq = p/t, b=−2t2 ∂tqb = -2t^2\, \partial_t q, and b dΩ0=2 n⋅∇r[q(r0,∣r−r0∣/c)] dS0b\, d\Omega_0 = 2\, n \cdot \nabla_r [q(r_0, |r - r_0|/c)]\, dS_0 with the outward normal nn. So the formula is 12πdiv⁡r∫Sn q dS0\frac{1}{2\pi} \operatorname{div}_r \int_S n\, q\, dS_0, the form of the formulas of Kunyansky (2007).
  2. Frequency form of the data (theorem). The sine and cosine transforms of the signal at r0r_0 are integrals of p0p_0 against cos⁡(k∣y−r0∣)/∣y−r0∣\cos(k|y - r_0|)/|y - r_0| and sin⁡(k∣y−r0∣)/∣y−r0∣\sin(k|y - r_0|)/|y - r_0|.
  3. The sphere identity (theorem). After integration over the sphere, the expansion of these kernels in spherical Bessel functions leaves the Wronskian jlyl′−jl′yl=1/(kR)2j_l y_l' - j_l' y_l = 1/(kR)^2 in every term. The kernel becomes sin⁡(k∣r−y∣)/∣r−y∣\sin(k|r - y|)/|r - y|, and the integral over kk is the Fourier inversion formula, so the formula returns p0(r)p_0(r).
  4. Sampling (theorem). The central difference and the linear interpolation each add an error of order Δt2\Delta t^2 to bb, so the sampled algorithm converges as Δt2\Delta t^2. The quadrature over the sphere adds a further error that is spectrally small for smooth signals (measurement: 10−1510^{-15} with 800 detectors for the ball).
Proof: On a sphere of detectors in 3D, universal back-projection is a divergence of a surface integral whose frequency kernel reduces, by the Wronskian of spherical Bessel functions, to the Fourier inversion formulafull

This file proves that the continuous formula of lines L1 to L8 is exact for a sphere of detectors in three dimensions, and bounds the error of the time sampling. Exactness for the infinite cylinder and the infinite plane is stated by Xu and Wang (2005) and is not proved here. The two-dimensional analogue is not exact.

Setting. B={x∈R3:∣x∣<R}B = \{x \in \mathbb{R}^3 : |x| < R\}, S=∂BS = \partial B, and n(z)=z/Rn(z) = z / R is the outward normal at z∈Sz \in S. The initial pressure p0p_0 is smooth with compact support K⊂BK \subset B. The pressure p(x,t)p(x, t) solves ptt=c2Δpp_{tt} = c^2 \Delta p with p(⋅,0)=p0p(\cdot, 0) = p_0 and pt(⋅,0)=0p_t(\cdot, 0) = 0. By Poisson's (Kirchhoff's) formula,

p(x,t)=∂t(t M(x,ct)),M(x,ρ)=14π∫S2p0(x+ρω) dω.p(x, t) = \partial_t \big(t\, M(x, ct)\big), \qquad M(x, \rho) = \frac{1}{4\pi} \int_{S^2} p_0(x + \rho \omega)\, d\omega.

The algorithm computes, for x∈Bx \in B,

U(x)=14π∫Sb(z,∣x−z∣/c) dΩx(z),b=2p−2t ∂tp,dΩx(z)=nin(z)⋅(x−z)∣x−z∣3 dS(z),U(x) = \frac{1}{4\pi} \int_S b\big(z, |x - z|/c\big)\, d\Omega_x(z), \qquad b = 2p - 2t\, \partial_t p, \qquad d\Omega_x(z) = \frac{n_{\text{in}}(z) \cdot (x - z)}{|x - z|^3}\, dS(z),

with the inward normal nin=−nn_{\text{in}} = -n (line L5 is dΩd\Omega, line L6 the product with bb, line L8 the division by Ω0=4π\Omega_0 = 4\pi). We use the Fourier transform f^(ξ)=∫f(y)e−2πiy⋅ξ dy\hat f(\xi) = \int f(y) e^{-2\pi i y \cdot \xi}\, dy.

Lemma 0 (the speed can be taken as 1). Put p~(z,ρ)=∂ρ(ρM(z,ρ))\tilde p(z, \rho) = \partial_\rho(\rho M(z, \rho)). Then p(z,t)=p~(z,ct)p(z, t) = \tilde p(z, ct), and b(z,∣x−z∣/c)=b~(z,∣x−z∣)b(z, |x - z|/c) = \tilde b(z, |x - z|) with b~(z,ρ)=2p~−2ρ ∂ρp~\tilde b(z, \rho) = 2\tilde p - 2\rho\, \partial_\rho \tilde p.

Proof. ∂t(tM(z,ct))=M+ct Mρ=∂ρ(ρM)\partial_t (t M(z, ct)) = M + ct\, M_\rho = \partial_\rho(\rho M) at ρ=ct\rho = ct, and t ∂t=ρ ∂ρt\, \partial_t = \rho\, \partial_\rho under ρ=ct\rho = ct. □\square

From now on c=1c = 1 and we drop the tildes.

Lemma 1 (support of the data). For z∈Sz \in S, t↦p(z,t)t \mapsto p(z, t) is smooth and vanishes outside an interval [δ,2R][\delta, 2R] with δ=dist⁡(S,K)>0\delta = \operatorname{dist}(S, K) > 0. The same holds for F(z,t)=t M(z,t)F(z, t) = t\, M(z, t), uniformly in z∈Sz \in S together with all derivatives.

Proof. F(z,t)=t4π∫S2p0(z+tω) dωF(z, t) = \frac{t}{4\pi} \int_{S^2} p_0(z + t\omega)\, d\omega is smooth in (z,t)(z, t), and the sphere of radius tt about zz meets KK only if δ≤t≤2R\delta \le t \le 2R. p=∂tFp = \partial_t F. Uniformity follows from the compactness of S×[0,2R]S \times [0, 2R]. □\square

Lemma 2 (divergence form). Let q(z,ρ)=p(z,ρ)/ρq(z, \rho) = p(z, \rho)/\rho. Then

U(x)=12π∫Sn(z)⋅∇x[q(z,∣x−z∣)] dS(z).U(x) = \frac{1}{2\pi} \int_S n(z) \cdot \nabla_x \big[ q(z, |x - z|) \big]\, dS(z).

Proof. b=2p−2ρ pρ=−2ρ2 ∂ρ(p/ρ)b = 2p - 2\rho\, p_\rho = -2\rho^2\, \partial_\rho (p/\rho). With d=∣x−z∣d = |x - z| and ∇xd=(x−z)/d\nabla_x d = (x - z)/d,

b(z,d) nin⋅(x−z)d3=−2 ∂ρq(z,d)  nin⋅x−zd=−2 nin⋅∇x[q(z,∣x−z∣)]=2 n⋅∇x[q(z,∣x−z∣)].b(z, d)\, \frac{n_{\text{in}} \cdot (x - z)}{d^3} = -2\, \partial_\rho q(z, d)\; n_{\text{in}} \cdot \frac{x - z}{d} = -2\, n_{\text{in}} \cdot \nabla_x [q(z, |x - z|)] = 2\, n \cdot \nabla_x [q(z, |x - z|)].

Integrate over SS and divide by 4π4\pi. □\square

Lemma 3 (frequency form of the data). For k>0k > 0 and z∈Sz \in S put Pc(z,k)=∫0∞p(z,t)cos⁡kt dtP_c(z, k) = \int_0^\infty p(z, t) \cos kt\, dt and Ps(z,k)=∫0∞p(z,t)sin⁡kt dtP_s(z, k) = \int_0^\infty p(z, t) \sin kt\, dt. Then, with ay(z)=cos⁡(k∣z−y∣)/∣z−y∣a_y(z) = \cos(k|z - y|)/|z - y| and sy(z)=sin⁡(k∣z−y∣)/∣z−y∣s_y(z) = \sin(k|z - y|)/|z - y|,

Pc(z,k)=k4π∫Bp0(y) sy(z) dy,Ps(z,k)=−k4π∫Bp0(y) ay(z) dy,P_c(z, k) = \frac{k}{4\pi} \int_B p_0(y)\, s_y(z)\, dy, \qquad P_s(z, k) = -\frac{k}{4\pi} \int_B p_0(y)\, a_y(z)\, dy,

and for d>0d > 0

q(z,d)=1π∫0∞[sin⁡kddPs(z,k)+cos⁡kddPc(z,k)] dk.q(z, d) = \frac{1}{\pi} \int_0^\infty \Big[ \frac{\sin kd}{d} P_s(z, k) + \frac{\cos kd}{d} P_c(z, k) \Big]\, dk.

The functions PcP_c and PsP_s decay faster than any power of kk, uniformly in zz.

Proof. p=∂tFp = \partial_t F and F(z,⋅)F(z, \cdot) has compact support in (0,∞)(0, \infty) by Lemma 1, so integration by parts gives Pc=k∫0∞Fsin⁡kt dtP_c = k \int_0^\infty F \sin kt\, dt and Ps=−k∫0∞Fcos⁡kt dtP_s = -k \int_0^\infty F \cos kt\, dt. In polar coordinates about zz, dy=t2 dt dωdy = t^2\, dt\, d\omega, so ∫0∞F(z,t)sin⁡kt dt=14π∫p0(y) sin⁡(k∣y−z∣)∣y−z∣ dy\int_0^\infty F(z, t) \sin kt\, dt = \frac{1}{4\pi} \int p_0(y)\, \frac{\sin(k|y - z|)}{|y - z|}\, dy, and the same with the cosine. The function ay(z)a_y(z) is bounded there because ∣y−z∣≥δ|y - z| \ge \delta on KK. The Fourier sine and cosine inversion formulas for the function p(z,⋅)p(z, \cdot), which is smooth with compact support in (0,∞)(0, \infty), give p(z,d)=2π∫0∞sin⁡(kd)Ps dk=2π∫0∞cos⁡(kd)Pc dkp(z, d) = \frac{2}{\pi} \int_0^\infty \sin(kd) P_s\, dk = \frac{2}{\pi} \int_0^\infty \cos(kd) P_c\, dk for d>0d > 0. Take the mean of the two and divide by dd. Repeated integration by parts gives the decay. □\square

Lemma 4 (the sphere identity). For x,y∈Bx, y \in B and k>0k > 0,

∫S(sy ∂νax−ay ∂νsx) dS=−4π sin⁡(k∣x−y∣)∣x−y∣,\int_S \big( s_y\, \partial_\nu a_x - a_y\, \partial_\nu s_x \big)\, dS = -4\pi\, \frac{\sin(k|x - y|)}{|x - y|},

where ∂ν\partial_\nu is the derivative in zz along n(z)n(z).

Proof. We use three classical facts about the spherical Bessel functions jlj_l, yly_l and the Legendre polynomials PlP_l. (i) For ∣x∣<∣z∣|x| < |z|, eik∣z−x∣∣z−x∣=ik∑l(2l+1)jl(k∣x∣)hl(k∣z∣)Pl(x^⋅z^)\frac{e^{ik|z - x|}}{|z - x|} = ik \sum_l (2l + 1) j_l(k|x|) h_l(k|z|) P_l(\hat x \cdot \hat z) with hl=jl+iylh_l = j_l + i y_l, and sin⁡(k∣z−x∣)k∣z−x∣=∑l(2l+1)jl(k∣x∣)jl(k∣z∣)Pl(x^⋅z^)\frac{\sin(k|z - x|)}{k|z - x|} = \sum_l (2l + 1) j_l(k|x|) j_l(k|z|) P_l(\hat x \cdot \hat z), with absolute and uniform convergence, also after one derivative in ∣z∣|z|, on compact subsets of ∣x∣<∣z∣|x| < |z|. (ii) ∫SPl(x^⋅z^)Pm(y^⋅z^) dS(z)=δlm4πR22l+1Pl(x^⋅y^)\int_S P_l(\hat x \cdot \hat z) P_m(\hat y \cdot \hat z)\, dS(z) = \delta_{lm} \frac{4\pi R^2}{2l + 1} P_l(\hat x \cdot \hat y). (iii) jl(u)yl′(u)−jl′(u)yl(u)=1/u2j_l(u) y_l'(u) - j_l'(u) y_l(u) = 1/u^2.

By (i), on SS: ax=−k∑(2l+1)jl(k∣x∣)yl(kR)Pl(x^⋅z^)a_x = -k \sum (2l + 1) j_l(k|x|) y_l(kR) P_l(\hat x \cdot \hat z) and sx=k∑(2l+1)jl(k∣x∣)jl(kR)Pl(x^⋅z^)s_x = k \sum (2l + 1) j_l(k|x|) j_l(kR) P_l(\hat x \cdot \hat z). Since ∂ν=∂/∂∣z∣\partial_\nu = \partial / \partial |z|, ∂νax=−k2∑(2l+1)jl(k∣x∣)yl′(kR)Pl\partial_\nu a_x = -k^2 \sum (2l + 1) j_l(k|x|) y_l'(kR) P_l and ∂νsx=k2∑(2l+1)jl(k∣x∣)jl′(kR)Pl\partial_\nu s_x = k^2 \sum (2l + 1) j_l(k|x|) j_l'(kR) P_l. Multiply the series, integrate term by term with (ii), and write Πl=jl(k∣x∣)jl(k∣y∣)Pl(x^⋅y^)\Pi_l = j_l(k|x|) j_l(k|y|) P_l(\hat x \cdot \hat y):

∫Ssy ∂νax dS=−4πR2k3∑(2l+1) jl(kR)yl′(kR) Πl,∫Say ∂νsx dS=−4πR2k3∑(2l+1) yl(kR)jl′(kR) Πl.\int_S s_y\, \partial_\nu a_x\, dS = -4\pi R^2 k^3 \sum (2l + 1)\, j_l(kR) y_l'(kR)\, \Pi_l, \qquad \int_S a_y\, \partial_\nu s_x\, dS = -4\pi R^2 k^3 \sum (2l + 1)\, y_l(kR) j_l'(kR)\, \Pi_l.

Their difference is −4πR2k3∑(2l+1)[jlyl′−jl′yl](kR) Πl=−4πk∑(2l+1)Πl-4\pi R^2 k^3 \sum (2l + 1) \big[j_l y_l' - j_l' y_l\big](kR)\, \Pi_l = -4\pi k \sum (2l + 1) \Pi_l by (iii), and by the second series of (i) with zz replaced by yy this is −4πk⋅sin⁡(k∣x−y∣)k∣x−y∣-4\pi k \cdot \frac{\sin(k|x - y|)}{k|x - y|}. □\square

The identity uses the sphere twice: the normal derivative is the radial derivative, and the Wronskian (iii) is the same number 1/(kR)21/(kR)^2 at every point of SS. On a general surface no such cancellation takes place.

Theorem 1 (exactness on the sphere). For every x∈Bx \in B, U(x)=p0(x)U(x) = p_0(x).

Proof. Fix x∈Bx \in B. In Lemma 2, insert the formula for qq from Lemma 3 and use ∇xf(∣x−z∣)=−∇zf(∣x−z∣)\nabla_x f(|x - z|) = -\nabla_z f(|x - z|), so that n⋅∇xn \cdot \nabla_x becomes −∂ν-\partial_\nu:

U(x)=−12π2∫0∞∫S[∂νsx Ps+∂νax Pc] dS dk.U(x) = -\frac{1}{2\pi^2} \int_0^\infty \int_S \big[ \partial_\nu s_x\, P_s + \partial_\nu a_x\, P_c \big]\, dS\, dk.

The derivative under the kk integral is allowed, and the order of the integrals may be changed, because ∣∂νsx∣|\partial_\nu s_x| and ∣∂νax∣|\partial_\nu a_x| are O(k+1)O(k + 1) uniformly for z∈Sz \in S and xx near a fixed point of BB, while PcP_c and PsP_s decay fast (Lemma 3). Insert PcP_c and PsP_s from Lemma 3 and use Fubini again (p0p_0 is bounded with compact support):

U(x)=−12π2∫0∞k4π∫Bp0(y)∫S(sy ∂νax−ay ∂νsx) dS dy dk=12π2∫0∞k∫Bp0(y)sin⁡(k∣x−y∣)∣x−y∣ dy dkU(x) = -\frac{1}{2\pi^2} \int_0^\infty \frac{k}{4\pi} \int_B p_0(y) \int_S \big( s_y\, \partial_\nu a_x - a_y\, \partial_\nu s_x \big)\, dS\, dy\, dk = \frac{1}{2\pi^2} \int_0^\infty k \int_B p_0(y) \frac{\sin(k|x - y|)}{|x - y|}\, dy\, dk

by Lemma 4. Finally, by Fourier inversion and polar coordinates ξ=σω\xi = \sigma \omega,

p0(x)=∫p^0(ξ)e2πix⋅ξ dξ=∫0∞σ2∫Bp0(y)∫S2e2πiσω⋅(x−y) dω dy dσ=∫0∞σ2∫Bp0(y) 4πsin⁡(2πσ∣x−y∣)2πσ∣x−y∣ dy dσ,p_0(x) = \int \hat p_0(\xi) e^{2\pi i x \cdot \xi}\, d\xi = \int_0^\infty \sigma^2 \int_B p_0(y) \int_{S^2} e^{2\pi i \sigma \omega \cdot (x - y)}\, d\omega\, dy\, d\sigma = \int_0^\infty \sigma^2 \int_B p_0(y)\, \frac{4\pi \sin(2\pi\sigma|x - y|)}{2\pi\sigma|x - y|}\, dy\, d\sigma,

and with k=2πσk = 2\pi\sigma the last expression is 12π2∫0∞k∫Bp0(y)sin⁡(k∣x−y∣)∣x−y∣ dy dk\frac{1}{2\pi^2} \int_0^\infty k \int_B p_0(y) \frac{\sin(k|x - y|)}{|x - y|}\, dy\, dk. □\square

Corollary (the solid angle). For x∈Bx \in B, ∫SdΩx=4π\int_S d\Omega_x = 4\pi. So dividing by the sum of the solid angle elements (the default of line L8) or by 4π4\pi gives the same continuous formula.

Proof. ∂ν1∣z−x∣=n⋅(x−z)∣x−z∣3\partial_\nu \frac{1}{|z - x|} = \frac{n \cdot (x - z)}{|x - z|^3}, so dΩx=−∂ν1∣z−x∣ dSd\Omega_x = -\partial_\nu \frac{1}{|z - x|}\, dS. Gauss's law gives ∫S∂ν1∣z−x∣ dS=−4π\int_S \partial_\nu \frac{1}{|z - x|}\, dS = -4\pi for xx inside SS. □\square

Theorem 2 (the sampled algorithm). Let the data be sampled at tk=k Δtt_k = k\, \Delta t on a record that covers [0,2R/c][0, 2R/c] with at least one more sample, let bkb_k be computed by line L1, and let bb be evaluated by linear interpolation. If p(z,⋅)p(z, \cdot) has three bounded derivatives, then for every tt in the record, the value used for b(z,t)b(z, t) has the error at most Δt2(13 tmax⁡max⁡∣∂t3p∣+18max⁡∣∂t2b∣)\Delta t^2 \big( \tfrac{1}{3}\, t_{\max} \max|\partial_t^3 p| + \tfrac{1}{8} \max|\partial_t^2 b| \big) plus the rounding. With exact bb, the only other error is the quadrature over SS.

Proof. By Lemma 1, p(z,⋅)p(z, \cdot) is zero near both ends of the record, so the one sided differences at the ends are exact. Inside, by Taylor's theorem, p(t+Δt)−p(t−Δt)2Δt−p′(t)\frac{p(t + \Delta t) - p(t - \Delta t)}{2\Delta t} - p'(t) is at most Δt26max⁡∣p′′′∣\frac{\Delta t^2}{6} \max|p'''|, so ∣bk−b(tk)∣≤2tkΔt26max⁡∣p′′′∣≤13tmax⁡Δt2max⁡∣p′′′∣|b_k - b(t_k)| \le 2 t_k \frac{\Delta t^2}{6} \max|p'''| \le \frac{1}{3} t_{\max} \Delta t^2 \max|p'''|. Linear interpolation of a function with a bounded second derivative has the error at most Δt28max⁡∣b′′∣\frac{\Delta t^2}{8} \max|b''|, and the interpolated value of the perturbed samples differs from the interpolated value of the exact ones by at most the largest perturbation. Line L6 is a weighted sum with ∑∣dΩ∣/Ω0\sum |d\Omega| / \Omega_0 bounded, so the error of UU is O(Δt2)O(\Delta t^2). □\square

In the test the error at the centre of a Gaussian ball falls from 4.4×10−34.4 \times 10^{-3} to 1.1×10−31.1 \times 10^{-3} when Δt\Delta t is halved from 0.04 to 0.02 µs, the factor 4 that Theorem 2 predicts (measurement). The quadrature over SS (Gauss-Legendre in cos⁡θ\cos\theta times the uniform rule in φ\varphi, 800 detectors) reproduces the ball to 10−1510^{-15} when bb is exact (measurement).

Theorem 3 (cost). With DD detectors, TT samples per detector and VV image points, the algorithm takes O(DT+VD)O(D T + V D) time and O(DT)O(D T) space in the real-RAM model.

Proof. Line L1 costs O(1)O(1) per sample. For each of the VV points, lines L4 to L7 cost O(1)O(1) per detector: one distance, one solid angle element and one interpolation. The array bb has DTD T entries. □\square

Complexity

In the real-RAM model, line L2 costs O(1)O(1) per sample, O(DT)O(D T) in total. Lines L4 to L7 cost O(1)O(1) per point and detector, O(VD)O(V D) in total. The array of bb needs O(DT)O(D T) space. For a volume of V=n3V = n^3 voxels and D=n2D = n^2 detectors this is O(n5)O(n^5), the cost of a back-projection. Fast methods based on the nonuniform FFT or on series expansions for special geometries reduce it.

Properties

  • Exact on the sphere in 3D (theorem), for smooth p0p_0 with support inside the sphere. Exact for the infinite cylinder and plane (theorem of Xu and Wang 2005, not proved here).
  • Approximate in 2D (stated in the literature, not proved here). In 2D the wave has a tail, and the exact formulas of Finch, Haltmeier and Rakesh (2007) involve an integral over all later times.
  • No Fourier filter. The only filtering is the time derivative in bb, a local operation. This is what makes the method fast and simple to implement on any detector layout.
  • Linear in the data. The map from the data to the image is linear.
  • Both terms matter (measurement). Far from the detectors (ct≫c t \gg the wavelength) the term −2t ∂p/∂t-2t\, \partial p / \partial t dominates and the term 2p2p is a small correction. In the example the term 2p2p changes the value by 0.004.
  • Convergence in Δt2\Delta t^2 (theorem and measurement).

Variants and improvements

  • Far field form. Dropping 2p2p gives b≈−2t ∂p/∂tb \approx -2t\, \partial p / \partial t, the form of many earlier back-projection methods, valid when the detector is many wavelengths from the source.
  • Other exact formulas for the sphere. Finch, Patch and Rakesh (2004) proved exact formulas in odd dimensions, and Kunyansky (2007) found a family of formulas in divergence form. Item 1 of the correctness section shows that universal back-projection on the sphere can be written in that form.
  • Even dimensions. For line detectors, which integrate the pressure along a line and reduce the problem to 2D, use the formulas of Finch, Haltmeier and Rakesh (2007) instead of the 2D form of this method.
  • Time reversal. Solve the wave equation backward in time with the measured data as boundary values. It works for any closed surface and for a variable speed of sound, at the cost of a full wave solver.
  • Iterative and model based methods handle limited view, a variable speed of sound, the detector size and the bandwidth of the detector.
  • Weighting for partial surfaces. Dividing by the sum of the solid angles that the detectors actually cover, as in line L8, partly corrects for missing parts of the surface.

When to use it

Use it when the detectors surround the object well on a sphere, a long cylinder or a large plane, the speed of sound is close to constant, and a fast direct method is needed, for example as the first image of an iterative method. Do not use it as an exact method in 2D, with a strongly varying speed of sound, or with a small aperture. Use time reversal or an iterative method there.

Pitfalls

  • Limited view. With detectors on the upper half of the sphere only, the reconstruction of the ball at its centre is 0.577 instead of 1 when divided by 4π4\pi. Divided by the sum of the solid angle elements it is 1.000 at the centre, but 0.812 instead of 0.823 and 0.149 instead of 0.172 at the other two points: the shape is wrong (measurement).
  • Normal direction. n0n_0 must point toward the object. The wrong sign changes the sign of the image.
  • Too short a record. The signal from the far side of a sphere arrives at 2R/c2R/c. A shorter record cuts the back-projection for points near the far side.
  • Noisy derivative. The time derivative amplifies high frequency noise. Filter the data in time, with the band of the detector, before line L2.
  • Wrong time origin. tt in bb is the time since the laser pulse. A delay in the trigger changes both the time of flight and the factor tt in bb.
  • Using the 3D formula in 2D. It gives artefacts and wrong values that do not go away when the sampling is refined.

Implementations

The Python code places the detectors on a sphere, simulates the pressure of a Gaussian ball from its closed form, computes bb by central differences, and back-projects with linear interpolation. It needs no shared helper. The tests check the Gauss-Legendre rule, the solid angles of the sphere, that the closed form solves the wave equation with zero initial velocity, exact reconstruction with the exact bb, the hand example at the centre, the need for both terms of bb, the linearity, the Δt2\Delta t^2 convergence with sampled data, and the limited view of a half sphere.

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.

universal_back_projection.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/universal-back-projection/. The authors are listed in prov/4TK0K9.jsonl.
"""Universal back-projection for photoacoustic tomography in 3D (Xu and Wang 2005).

The initial pressure p0 starts a wave p(r, t) with speed c and zero initial
velocity. Point detectors on a closed surface record p(r0, t). The formula

    p0(r) = (1 / Omega0) * sum over detectors of b(r0, |r - r0| / c) dOmega0,
    b(r0, t) = 2 p(r0, t) - 2 t dp/dt(r0, t),

with the solid angle dOmega0 of each detector element seen from r, is exact for
a sphere, a cylinder and a plane in 3D (Xu and Wang 2005; Finch, Patch and
Rakesh 2004 for the sphere). This file uses a sphere of detectors.

Units in the tests: lengths in mm, times in microseconds, c = 1.54 mm/us.
"""

import math


def gauss_legendre(n):
    """Nodes and weights of the n point Gauss-Legendre rule on [-1, 1]."""
    xs, ws = [], []
    for i in range(1, n + 1):
        x = math.cos(math.pi * (i - 0.25) / (n + 0.5))
        dp = 1.0
        for _ in range(100):
            p0, p1 = 1.0, x
            for k in range(2, n + 1):
                p0, p1 = p1, ((2 * k - 1) * x * p1 - (k - 1) * p0) / k
            dp = n * (x * p1 - p0) / (x * x - 1.0)
            dx = p1 / dp
            x -= dx
            if abs(dx) < 1e-15:
                break
        xs.append(x)
        ws.append(2.0 / ((1.0 - x * x) * dp * dp))
    return xs, ws


def sphere_detectors(radius, n_theta, n_phi):
    """Detector elements on a sphere about the origin.

    Returns a list of (position, inward unit normal, area). The areas are the
    weights of the Gauss-Legendre rule in cos(theta) times the uniform rule in phi,
    so they integrate smooth functions on the sphere with spectral accuracy.
    """
    us, ws = gauss_legendre(n_theta)
    dets = []
    for u, w in zip(us, ws):
        st = math.sqrt(1.0 - u * u)
        for k in range(n_phi):
            ph = 2.0 * math.pi * k / n_phi
            n_out = (st * math.cos(ph), st * math.sin(ph), u)
            pos = tuple(radius * a for a in n_out)
            inward = tuple(-a for a in n_out)
            dets.append((pos, inward, w * (2.0 * math.pi / n_phi) * radius * radius))
    return dets


def solid_angle_element(r, det):
    """dOmega0 = dS0 * (n0 . (r - r0)) / |r - r0|^3 with the normal n0 toward r."""
    pos, normal, area = det
    d = [r[i] - pos[i] for i in range(3)]
    dist = math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2])
    return area * (normal[0] * d[0] + normal[1] * d[1] + normal[2] * d[2]) / dist ** 3, dist


def back_projection_term(p, dt):
    """b(t_k) = 2 p(t_k) - 2 t_k dp/dt(t_k) for samples p[k] at t_k = k dt.

    The time derivative is a central difference inside and a one sided one at the ends.
    """
    n = len(p)
    b = [0.0] * n
    for k in range(n):
        if 0 < k < n - 1:
            dpdt = (p[k + 1] - p[k - 1]) / (2.0 * dt)
        elif k == 0:
            dpdt = (p[1] - p[0]) / dt
        else:
            dpdt = (p[k] - p[k - 1]) / dt
        b[k] = 2.0 * p[k] - 2.0 * (k * dt) * dpdt  # @line L2
    return b


def sample(b, dt, t):
    """Linear interpolation of the samples b[k] at t_k = k dt; zero outside the record."""
    x = t / dt
    k = int(math.floor(x))
    if k < 0 or k >= len(b) - 1:
        return 0.0
    f = x - k
    return (1.0 - f) * b[k] + f * b[k + 1]


def universal_back_projection(data, dets, dt, c, points, omega0=None):
    """Reconstruct p0 at the given points from sampled data[d][k] = p(r0_d, k dt).

    omega0 is the solid angle of the whole surface seen from the point (4 pi for a
    closed surface); None uses the sum of the solid angle elements instead.
    """
    bs = [back_projection_term(p, dt) for p in data]  # @line L1
    out = []
    for r in points:  # @line L3
        total, omega = 0.0, 0.0
        for det, b in zip(dets, bs):  # @line L4
            d_omega, dist = solid_angle_element(r, det)  # @line L5
            total += d_omega * sample(b, dt, dist / c)  # @line L6
            omega += d_omega  # @line L7
        out.append(total / (omega if omega0 is None else omega0))  # @line L8
    return out  # @line L9


def universal_back_projection_exact_b(b_func, dets, c, points, omega0=4.0 * math.pi):
    """The same sum with b(r0, t) given as a function, without time sampling."""
    out = []
    for r in points:
        total = 0.0
        for det in dets:
            d_omega, dist = solid_angle_element(r, det)
            total += d_omega * b_func(det[0], dist / c)
        out.append(total / omega0)
    return out


# A Gaussian ball p0(x) = exp(-|x - centre|^2 / (2 s^2)) has a closed form wave.

def ball_initial_pressure(x, centre, s):
    d = math.dist(x, centre)
    return math.exp(-d * d / (2.0 * s * s))


def ball_pressure(x, t, centre, s, c):
    """p(x, t) = ((d - ct) g(d - ct) + (d + ct) g(d + ct)) / (2 d) with g(u) = exp(-u^2 / (2 s^2))."""
    d = math.dist(x, centre)
    a, b = d - c * t, d + c * t
    return (a * math.exp(-a * a / (2.0 * s * s)) + b * math.exp(-b * b / (2.0 * s * s))) / (2.0 * d)


def ball_pressure_dt(x, t, centre, s, c):
    """The exact time derivative of ball_pressure."""
    d = math.dist(x, centre)
    a, b = d - c * t, d + c * t

    def h(u):
        return (1.0 - u * u / (s * s)) * math.exp(-u * u / (2.0 * s * s))

    return c * (h(b) - h(a)) / (2.0 * d)


def ball_data(dets, centre, s, c, dt, nt, window=7.0):
    """Sampled pressure p(r0, k dt) for k < nt at every detector, zero where |d - ct| > window s."""
    data = []
    for pos, _, _ in dets:
        d = math.dist(pos, centre)
        row = [0.0] * nt
        k_lo = max(0, int((d - window * s) / (c * dt)))
        k_hi = min(nt, int((d + window * s) / (c * dt)) + 2)
        for k in range(k_lo, k_hi):
            row[k] = ball_pressure(pos, k * dt, centre, s, c)
        data.append(row)
    return data
test_universal_back_projection.py 135 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/universal-back-projection/. The authors are listed in prov/4TK0K9.jsonl.

import math
import random

from universal_back_projection import (back_projection_term, ball_data, ball_initial_pressure, ball_pressure,
                                       ball_pressure_dt, gauss_legendre, sample, solid_angle_element,
                                       sphere_detectors, universal_back_projection,
                                       universal_back_projection_exact_b)

R, C, S = 10.0, 1.54, 0.8  # mm, mm/us, mm
CENTRE = (2.0, -1.0, 1.5)
POINTS = [CENTRE, (2.5, -1.0, 1.5), (3.0, 0.0, 1.0), (0.0, 0.0, 0.0)]


def _b_exact(centre):
    def b(r0, t):
        return 2.0 * ball_pressure(r0, t, centre, S, C) - 2.0 * t * ball_pressure_dt(r0, t, centre, S, C)
    return b


def test_gauss_legendre_integrates_polynomials_exactly() -> None:
    n = 7
    xs, ws = gauss_legendre(n)
    for deg in range(2 * n):
        want = 0.0 if deg % 2 else 2.0 / (deg + 1)
        assert abs(sum(w * x ** deg for x, w in zip(xs, ws)) - want) < 1e-13


def test_solid_angles_of_the_sphere() -> None:
    dets = sphere_detectors(R, 20, 40)
    inside = sum(solid_angle_element((0.0, 0.0, 0.0), d)[0] for d in dets)
    assert abs(inside - 4.0 * math.pi) < 1e-12
    off = sum(solid_angle_element((3.0, -2.0, 4.0), d)[0] for d in dets)
    assert abs(off - 4.0 * math.pi) < 1e-3
    outside = sum(solid_angle_element((14.0, 0.0, 0.0), d)[0] for d in dets)
    assert abs(outside) < 1e-3


def test_the_forward_model_starts_at_rest_from_the_initial_pressure() -> None:
    x = (4.0, 1.0, -2.0)
    for y in ((2.3, -0.8, 1.1), (2.9, -1.4, 2.0), (5.0, 5.0, 5.0)):
        assert abs(ball_pressure(y, 0.0, CENTRE, S, C) - ball_initial_pressure(y, CENTRE, S)) < 1e-14
        assert abs(ball_pressure_dt(y, 0.0, CENTRE, S, C)) < 1e-14
    # The wave equation p_tt = c^2 (p_xx + p_yy + p_zz) by finite differences.
    t, h = 1.7, 1e-3
    p = lambda y, s: ball_pressure(y, s, CENTRE, S, C)
    ptt = (p(x, t + h) - 2 * p(x, t) + p(x, t - h)) / h ** 2
    lap = 0.0
    for i in range(3):
        e = [0.0, 0.0, 0.0]
        e[i] = h
        xp = tuple(x[j] + e[j] for j in range(3))
        xm = tuple(x[j] - e[j] for j in range(3))
        lap += (p(xp, t) - 2 * p(x, t) + p(xm, t)) / h ** 2
    assert abs(ptt - C * C * lap) < 1e-4 * max(1.0, abs(ptt))
    # The time derivative agrees with a difference quotient.
    d = (p(x, t + h) - p(x, t - h)) / (2 * h)
    assert abs(d - ball_pressure_dt(x, t, CENTRE, S, C)) < 1e-6


def test_exact_data_on_a_sphere_give_the_initial_pressure() -> None:
    dets = sphere_detectors(R, 20, 40)
    out = universal_back_projection_exact_b(_b_exact(CENTRE), dets, C, POINTS)
    for value, r in zip(out, POINTS):
        assert abs(value - ball_initial_pressure(r, CENTRE, S)) < 1e-9


def test_centred_ball_hand_example() -> None:
    # At t = R / c the detector sees p = 0 and dp/dt = -c / (2R), so b = 1.
    z = (0.0, 0.0, 0.0)
    t = R / C
    assert abs(ball_pressure((R, 0.0, 0.0), t, z, S, C)) < 1e-100
    assert abs(ball_pressure_dt((R, 0.0, 0.0), t, z, S, C) + C / (2 * R)) < 1e-15
    dets = sphere_detectors(R, 6, 12)
    assert abs(universal_back_projection_exact_b(_b_exact(z), dets, C, [z])[0] - 1.0) < 1e-12


def test_both_terms_of_b_are_needed() -> None:
    dets = sphere_detectors(R, 20, 40)
    r = POINTS[1]
    far = universal_back_projection_exact_b(lambda r0, t: -2.0 * t * ball_pressure_dt(r0, t, CENTRE, S, C), dets, C, [r])[0]
    assert abs(far - ball_initial_pressure(r, CENTRE, S)) > 3e-3


def test_back_projection_term_of_a_linear_signal() -> None:
    dt = 0.05
    p = [0.7 + 0.3 * k * dt for k in range(20)]
    b = back_projection_term(p, dt)
    for value in b:
        assert abs(value - 1.4) < 1e-12


def test_sample_interpolates_linearly_and_is_zero_outside() -> None:
    b = [0.0, 1.0, 4.0, 9.0]
    assert abs(sample(b, 0.5, 0.75) - 2.5) < 1e-15
    assert sample(b, 0.5, -0.1) == 0.0
    assert sample(b, 0.5, 2.0) == 0.0


def test_the_back_projection_is_linear_in_the_data() -> None:
    rng = random.Random(4401)
    dets = sphere_detectors(R, 4, 8)
    nt, dt = 40, 0.4
    d1 = [[rng.gauss(0, 1) for _ in range(nt)] for _ in dets]
    d2 = [[rng.gauss(0, 1) for _ in range(nt)] for _ in dets]
    mix = [[2.0 * a - 3.0 * b for a, b in zip(r1, r2)] for r1, r2 in zip(d1, d2)]
    pts = [(1.0, 2.0, -1.0), (0.0, -3.0, 0.5)]
    u1 = universal_back_projection(d1, dets, dt, C, pts, 4 * math.pi)
    u2 = universal_back_projection(d2, dets, dt, C, pts, 4 * math.pi)
    um = universal_back_projection(mix, dets, dt, C, pts, 4 * math.pi)
    for a, b, m in zip(u1, u2, um):
        assert abs(m - (2.0 * a - 3.0 * b)) < 1e-10


def test_sampled_data_converge_with_the_square_of_the_time_step() -> None:
    dets = sphere_detectors(R, 20, 40)
    pts = POINTS[:2]
    errors = []
    for dt in (0.04, 0.02):
        nt = int(2 * R / C / dt) + 3
        data = ball_data(dets, CENTRE, S, C, dt, nt)
        out = universal_back_projection(data, dets, dt, C, pts)
        errors.append(max(abs(v - ball_initial_pressure(r, CENTRE, S)) for v, r in zip(out, pts)))
    assert errors[1] < 2e-3
    assert 3.0 < errors[0] / errors[1] < 5.0


def test_half_the_sphere_is_not_enough() -> None:
    dets = [d for d in sphere_detectors(R, 20, 40) if d[0][2] > 0.0]
    out = universal_back_projection_exact_b(_b_exact(CENTRE), dets, C, POINTS[:3])
    assert abs(out[0] - 0.5771) < 1e-3
    errs = [abs(v - ball_initial_pressure(r, CENTRE, S)) for v, r in zip(out, POINTS)]
    assert max(errs) > 0.4

History

Finch, Patch and Rakesh (2004) proved exact inversion formulas for spherical means centred on a sphere in odd dimensions, which covers photoacoustic data on a sphere in 3D. Xu and Wang (2005) derived the universal back-projection formula from the Green's function of the wave equation and showed that it is exact for the sphere, the cylinder and the plane. Kunyansky (2007) gave a family of explicit formulas for the sphere, and Finch, Haltmeier and Rakesh (2007) gave exact formulas for even dimensions. The survey of Kuchment and Kunyansky (2008) and the review of Xu and Wang (2006) put the method among the other reconstruction methods.

References

  1. Minghua Xu and Lihong V. Wang, Universal back-projection algorithm for photoacoustic computed tomography, Physical Review E 71, 2005, 016706, the back-projection term b = 2p - 2t dp/dt, the solid angle weights, and exactness for spherical, cylindrical and planar surfaces (general locator)
  2. David Finch, Sarah K. Patch and Rakesh, Determining a function from its mean values over a family of spheres, SIAM Journal on Mathematical Analysis 35(5), 2004, 1213, exact inversion formulas for spherical means centred on a sphere in odd dimensions (general locator)
  3. David Finch, Markus Haltmeier and Rakesh, Inversion of spherical means and the wave equation in even dimensions, SIAM Journal on Applied Mathematics 68(2), 2007, 392, exact inversion formulas for the sphere in even dimensions, including 2D (general locator)
  4. Leonid A. Kunyansky, Explicit inversion formulae for the spherical mean Radon transform, Inverse Problems 23(1), 2007, 373, inversion formulas for the sphere in divergence form (general locator)
  5. Peter Kuchment and Leonid Kunyansky, Mathematics of thermoacoustic tomography, European Journal of Applied Mathematics 19(2), 2008, 191, survey of the model with zero initial velocity, uniqueness, inversion formulas and limited data (general locator)
  6. Minghua Xu and Lihong V. Wang, Photoacoustic imaging in biomedicine, Review of Scientific Instruments 77, 2006, 041101, review of photoacoustic reconstruction methods including back-projection (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.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example