From ba7fa956e2ecfcefd603c77c48fd9f9b405ffe42 Mon Sep 17 00:00:00 2001 From: msorelli Date: Thu, 16 Jan 2025 12:25:49 +0100 Subject: [PATCH] Change the range of orientation dispersion indexes to [0,1] --- foa3d/odf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/foa3d/odf.py b/foa3d/odf.py index ca3bd9c..4962798 100644 --- a/foa3d/odf.py +++ b/foa3d/odf.py @@ -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)