ncigt-fil
|
Functions | |
int | filter_t_init (int n, int x, int y, int c, double *a, double *b, filter_t_obj *obj) |
int | filter_t_quit (filter_t_obj *obj) |
int | filter_t_step (filter_t_obj *obj, COMPLEX *dataI, COMPLEX *dataO) |
void | prep_unfold_dc (short Nx, short N_acq, short Nf, short ncoils, fil_fft_mngr *mngr, KCOORD *kline_o, KCOORD *kline_e, short fr1, COMPLEX *data, COMPLEX *buf_lg, COMPLEX *buf_sm, float *filter_dc, float *filter_dckept, short *near_dc, short filt_w, short Nf_proc, KCOORD *kline_c, COMPLEX *data_dc) |
int | set_nfproc (short Nf, short flag) |
void | setup_unfold (SCAN_INFO *hdr_ptr, int Nt, float *filter_dc, float *filter_ny, float *filter_dckept, float *filter_dcny, short *near_dc, short *filt_w_ptr) |
void | synth_frames (short ncoils, short Nf, short Nz, short Ny, short Nx, COMPLEX *data_in, short Nf_proc, COMPLEX *data_out) |
void | synth_frames_cine (short ncoils, short Nf_full, short fr1, short Nf, short N_acq, short Nx, short ky, KCOORD *kline_o, KCOORD *kline_e, COMPLEX *data_in, short Nf_proc, COMPLEX *data_out) |
void | transfer_dc (short dir, short ncoils, short Nf, short Nz, short Ny, short Nx, short filt_w, short *near_dc, float *filter, COMPLEX *lg_array, COMPLEX *sm_array) |
void | unfold_filter (short ncoils, short Nf, short Nz, short Ny, short Nx, float *filter, COMPLEX *data) |
void | unfold_recombine (short Nx, short Ny_proc, short Nz_proc, short Nf_proc, short *near_dc, short filt_w, COMPLEX *dc, COMPLEX *full) |
The UNFOLD approach employs temporal domain processing to suppress artifacts.
The method is described in "Unaliasing by Fourier-encoding the overlaps using the temporal dimension" (UNFOLD). Bruno Madore, Gary H. Glover, and Norbert J. Pelc. Magn Reson Med. 42(5):813-826, Nov 1999. [DOI]
int filter_t_init | ( | int | n, |
int | x, | ||
int | y, | ||
int | c, | ||
double * | a, | ||
double * | b, | ||
filter_t_obj * | obj | ||
) |
An implementation of a Direct Form II digital filter, for processing a temporal series of 2D images along the temporal domain.
The filter is initiallized by specifying the number of filter taps, and the set of filter coefficients "a" (feedback) and "b" (feedforward).
filter input state output a[0] b[0] I -+---------> w[0] --------->+---> O | | | | a[1] v b[1] | +<--------- w[1] --------->+ | v | . . . . . . . . . | | | | a[n] v b[n] | +<--------- w[n] --------->+
Notes:
n | number of temporal filter taps |
x | size of 1st dimension of input data, Nx |
y | size of 2nd dimension of input data, Ny |
c | size of 3rd dimension of input data, Nc |
a | feedback coefficients |
b | feedforward coefficients |
obj | the output filter object that is initiated by the function call |
int filter_t_quit | ( | filter_t_obj * | obj | ) |
release all memory associated the temporal-domain filter bank object.
int filter_t_step | ( | filter_t_obj * | obj, |
COMPLEX * | dataI, | ||
COMPLEX * | dataO | ||
) |
cycle the temporal filter bank through one step.
Note: the filter bank object should be initialized using filter_t_init() prior to this call.
obj | an FIL filter bank object. |
dataI | input data |
dataO | output data |
void prep_unfold_dc | ( | short | Nx, |
short | N_acq, | ||
short | Nf, | ||
short | ncoils, | ||
fil_fft_mngr * | mngr, | ||
KCOORD * | kline_o, | ||
KCOORD * | kline_e, | ||
short | fr1, | ||
COMPLEX * | data, | ||
COMPLEX * | buf_lg, | ||
COMPLEX * | buf_sm, | ||
float * | filter_dc, | ||
float * | filter_dckept, | ||
short * | near_dc, | ||
short | filt_w, | ||
short | Nf_proc, | ||
KCOORD * | kline_c, | ||
COMPLEX * | data_dc | ||
) |
Prepare UNFOLD filter memory arrays
Nx | Size in x direction. |
N_acq | Number of acquired ky-kz lines. |
Nf | Size time direction. |
ncoils | number of coils |
kline_o | Sampling function, odd time frames. |
kline_e | Sampling function, even time frames. |
fr1 | Whether 1st frame is considered even (0) or odd (1). |
buf_lg | Larger buffer, for processing. |
buf_sm | Smaller buffer, for processing. |
filter_dc | UNFOLD filter, DC region. |
filter_dckept | UNFOLD filter (1-filter_dc) |
near_dc | Frequencies around DC. |
filt_w | Width of DC region, in near_dc. |
Nf_proc | number of temporal frames, including synthetic |
int set_nfproc | ( | short | Nf, |
short | flag | ||
) |
Find out how many frames should be used in the reconstruction. This must be an even number, and a smooth transition between 1st and last frame is desirable. To do so, temporary synthetic frames may have to be created. One has the option of a setting based on precision (larger Nf_proc, flag=0), or speed of recon- struction (smaller Nf_proc, flag=1).
Nf | Number of time frames. |
flag | switch between speed vs. precision |
With flag = 1
, the return value is (int) 2.0*ceil( Nf/2 )
. This setting provides increased recon speed and decreased memory usage, i.e., smaller Nf_proc
(e.g., for 5 frames 1-2-3-4-5, the reconstruction is done with 6 frames 1-2-3-4-5-4, where the 4th is repeated to make Nf_proc even).
With flag = 0
, the return value is 2*Nf - 2
This setting provides increased precision, by avoiding discontinuities between the first and last frame of the data to be processed (e.g., for 5 frames 1-2-3-4-5, the recon is done with 8 frames 1-2-3-4-5-4-3-2, where frames 2, 3 and 4 are repeated, the transisition between 1st frame and last frame (frame #2) being presumably smooth).
void setup_unfold | ( | SCAN_INFO * | hdr_ptr, |
int | Nt, | ||
float * | filter_dc, | ||
float * | filter_ny, | ||
float * | filter_dckept, | ||
float * | filter_dcny, | ||
short * | near_dc, | ||
short * | filt_w_ptr | ||
) |
Set-up parameters/filters specific to the UNFOLD algorithm.
hdr_ptr | Structure with scan info. |
Nt | Number of time points. |
filter_dc | UNFOLD filter, DC region. |
filter_ny | UNFOLD filter, Ny region. |
filter_dckept | UNFOLD filter (1-filter_dc) |
filter_dcny | UNFOLD filter (filter_dc*filter_ny) |
near_dc | Frequencies around DC. |
filt_w_ptr | Width of DC region, in near_dc. |
void synth_frames | ( | short | ncoils, |
short | Nf, | ||
short | Nz, | ||
short | Ny, | ||
short | Nx, | ||
COMPLEX * | data_in, | ||
short | Nf_proc, | ||
COMPLEX * | data_out | ||
) |
Generate extra, synthetic time frames. This has two purposes: to make the number of phases even to insure alternation between the two sampling schemes, and to make the change between last and first frames smoother.
ncoils | Number of receiver coils. |
Nf | Size time direction. |
Nz | Size in z direction. |
Ny | Size in y direction. |
Nx | Size in x direction. |
data_in | Data input, to be extended from Nf to Nf_proc frames. |
Nf_proc | New size along t, including synthetic frames. |
data_out | output data |
void synth_frames_cine | ( | short | ncoils, |
short | Nf_full, | ||
short | fr1, | ||
short | Nf, | ||
short | N_acq, | ||
short | Nx, | ||
short | ky, | ||
KCOORD * | kline_o, | ||
KCOORD * | kline_e, | ||
COMPLEX * | data_in, | ||
short | Nf_proc, | ||
COMPLEX * | data_out | ||
) |
For a given ky line, generate extra (synthetic) time frames. This has two purposes: to make the number of phases even to insure alternation between the two sampling schemes, and to make the change between last and first frames smoother.
ncoils | Number of receiver coils. |
Nf_full | Array size time direction. |
Nf | Data size, <= Nf_full. |
N_acq | Number of k lines per frame. |
Nx | Size in x direction. |
ky | ky line being treated. |
data_in | Data input, to be extended from Nf to Nf_proc frames. |
Nf_proc | New size along t, including synthetic frames. |
data_out | output data |
void transfer_dc | ( | short | dir, |
short | ncoils, | ||
short | Nf, | ||
short | Nz, | ||
short | Ny, | ||
short | Nx, | ||
short | filt_w, | ||
short * | near_dc, | ||
float * | filter, | ||
COMPLEX * | lg_array, | ||
COMPLEX * | sm_array | ||
) |
When DC and Nyquist frequencies are handled seperately in an application of UNFOLD parad, this function can be used to copy the mult-frame DC data to a processing buffer.
dir | Directiion of transfer (-1 from large array to small, 1 from small to large). |
ncoils | Number of receiver coils. |
Nf | Size time direction. |
Nz | Size in z direction. |
Ny | Size in y direction. |
Nx | Size in x direction. |
filt_w | Number of entries in near_dc[] |
near_dc | Location of those frequencies that correspond to near-DC frequencies. |
filter | Weight to give to data while transfering it (only for dir=1, from small to large). |
lg_array | Array containing all temporal frequencies (length Nf along frequency axis). |
sm_array | Array containing only temporal frequencies near DC (length filt_w along frequency axis). |
void unfold_filter | ( | short | ncoils, |
short | Nf, | ||
short | Nz, | ||
short | Ny, | ||
short | Nx, | ||
float * | filter, | ||
COMPLEX * | data | ||
) |
Apply the UNFOLD filters to the data
ncoils | Number of receiver coils. (dim 5) |
Nf | Size time direction. (dim 4) |
Nz | Size in z direction. (dim 3) |
Ny | Size in y direction. (dim 2) |
Nx | Size in x direction. (dim 1) |
filter | UNFOLD filter, applied along dim 4. |
data | Data to filter (inplace operation: output overwrites input). size: Nx-Ny-Nz-Nf-ncoil |
void unfold_recombine | ( | short | Nx, |
short | Ny_proc, | ||
short | Nz_proc, | ||
short | Nf_proc, | ||
short * | near_dc, | ||
short | filt_w, | ||
COMPLEX * | dc, | ||
COMPLEX * | full | ||
) |
Recombine the improved DC region in 'dc' (calculated with half the acceleration) to the rest of the bandwidth (calculated with full acceleration).
Nx | Size in x direction. |
Nf_proc | Size time direction, including synthetic frames |
near_dc | Frequencies around DC. |
filt_w | Width of DC region, in near_dc. |
dc | Contains improved version of DC region. |
full | Contains rest of bandwidth (DC removed). The output overwrites the input values in 'full'. |