ncigt-fil
|
Functions | |
int | align_image_phase (COMPLEX *P, COMPLEX *N, int nz, int *sz, float **phzL, COMPLEX **phzC, int tmax, short int mode) |
int | calc_phase_correlation (Phase_Correlation_Args *arg) |
void | fit_line_to_phase (COMPLEX *v, float *mask, int N, float *ramp) |
int | unwrap_phase (double *b, float *mask, int N) |
This category of functions is designed to support image phase alignment, to idenitify and remove phase differences introduced by a shifts in kspace betwen two images,
This is useful in Nyquist ghost removal [O] to align data acquired on positive and negative readout gradients in EPI imaging, and in rigid image registration [P].
Hoge WS, Tan H, and Kraft RA, "A method to remove Nyquist ghosts from echo planar imaging (EPI) using UNFOLD." in Proc ISMRM 17th Scientific Meeting, pg 571, 2009.
Hoge WS, "A subspace identification extension to the phase correlation method,'' IEEE Trans. Medical Imaging, 22(2):277-280, Feb. 2003.
int align_image_phase | ( | COMPLEX * | P, |
COMPLEX * | N, | ||
int | nz, | ||
int * | sz, | ||
float ** | phzL, | ||
COMPLEX ** | phzC, | ||
int | tmax, | ||
short int | mode | ||
) |
Align the phase of two input images. This function will modify P and N so that when added coherently, the addition is constructive.
All dimensions beyond the first two will be corrected.
P | image associated with pos readout data |
N | image associated with neg readout data |
nz | number of input image dimensions |
sz | array of sizes for each dimension. Note, P and N need to be identical in size |
phzL | UNUSED |
phzC | UNUSED |
tmax | maximum number of threads |
mode | if mode=0, the phase shift is split equally to both P and N. if mode=1, the phase shift is applied only to N |
int calc_phase_correlation | ( | Phase_Correlation_Args * | arg | ) |
Calculates the phase correlation (normalized cross correlation) between two input matrices
C = conj(A).*B ./ abs(A.*conj(A))
So that the function is threadable, the input must be a pointer to the structure:
typedef struct{ COMPLEX *A; // input 1 COMPLEX *B; // input 2 int Nx; // number of rows in A,B int Ny; // number of cols in A,B COMPLEX *C; // output short int mode; // 0: split phase correction between A,B; 1: apply phase correction to B only } Phase_Correlation_Args;
void fit_line_to_phase | ( | COMPLEX * | v, |
float * | mask, | ||
int | N, | ||
float * | ramp | ||
) |
Solves a simple LMS problem to find the slope of a line fit to the (presumed) unwrapped phase of the input vector.
v | the input vector |
mask | a windowing vector of the same length, to provide a weighted LMS fit if needed. |
N | length of v |
ramp | the estimate of the line slope. |
int unwrap_phase | ( | double * | b, |
float * | mask, | ||
int | N | ||
) |
A 1D phase unwrapping algorithm.
b | input vector of phase (angle) values |
mask | optional binary weighting vector |
N | length of input vectors |