ren.SetBackground(1, 1, 1)

ren.add(
    actor.point(hsph_initial.vertices, window.colors.red, point_radius=0.05))

if interactive:
    window.show(ren)

print('The Points should be looking good visually !')

print('Lets form the much needed sphere')

sphere_grad = Sphere(xyz=np.vstack((hsph_initial.vertices,
                                    -hsph_initial.vertices)))

window.rm_all(ren)
ren.add(
    actor.point(sphere_grad.vertices, actor.colors.green, point_radius=0.05))
if interactive:
    window.show(ren)

# Lets make the Sampling Matrix, We will first create a SH object
sh_model = SphHarmModel(gtab_b3000)

# Trying to get Basis matrix using Qball method is a failed idea because there are checks on the fit matrix.
#q_sh_model = QballBaseModel(gtab_b3000,sh_order=8,smooth=0.006)
#q_sh_basis = q_sh_model.sampling_matrix(hsph_initial)

sh_basis = sh_model.sampling_matrix(hsph_initial)

print('Debug the Spherical Harmonic Basis Set')
Example #2
0
window.record(ren, out_path='initial_vs_updated.png', size=(300, 300))
if interactive:
    window.show(ren)

"""
.. figure:: initial_vs_updated.png
   :align: center

   Example of electrostatic repulsion of red points which become green points.

We can also create a sphere from the hemisphere and show it in the following way.
"""

sph = Sphere(xyz=np.vstack((hsph_updated.vertices, -hsph_updated.vertices)))

window.rm_all(ren)
ren.add(actor.point(sph.vertices, actor.colors.green, point_radius=0.05))

print('Saving illustration as full_sphere.png')
window.record(ren, out_path='full_sphere.png', size=(300, 300))
if interactive:
    window.show(ren)

"""
.. figure:: full_sphere.png
   :align: center

   Full sphere.

It is time to create the Gradients. For this purpose we will use the
function ``gradient_table`` and fill it with the ``hsph_updated`` vectors that