示例#1
0
    def _get_vars(self):
        ndim = len(self.img_shape)

        mps_ker_shape = [self.num_coils] + [self.mps_ker_width] * ndim
        if self.coord is None:
            img_ker_shape = [i + self.mps_ker_width -
                             1 for i in self.y.shape[1:]]
        else:
            grd_shape = sp.estimate_shape(self.coord)
            img_ker_shape = [i + self.mps_ker_width - 1 for i in grd_shape]

        self.img_ker = sp.dirac(
            img_ker_shape, dtype=self.dtype, device=self.device)
        with self.device:
            self.mps_ker = self.device.xp.zeros(
                mps_ker_shape, dtype=self.dtype)
admm_img = admm_app.run()

pl.ImagePlot(admm_img)

#%% md

## ADMM with circulant preconditioner

#%%

rho = 1
circ_precond = mr.circulant_precond(mps, coord=coord, device=device, lamda=rho)

img_shape = mps.shape[1:]
G = sp.linop.FiniteDifference(img_shape)
g = G.H * G * sp.dirac(img_shape)
g = sp.fft(g)
g = sp.to_device(g, device=device)
circ_precond = 1 / (1 / circ_precond + lamda * g)

img_shape = mps.shape[1:]
D = sp.linop.Multiply(img_shape, circ_precond)
P = sp.linop.IFFT(img_shape) * D * sp.linop.FFT(img_shape)

admm_cp_app = mr.app.TotalVariationRecon(
        ksp, mps, lamda=lamda, coord=coord, max_iter=max_iter // max_cg_iter,
        P=P, rho=rho,
        solver='ADMM', max_cg_iter=max_cg_iter, device=device, save_objective_values=True)
admm_cp_img = admm_cp_app.run()

pl.ImagePlot(admm_cp_img)