From ca9ec16e5c18e816bcb819247be435875cbbff09 Mon Sep 17 00:00:00 2001 From: tvcastillod Date: Fri, 13 Sep 2024 10:01:31 -0500 Subject: [PATCH] adjusted odf actor test --- .../SH-ODF_experimental/example_odf.py | 47 ------------------- fury/tests/test_actors.py | 20 ++------ 2 files changed, 4 insertions(+), 63 deletions(-) delete mode 100644 docs/experimental/SH-ODF_experimental/example_odf.py diff --git a/docs/experimental/SH-ODF_experimental/example_odf.py b/docs/experimental/SH-ODF_experimental/example_odf.py deleted file mode 100644 index ac43687b4..000000000 --- a/docs/experimental/SH-ODF_experimental/example_odf.py +++ /dev/null @@ -1,47 +0,0 @@ -import os - -import numpy as np -from dipy.data.fetcher import dipy_home -from dipy.io.image import load_nifti - -from fury import actor, window - -if __name__ == "__main__": - show_man = window.ShowManager(size=(1280, 720)) - - dataset_dir = os.path.join(dipy_home, "stanford_hardi") - - coeffs, affine = load_nifti("docs\experimental\SH-ODF_experimental\odf_debug_sh_coeffs_9x11x45(8).nii") - - valid_mask = np.abs(coeffs).max(axis=(-1)) > 0 - indices = np.nonzero(valid_mask) - - centers = np.asarray(indices).T - - x, y, z, s = coeffs.shape - coeffs = coeffs[:, :, :].reshape((x * y * z, s)) - - #''' - coeffs = np.array([ - [ - -0.2739740312099, 0.2526670396328, 1.8922271728516, 0.2878578901291, - -0.5339795947075, -0.2620058953762, 0.1580424904823, 0.0329004973173, - -0.1322413831949, -0.1332057565451, 1.0894461870193, -0.6319401264191, - -0.0416776277125, -1.0772529840469, 0.1423762738705, 0.7941166162491, - 0.7490307092667, -0.3428381681442, 0.1024847552180, -0.0219132602215, - 0.0499043911695, 0.2162453681231, 0.0921059995890, -0.2611238956451, - 0.2549301385880, -0.4534865319729, 0.1922748684883, -0.6200597286224, - -0.0532187558711, -0.3569841980934, 0.0293972902000, -0.1977960765362, - -0.1058669015765, 0.2372217923403, -0.1856198310852, -0.3373193442822, - -0.0750469490886, 0.2146576642990, -0.0490148440003, 0.1288588196039, - 0.3173974752426, 0.1990085393190, -0.1736343950033, -0.0482443645597, - 0.1749017387629 - ] - ]) - centers= np.array([0, 0, 0]) - #''' - - odf_actor = actor.odf(centers=centers, coeffs=coeffs, scales=1.0, - sh_basis='descoteaux') - show_man.scene.add(odf_actor) - show_man.start() \ No newline at end of file diff --git a/fury/tests/test_actors.py b/fury/tests/test_actors.py index 043cc0992..dffd2b4fd 100644 --- a/fury/tests/test_actors.py +++ b/fury/tests/test_actors.py @@ -1982,9 +1982,6 @@ def test_odf_actor(interactive=False): npt.assert_equal(report.actors, 1) scene.clear() - # given degree is not even - npt.assert_warns(UserWarning, actor.odf, centers, coeffs, 3) - centers = np.array([0, 0, 0]) coeffs = np.array([ [-0.2739740312099, 0.2526670396328, 1.8922271728516, 0.2878578901291, @@ -1995,7 +1992,8 @@ def test_odf_actor(interactive=False): 0.0499043911695, 0.2162453681231, 0.0921059995890, -0.2611238956451, 0.2549301385880, -0.4534865319729, 0.1922748684883, -0.6200597286224] ]) - odf_actor = actor.odf(centers=centers, coeffs=coeffs, degree=6) + # odf glyph of degree 6 + odf_actor = actor.odf(centers=centers, coeffs=coeffs) scene.add(odf_actor) if interactive: @@ -2005,7 +2003,8 @@ def test_odf_actor(interactive=False): npt.assert_equal(report.actors, 1) scene.clear() - odf_actor = actor.odf(centers=centers, coeffs=coeffs, degree=4) + # odf glyph of degree 4 + odf_actor = actor.odf(centers=centers, coeffs=coeffs[:15]) scene.add(odf_actor) if interactive: @@ -2014,14 +2013,3 @@ def test_odf_actor(interactive=False): report = window.analyze_scene(scene) npt.assert_equal(report.actors, 1) scene.clear() - - odf_actor = actor.odf(centers=centers, coeffs=coeffs, degree=8) - # not enough coefficients for given degree - npt.assert_warns(UserWarning, actor.odf, centers, coeffs, 8) - scene.add(odf_actor) - - if interactive: - window.show(scene) - - npt.assert_equal(report.actors, 1) - scene.clear()