Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
smap=smap,
im_size=im_size,
numpoints=numpoints,
coilpack=True
).to(dtype=dtype, device=device)
adjsensenufft_ob = AdjMriSenseNufft(
smap=smap,
im_size=im_size,
numpoints=numpoints,
coilpack=True
).to(dtype=dtype, device=device)
x_forw = sensenufft_ob(x, ktraj)
y_back = adjsensenufft_ob(y, ktraj)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
sensenufft_ob = MriSenseNufft(
smap=smap,
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
adjsensenufft_ob = AdjMriSenseNufft(
smap=smap,
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
x_forw = sensenufft_ob(x, ktraj)
y_back = adjsensenufft_ob(y, ktraj)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
adjkbinterp_ob = KbInterpBack(
im_size=im_size,
grid_size=grid_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
real_mat, imag_mat = precomp_sparse_mats(ktraj, kbinterp_ob)
interp_mats = {
'real_interp_mats': real_mat,
'imag_interp_mats': imag_mat
}
x_forw = kbinterp_ob(x, ktraj, interp_mats)
y_back = adjkbinterp_ob(y, ktraj, interp_mats)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
adjkbnufft_ob = AdjKbNufft(
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
real_mat, imag_mat = precomp_sparse_mats(ktraj, kbnufft_ob)
interp_mats = {
'real_interp_mats': real_mat,
'imag_interp_mats': imag_mat
}
x_forw = kbnufft_ob(x, ktraj, interp_mats)
y_back = adjkbnufft_ob(y, ktraj, interp_mats)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
kbinterp_ob = KbInterpForw(
im_size=im_size,
grid_size=grid_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
adjkbinterp_ob = KbInterpBack(
im_size=im_size,
grid_size=grid_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
x_forw = kbinterp_ob(x, ktraj)
y_back = adjkbinterp_ob(y, ktraj)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
y = y.detach().to(dtype=dtype, device=device)
ktraj = ktraj.detach().to(dtype=dtype, device=device)
kbnufft_ob = KbNufft(
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
adjkbnufft_ob = AdjKbNufft(
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
x_forw = kbnufft_ob(x, ktraj)
y_back = adjkbnufft_ob(y, ktraj)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
im_size=im_size,
numpoints=numpoints,
coilpack=True
).to(dtype=dtype, device=device)
real_mat, imag_mat = precomp_sparse_mats(ktraj, sensenufft_ob)
interp_mats = {
'real_interp_mats': real_mat,
'imag_interp_mats': imag_mat
}
x_forw = sensenufft_ob(x, ktraj, interp_mats)
y_back = adjsensenufft_ob(y, ktraj, interp_mats)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
sensenufft_ob = MriSenseNufft(
smap=smap,
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
adjsensenufft_ob = AdjMriSenseNufft(
smap=smap,
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
x_forw = sensenufft_ob(x, ktraj)
y_back = adjsensenufft_ob(y, ktraj)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
ktraj = ktraj.detach().to(dtype=dtype, device=device)
kbnufft_ob = KbNufft(
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
adjkbnufft_ob = AdjKbNufft(
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
x_forw = kbnufft_ob(x, ktraj)
y_back = adjkbnufft_ob(y, ktraj)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol
).to(dtype=dtype, device=device)
adjkbnufft_ob = AdjKbNufft(
im_size=im_size,
numpoints=numpoints
).to(dtype=dtype, device=device)
real_mat, imag_mat = precomp_sparse_mats(ktraj, kbnufft_ob)
interp_mats = {
'real_interp_mats': real_mat,
'imag_interp_mats': imag_mat
}
x_forw = kbnufft_ob(x, ktraj, interp_mats)
y_back = adjkbnufft_ob(y, ktraj, interp_mats)
inprod1 = inner_product(y, x_forw, dim=2)
inprod2 = inner_product(y_back, x, dim=2)
assert torch.norm(inprod1 - inprod2) < norm_tol