Skip to content

Commit

Permalink
Change the range of orientation dispersion indexes to [0,1]
Browse files Browse the repository at this point in the history
  • Loading branch information
msorelli committed Jan 16, 2025
1 parent 8a5e0c7 commit ba7fa95
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions foa3d/odf.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,19 @@ def compute_orientation_dispersion(vec_tnsr_eig, odi_pri, odi_sec, odi_tot, odi_
# primary dispersion (0.3183098861837907 = 1/π)
avte = np.abs(vec_tnsr_eig)
if odi_pri is not None:
odi_pri[:] = (1 - 0.3183098861837907 * np.arctan2(avte[..., 2], avte[..., 1])).astype(np.float32)
odi_pri[:] = (0.5 - 0.3183098861837907 * np.arctan2(avte[..., 2], avte[..., 1])).astype(np.float32)

# secondary dispersion
if odi_sec is not None:
odi_sec[:] = (1 - 0.3183098861837907 * np.arctan2(avte[..., 2], avte[..., 0])).astype(np.float32)
odi_sec[:] = (0.5 - 0.3183098861837907 * np.arctan2(avte[..., 2], avte[..., 0])).astype(np.float32)

# dispersion anisotropy
diff = np.abs(vec_tnsr_eig[..., 1] - vec_tnsr_eig[..., 0])
if odi_anis is not None:
odi_anis[:] = (1 - 0.3183098861837907 * np.arctan2(avte[..., 2], diff)).astype(np.float32)
odi_anis[:] = (0.5 - 0.3183098861837907 * np.arctan2(avte[..., 2], diff)).astype(np.float32)

# total dispersion
odi_tot[:] = (1 - 0.3183098861837907 *
odi_tot[:] = (0.5 - 0.3183098861837907 *
np.arctan2(avte[..., 2], np.sqrt(np.abs(np.multiply(avte[..., 1], avte[..., 0]))))).astype(np.float32)


Expand Down

0 comments on commit ba7fa95

Please sign in to comment.