Created
June 18, 2020 04:44
-
-
Save skoudoro/8ef26faf139745c7b56efd152b5497b5 to your computer and use it in GitHub Desktop.
sh demo for glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from dipy.sims.voxel import multi_tensor_odf | |
from dipy.data import get_sphere | |
from dipy.reconst.shm import sf_to_sh | |
mevals = np.array([[0.0015, 0.0003, 0.0003], | |
[0.0015, 0.0003, 0.0003]]) | |
angles = [(0, 0), (60, 0)] | |
fractions = [50, 50] | |
sphere = get_sphere('repulsion724') | |
sphere = sphere.subdivide(2) | |
# Get ODF | |
odf = multi_tensor_odf(sphere.vertices, mevals, angles, fractions) | |
#Get spherical harmonics coefficient | |
odf_sh = sf_to_sh(odf, sphere) | |
print(odf_sh) # contains 15 coefficients to pass to the shader | |
# to get some informations about the basis k01, K02, etc..... look at | |
# - https://github.com/dipy/dipy/blob/master/dipy/reconst/shm.py#L335 | |
# - https://github.com/dipy/dipy/blob/master/dipy/reconst/shm.py#L233 | |
# - https://github.com/dipy/dipy/blob/master/dipy/reconst/shm.py#L857 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment