How to use the sigpy.mri.sim.birdcage_maps function in sigpy

To help you get started, we’ve selected a few sigpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikgroup / sigpy / tests / mri / test_app.py View on Github external
def test_ones_JsenseRecon(self):
        img_shape = [6, 6]
        mps_shape = [4, 6, 6]

        img = np.ones(img_shape, dtype=np.complex)
        mps = sim.birdcage_maps(mps_shape)
        ksp = sp.fft(mps * img, axes=[-2, -1])

        _app = app.JsenseRecon(ksp, mps_ker_width=6, ksp_calib_width=6,
                               show_pbar=False)
        mps_rec = _app.run()

        npt.assert_allclose(mps, mps_rec, atol=1e-2, rtol=1e-2)
github mikgroup / sigpy / tests / mri / test_app.py View on Github external
def shepp_logan_setup(self):
        img_shape = [6, 6]
        mps_shape = [4, 6, 6]

        img = sp.shepp_logan(img_shape)
        mps = sim.birdcage_maps(mps_shape)

        mask = np.zeros(img_shape)
        mask[:, ::2] = 1

        ksp = mask * sp.fft(mps * img, axes=[-2, -1])
        return img, mps, ksp
github mikgroup / sigpy / tests / mri / rf / test_ptx.py View on Github external
def problem_2d(dim):
        img_shape = [dim, dim]
        sens_shape = [8, dim, dim]

        # target - slightly blurred circle
        x, y = np.ogrid[-img_shape[0] / 2: img_shape[0] - img_shape[0] / 2,
                        -img_shape[1] / 2: img_shape[1] - img_shape[1] / 2]
        circle = x * x + y * y <= int(img_shape[0] / 6) ** 2
        target = np.zeros(img_shape)
        target[circle] = 1
        target = filt.gaussian_filter(target, 1)
        target = target.astype(np.complex)

        sens = sim.birdcage_maps(sens_shape)

        return target, sens
github mikgroup / sigpy / tests / mri / rf / test_ptx.py View on Github external
class TestPtx(unittest.TestCase):
    img_shape = [32, 32]
    sens_shape = [8, 32, 32]
    dt = 4e-6

    # target - slightly blurred circle
    x, y = np.ogrid[-img_shape[0] / 2: img_shape[0] - img_shape[0] / 2,
                    -img_shape[1] / 2: img_shape[1] - img_shape[1] / 2]
    circle = x * x + y * y <= int(img_shape[0] / 6) ** 2
    target = np.zeros(img_shape)
    target[circle] = 1
    target = filt.gaussian_filter(target, 1)
    target = target.astype(np.complex)

    sens = sim.birdcage_maps(sens_shape)

    def test_stspa_radial(self):
        # makes dim*dim*2 trajectory
        traj = sp.mri.radial((self.sens.shape[1], self.sens.shape[1], 2),
                             self.img_shape, golden=True, dtype=np.float)
        # reshape to be Nt*2 trajectory
        traj = np.reshape(traj, [traj.shape[0] * traj.shape[1], 2])

        A = linop.Sense(self.sens, coord=traj,
                        weights=None, ishape=self.target.shape).H

        pulses = rf.stspa(self.target, self.sens, traj, self.dt, alpha=1,
                          B0=None, pinst=float('inf'), pavg=float('inf'),
                          explicit=False, max_iter=100, tol=1E-4)

        npt.assert_array_almost_equal(A * pulses, self.target, 1E-3)
github mikgroup / sigpy / tests / mri / rf / test_ptx.py View on Github external
def problem_3d(dim, Nz):
        Nc = 8
        img_shape = [dim, dim, Nz]
        sens_shape = [Nc, dim, dim, Nz]

        # target - slightly blurred circle
        x, y, z = np.ogrid[-img_shape[0] / 2: img_shape[0] - img_shape[0] / 2,
                           -img_shape[1] / 2: img_shape[1] - img_shape[1] / 2,
                           -img_shape[2] / 2: img_shape[2] - img_shape[2] / 2]
        circle = x * x + y * y + z * z <= int(img_shape[0] / 5) ** 2
        target = np.zeros(img_shape)
        target[circle] = 1
        target = filt.gaussian_filter(target, 1)
        target = target.astype(np.complex)
        sens = sp.mri.sim.birdcage_maps(sens_shape)

        return target, sens