Exemplo n.º 1
0
def plot_ODF(grid_density=100):
    theta_grid = np.linspace(0, np.pi, grid_density)
    phi_grid = np.linspace(0, 2 * np.pi, grid_density)

    phi_vec, theta_vec = np.meshgrid(phi_grid, theta_grid)
    phi_vec, theta_vec = phi_vec.ravel(), theta_vec.ravel()

    xyz = np.column_stack(coord.sph2car(theta_vec, phi_vec))

    ODF = w[0] * single_tensor_ODF(xyz, rotation=R0)
    ODF += w[1] * single_tensor_ODF(xyz, rotation=R1)

    ODF = ODF.reshape((grid_density, grid_density))

    plot.surf_grid_3D(ODF, theta_grid, phi_grid, scale_radius=True)
Exemplo n.º 2
0
    # sphere.

    E = w[0] * single_tensor(gradients=xyz, bvals=b, S0=1, rotation=R0, SNR=SNR)
    E += w[1] * single_tensor(gradients=xyz, bvals=b, S0=1, rotation=R1, SNR=SNR)

    print "Signal mean:", E.mean()

    if visualize_signal:
        from dipy.core.triangle_subdivide import create_unit_sphere
        sphere = create_unit_sphere(6)
        bb = np.ones(len(sphere.vertices)) * b.mean()

        E_ = w[0] * single_tensor(gradients=sphere.vertices, bvals=bb, S0=1, rotation=R0, SNR=SNR)
        E_ += w[1] * single_tensor(gradients=sphere.vertices, bvals=bb, S0=1, rotation=R1, SNR=SNR)

        ODF = w[0] * single_tensor_ODF(sphere.vertices, rotation=R0)
        ODF += w[1] * single_tensor_ODF(sphere.vertices, rotation=R1)

        from dipy.viz import show_odfs
        show_odfs([[[E_, ODF]]], (sphere.vertices, sphere.faces))


    if visualize_odf:
        plot_ODF(grid_density=D)
        mlab = plot.get_mlab()
        mlab.show()

    # ===========================-=====
    # ODF-domain: Sparse reconstruction
    # =================================