forked from ndwork/dworkLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiGridT_2D.m
More file actions
66 lines (57 loc) · 2.15 KB
/
iGridT_2D.m
File metadata and controls
66 lines (57 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function out = iGridT_2D( F, traj, N, varargin )
% out = iGridT_2D( F, traj, N, [ 'alpha', alpha, 'W', W, 'nC', nC ] )
%
% Gridding (without density correction) is the adjoint of MRI encoding
% with inverse gridding. This function applies the transpose of
% inverse gridding to the input data.
%
% Inputs:
% F is a 1D array of M elements specifying the k-space data values
% traj is a Mx2 array specifying the k-space trajectory.
% The first/second column is kx/ky
% The units are normalized to [-0.5,0.5).
% N is the size of the output image
% If N is a scalar, then the final image is assumed to be square
% If N is a 2 element array, then N = [Ny Nx]
%
% Optional Inputs:
% alpha - a float parameter specifying the oversampling factor
% W - an integer specifying the kernel's width
% nC - specifies the number of samples in the kernel
% verbose - if set to true, outputs processing status
%
% Written by Nicholas Dwork (c) 2016
% Based on EE369C notes written by John Pauly
if numel(N)==1
Ny=N; Nx=N;
else
Ny=N(1); Nx=N(2);
end
defaultAlpha = 1.5;
defaultW = 8;
defaultNc = 500;
checknum = @(x) isnumeric(x) && isscalar(x) && (x >= 1);
p = inputParser;
p.addParameter( 'alpha', defaultAlpha, @(x) numel(x) == 0 || checknum(x) );
p.addParameter( 'W', defaultW, @(x) numel(x) == 0 || checknum(x) );
p.addParameter( 'nC', defaultNc, @(x) numel(x) == 0 || checknum(x) );
p.parse( varargin{:} );
alpha = p.Results.alpha;
W = p.Results.W;
nC = p.Results.nC;
if numel( alpha ) == 0, alpha = defaultAlpha; end
if numel( W ) == 0, W = defaultW; end
if numel( nC ) == 0, nC = defaultNc; end
% Make the Kaiser Bessel convolution kernel
Gy = Ny;
[kCy,Cy,cImgY] = makeKbKernel( Gy, Ny, 'alpha', alpha, 'W', W, 'nC', nC );
Gx = Nx;
[kCx,Cx,cImgX] = makeKbKernel( Gx, Nx, 'alpha', alpha, 'W', W, 'nC', nC );
% Perform a circular convolution
fftGridded = applyC_2D( F, traj, [Ny Nx], kCy, kCx, Cy, Cx );
% Perform an inverse fft
data = fftshift( uifft2( ifftshift(fftGridded) ) );
% Perform deapodization
cImg = cImgY * transpose(cImgX);
out = data ./ cImg;
end