Ejemplo n.º 1
0
    def test_scr_reordering_adluru_true_prior_100_iter(self):
        from mr_utils.recon.reordering import scr_reordering_adluru

        # Use the true image as the prior
        prior = np.fft.ifft2(self.kspace)

        # Radial undersampling
        reduced_kspace = self.kspace * self.radial_mask

        # Run the recon
        im_est = scr_reordering_adluru(reduced_kspace,
                                       self.radial_mask,
                                       prior=prior,
                                       alpha0=self.alpha0,
                                       alpha1=self.alpha1,
                                       beta2=self.beta2,
                                       niters=100)

        # plt.subplot(1,3,1)
        # plt.imshow(np.abs(im_est),cmap='gray')
        # plt.title('Mine')
        # plt.subplot(1,3,2)
        # plt.imshow(np.abs(self.recon),cmap='gray')
        # plt.title('True')
        # plt.subplot(1,3,3)
        # plt.imshow(np.abs(im_est - self.recon),cmap='gray')
        # plt.title('Diff')
        # plt.show()

        # Is this too large of a difference?  I think it's numerical error...
        self.assertTrue(np.allclose(self.recon_100, im_est, rtol=.3))
Ejemplo n.º 2
0
    def test_scr_reordering_adluru_true_prior_50_iter(self):
        from mr_utils.recon.reordering import scr_reordering_adluru

        # Use the true image as the prior
        prior = np.fft.ifft2(self.kspace)

        # Radial undersampling
        reduced_kspace = self.kspace * self.radial_mask

        # Run the recon
        im_est = scr_reordering_adluru(reduced_kspace,
                                       self.radial_mask,
                                       prior=prior,
                                       alpha0=self.alpha0,
                                       alpha1=self.alpha1,
                                       beta2=self.beta2,
                                       niters=50)

        self.assertTrue(np.allclose(self.recon_50, im_est))
Ejemplo n.º 3
0
from mr_utils.sim.traj import cartesian_pe

if __name__ == '__main__':

    N = 100
    reorder = True
    m = binary_smiley(N)
    k = np.sum(np.abs(np.diff(m)) > 0)
    np.random.seed(0)
    samp = cartesian_pe(m.shape, undersample=.2, reflines=5)

    # Take samples
    y = np.fft.fftshift(np.fft.fft2(m)) * samp

    # Do convex recon
    m_hat = scr_reordering_adluru(y,
                                  samp,
                                  prior=m,
                                  alpha0=1,
                                  alpha1=.001,
                                  beta2=np.finfo(float).eps,
                                  reorder=reorder,
                                  reorder_every_iter=False,
                                  enforce_consistency=True,
                                  niters=1000)

    # Look at result
    plt.imshow(np.abs(m_hat), cmap='gray')
    plt.title('GD Recon, MSE: %e' % compare_mse(np.abs(m_hat), m))
    plt.show()