Skip to content

Commit

Permalink
moved uncertainty script example
Browse files Browse the repository at this point in the history
  • Loading branch information
tvcastillod committed Jul 19, 2023
1 parent 057c22d commit 9f04e7e
Showing 1 changed file with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This spript includes the implementation of dti_uncertainty actor for the
This script includes the implementation of dti_uncertainty actor for the
visualization of the cones of uncertainty along with the diffusion tensors for
comparison
"""
Expand All @@ -19,7 +19,35 @@
from fury.primitive import prim_sphere


def test_uncertainty():
class Sphere:

vertices = None
faces = None

def diffusion_tensors():
# https://dipy.org/documentation/1.0.0./examples_built/reconst_dti/
img, gtab = read_stanford_hardi()
data = img.get_fdata()

maskdata, mask = median_otsu(data, vol_idx=range(10, 50), median_radius=3,
numpass=1, autocrop=True, dilate=2)
tenmodel = dti.TensorModel(gtab)
tenfit = tenmodel.fit(maskdata)

evals = tenfit.evals[13:43, 44:74, 28:29]
evecs = tenfit.evecs[13:43, 44:74, 28:29]

vertices, faces = prim_sphere('symmetric724', True)
sphere = Sphere()
sphere.vertices = vertices
sphere.faces = faces

#from dipy.data import get_sphere
#sphere = get_sphere('symmetric724')

return actor.tensor_slicer(evals, evecs, sphere=sphere, scale=0.3)

if __name__ == '__main__':
hardi_fname, hardi_bval_fname, hardi_bvec_fname =\
get_fnames('stanford_hardi')

Expand Down Expand Up @@ -67,32 +95,3 @@ def test_uncertainty():

scene.add(uncertainty_cones)
window.show(scene, reset_camera=False)


class Sphere:

vertices = None
faces = None

def diffusion_tensors():
# https://dipy.org/documentation/1.0.0./examples_built/reconst_dti/
img, gtab = read_stanford_hardi()
data = img.get_data()

maskdata, mask = median_otsu(data, vol_idx=range(10, 50), median_radius=3,
numpass=1, autocrop=True, dilate=2)
tenmodel = dti.TensorModel(gtab)
tenfit = tenmodel.fit(maskdata)

evals = tenfit.evals[13:43, 44:74, 28:29]
evecs = tenfit.evecs[13:43, 44:74, 28:29]

vertices, faces = prim_sphere('symmetric724', True)
sphere = Sphere()
sphere.vertices = vertices
sphere.faces = faces

#from dipy.data import get_sphere
#sphere = get_sphere('symmetric724')

return actor.tensor_slicer(evals, evecs, sphere=sphere, scale=0.3)

0 comments on commit 9f04e7e

Please sign in to comment.