complex float* compute_psf(unsigned int N, const long img2_dims[N], const long trj_dims[N], const complex float* traj, const complex float* weights) { long ksp_dims1[N]; md_select_dims(N, ~MD_BIT(0), ksp_dims1, trj_dims); struct linop_s* op2 = nufft_create(N, ksp_dims1, img2_dims, trj_dims, traj, NULL, nufft_conf_defaults, false); complex float* ones = md_alloc(N, ksp_dims1, CFL_SIZE); md_zfill(N, ksp_dims1, ones, 1.); if (NULL != weights) { md_zmul(N, ksp_dims1, ones, ones, weights); md_zmulc(N, ksp_dims1, ones, ones, weights); } complex float* psft = md_alloc(N, img2_dims, CFL_SIZE); linop_adjoint_unchecked(op2, psft, ones); md_free(ones); linop_free(op2); return psft; }
/** * Wrapper for calling adjoint operation using italgos. */ extern void linop_adjoint_iter(void* _o, float* _dst, const float* _src) { struct linop_s* o = _o; complex float* dst = (complex float*) _dst; const complex float* src = (complex float*) _src; linop_adjoint_unchecked(o, dst, src); }
const struct operator_p_s* prox_normaleq_create(const struct linop_s* op, const complex float* y) { PTR_ALLOC(struct prox_normaleq_data, pdata); SET_TYPEID(prox_normaleq_data, pdata); PTR_ALLOC(struct iter_conjgrad_conf, cgconf); *cgconf = iter_conjgrad_defaults; cgconf->maxiter = 10; cgconf->l2lambda = 0; pdata->cgconf = PTR_PASS(cgconf); pdata->op = op; pdata->size = 2 * md_calc_size(linop_domain(op)->N, linop_domain(op)->dims); pdata->adj = md_alloc_sameplace(1, &(pdata->size), FL_SIZE, y); linop_adjoint_unchecked(op, (complex float*)pdata->adj, y); return operator_p_create(linop_domain(op)->N, linop_domain(op)->dims, linop_domain(op)->N, linop_domain(op)->dims, CAST_UP(PTR_PASS(pdata)), prox_normaleq_apply, prox_normaleq_del); }
static void nlop_adj_iter(iter_op_data* _o, float* _dst, const float* _src) { const struct iter4_nlop_s* nlop = CAST_DOWN(iter4_nlop_s, _o); linop_adjoint_unchecked(nlop->nlop.derivative[0], (complex float*)_dst, (const complex float*)_src); }