Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def primal_energy(u, f, lamda, coilSens, mask, nabla):
- ''' Compute the primal energy as described in Eq. (1) in the assignment
- sheet.
- @param u: current reconstruction
- @param f: raw input data
- @param lamda: tradeoff parameter between data fidelity and smoothness
- '''
- img_csr = sp.csc_matrix(u.reshape(-1, 1))
- dx = sp.csr_matrix.dot(nabla[0], img_csr)
- dy = sp.csr_matrix.dot(nabla[1], img_csr)
- dxd = np.abs(sp.csr_matrix.todense(dx).reshape([320, 320]))
- dyd = np.abs(sp.csr_matrix.todense(dy).reshape([320, 320]))
- tvd = np.sum(np.sqrt(dxd**2+dyd**2))
- return tvd+lamda/2*np.linalg.norm(op_A_mri(u, coilSens, mask)-f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement