ncigt-fil
Functions
Image Phase Alignment Functions

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)
 

Detailed Description

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].

  1. 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.

  2. Hoge WS, "A subspace identification extension to the phase correlation method,'' IEEE Trans. Medical Imaging, 22(2):277-280, Feb. 2003.

Function Documentation

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.

Parameters
Pimage associated with pos readout data
Nimage associated with neg readout data
nznumber of input image dimensions
szarray of sizes for each dimension. Note, P and N need to be identical in size
phzLUNUSED
phzCUNUSED
tmaxmaximum number of threads
modeif 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.

Parameters
vthe input vector
maska windowing vector of the same length, to provide a weighted LMS fit if needed.
Nlength of v
rampthe estimate of the line slope.
int unwrap_phase ( double *  b,
float *  mask,
int  N 
)

A 1D phase unwrapping algorithm.

Parameters
binput vector of phase (angle) values
maskoptional binary weighting vector
Nlength of input vectors