GdftR2¶
template <typename T1> class GdftR2
Non-uniform DFT operator extended with R2* (transverse relaxation) gradient maps.
Extends Gdft with spatial gradients of the field map, enabling a first-order Taylor expansion of the off-resonance phase term about each voxel center. The standard DFT signal model assumes a spatially constant field within each voxel; when \(R_2^*\) decay or \(\omega\) varies significantly across the FOV, intravoxel dephasing causes signal loss that the zeroth-order model cannot capture.
GdftR2 corrects this by including gradient terms \((G_x, G_y, G_z)\):
where \(\nabla\omega_k = (G_x, G_y, G_z)_k\) is the spatial gradient of the
field map at voxel \(k\) (computed by calcGradientMaps) and
\(\Delta\mathbf{r}\) is the displacement within the voxel.
When to use GdftR2 vs Gdft: prefer GdftR2 when \(R_2^*\) decay or the off-resonance field varies significantly across the FOV (e.g., near air-tissue interfaces). For slowly varying field maps, the simpler Gdft is sufficient and faster.
Use G * x for the forward transform and G / d for the adjoint.
See : Gdft for the base DFT without gradients.
Col<float> kx(4096), ky(4096), kz(4096, fill::zeros);
Col<float> ix(4096), iy(4096), iz(4096, fill::zeros);
Col<float> FM(4096, fill::zeros); // field map (rad/s)
Col<float> t(4096, fill::zeros); // readout times (s)
int Nx = 64, Ny = 64, Nz = 1;
GdftR2<float> G(4096, 4096, kx, ky, kz, ix, iy, iz, FM, t, Nx, Ny, Nz);
// Gradient maps are computed internally from FM via calcGradientMaps
Col<cx_float> kdata = G * image; // forward with R2* gradients
Col<cx_float> recon = G / kdata; // adjoint with R2* gradients
T1
: Floating-point precision type (float or double).
Variables¶
| Name | Description |
|---|---|
| kx | Number of k-space samples (output length of forward transform). |
| ky | k-space y-coordinates (length n1). |
| kz | k-space z-coordinates (length n1). |
| ix | Image-space x-coordinates (length n2). |
| iy | Image-space y-coordinates (length n2). |
| iz | Image-space z-coordinates (length n2). |
| FM | Off-resonance field map in rad/s (length n2). |
| Gx | R2* gradient map in the x-direction (length n2). |
| Gy | R2* gradient map in the y-direction (length n2). |
| Gz | R2* gradient map in the z-direction (length n2). |
| t | Per-sample readout time vector in seconds (length n1). |
| numX | Image x-dimension in pixels. |
| metalCtx | Opaque Metal DFT context handle (MetalDFTContext*); nullptr when T1 != float. |
Operators¶
| Name | Description |
|---|---|
| operator* | Forward DFT with R2 gradients: image -> k-space. d : Input image vector of length n2. Return* : Output k-space vector of length n1. |
| operator/ | Adjoint DFT with R2 gradients: k-space -> image. d : Input k-space vector of length n1. Return* : Output image vector of length n2. |
| operator* | Forward DFT with R2* gradients (forgeCol overload for Metal path). |
| operator/ | Adjoint DFT with R2* gradients (forgeCol overload for Metal path). |
Functions¶
| Name | Description |
|---|---|
| GdftR2 | Default constructor. |
| GdftR2 | Construct a GdftR2 operator with trajectory, field map, and image dimensions. |
| ~GdftR2 | Destructor — releases the Metal DFT context if allocated. |
| calcGradientMaps | Compute R2* gradient maps from the field map using finite differences. |
| Cd | Forward finite difference operator along dimension dim. d : Input vector. dim : Spatial dimension (0 = x, 1 = y, 2 = z). Return : Forward difference of d along dim. |
Variable Details¶
FM¶
forgeCol<T1> FM
Off-resonance field map in rad/s (length n2).
Gx¶
Col<T1> Gx
R2* gradient map in the x-direction (length n2).
Gy¶
Col<T1> Gy
R2* gradient map in the y-direction (length n2).
Gz¶
Col<T1> Gz
R2* gradient map in the z-direction (length n2).
ix¶
forgeCol<T1> ix
Image-space x-coordinates (length n2).
iy¶
forgeCol<T1> iy
Image-space y-coordinates (length n2).
iz¶
forgeCol<T1> iz
Image-space z-coordinates (length n2).
kx¶
forgeCol<T1> kx
Number of k-space samples (output length of forward transform).
Number of image pixels (input length of forward transform).
k-space x-coordinates (length n1).
ky¶
forgeCol<T1> ky
k-space y-coordinates (length n1).
kz¶
forgeCol<T1> kz
k-space z-coordinates (length n1).
metalCtx¶
void* metalCtx
Opaque Metal DFT context handle (MetalDFTContext*); nullptr when T1 != float.
numX¶
int numX, numY, numZ
Image x-dimension in pixels.
Image y-dimension in pixels.
Image z-dimension in pixels.
t¶
forgeCol<T1> t
Per-sample readout time vector in seconds (length n1).
Operator Details¶
operator*¶
Col<CxT1> operator*(const Col<CxT1>& d) const
Forward DFT with R2* gradients: image -> k-space.
d
: Input image vector of length n2.
Return
: Output k-space vector of length n1.
forgeCol<forgeComplex<T1>> operator*(const forgeCol<forgeComplex<T1>>& d) const
Forward DFT with R2* gradients (forgeCol overload for Metal path).
d
: Input image vector of length n2.
Return
: Output k-space vector of length n1.
operator/¶
Col<CxT1> operator/(const Col<CxT1>& d) const
Adjoint DFT with R2* gradients: k-space -> image.
d
: Input k-space vector of length n1.
Return
: Output image vector of length n2.
forgeCol<forgeComplex<T1>> operator/(const forgeCol<forgeComplex<T1>>& d) const
Adjoint DFT with R2* gradients (forgeCol overload for Metal path).
d
: Input k-space vector of length n1.
Return
: Output image vector of length n2.
Function Details¶
Cd¶
Col<T1> Cd(const Col<T1>& d, uword dim) const
Forward finite difference operator along dimension `dim.`
d
: Input vector.
dim
: Spatial dimension (0 = x, 1 = y, 2 = z).
Return
: Forward difference of d along dim.
GdftR2¶
GdftR2()
Default constructor. Produces an uninitialized operator.
GdftR2(uword a, uword b, const Col<T1>& k1, const Col<T1>& k2, const Col<T1>& k3, const Col<T1>& i1, const Col<T1>& i2, const Col<T1>& i3, const Col<T1>& f1, const Col<T1>& t1, const int numX, const int numY, const int numZ)
Construct a GdftR2 operator with trajectory, field map, and image dimensions.
a
: Number of k-space samples (n1, output size of forward transform).
b
: Number of image pixels (n2, input size of forward transform).
k1
: k-space x-coordinates, length a (units: cycles/FOV).
k2
: k-space y-coordinates, length a.
k3
: k-space z-coordinates, length a.
i1
: Image-space x-coordinates, length b (units: fraction of FOV).
i2
: Image-space y-coordinates, length b.
i3
: Image-space z-coordinates, length b.
f1
: Off-resonance field map, length b (units: rad/s).
t1
: Per-sample readout time vector, length a (units: s).
numX
: Image x-dimension (pixels).
numY
: Image y-dimension (pixels).
numZ
: Image z-dimension (pixels; use 1 for 2-D).
calcGradientMaps¶
void calcGradientMaps(Col<T1>& Gx, Col<T1>& Gy, Col<T1>& Gz)
Compute R2* gradient maps from the field map using finite differences.
Populates Gx, Gy, and Gz with the spatial gradients of the field map.
Gx
: Output: x-gradient of the field map (length n2).
Gy
: Output: y-gradient of the field map (length n2).
Gz
: Output: z-gradient of the field map (length n2).
~GdftR2¶
~GdftR2()
Destructor — releases the Metal DFT context if allocated.