Test the FBC measures on a set of fibers
(self)
| 31 | |
| 32 | # From: https://github.com/nipy/dipy/blob/51234a4437638535ff8f6e5819e14ccf7e1d1483/dipy/tracking/tests/test_fbc.py |
| 33 | def test_fbc(self): |
| 34 | """Test the FBC measures on a set of fibers""" |
| 35 | |
| 36 | # Generate two fibers of 10 points |
| 37 | streamlines = [] |
| 38 | for i in range(2): |
| 39 | fiber = np.zeros((10, 3)) |
| 40 | for j in range(10): |
| 41 | fiber[j, 0] = j |
| 42 | fiber[j, 1] = i*0.2 |
| 43 | fiber[j, 2] = 0 |
| 44 | streamlines.append(fiber) |
| 45 | |
| 46 | # Create lookup table. |
| 47 | # A fixed set of orientations is used to guarantee deterministic results |
| 48 | D33 = 1.0 |
| 49 | D44 = 0.04 |
| 50 | t = 1 |
| 51 | sphere = Sphere(xyz=np.array([[0.82819078, 0.51050355, 0.23127074], |
| 52 | [-0.10761926, -0.95554309, 0.27450957], |
| 53 | [0.4101745, -0.07154038, 0.90919682], |
| 54 | [-0.75573448, 0.64854889, 0.09082809], |
| 55 | [-0.56874549, 0.01377562, 0.8223982]])) |
| 56 | k = EnhancementKernel(D33, D44, t, orientations=sphere, |
| 57 | force_recompute=True) |
| 58 | |
| 59 | # run FBC |
| 60 | fbc = FBCMeasures(streamlines, k, verbose=True) |
| 61 | |
| 62 | # get FBC values |
| 63 | fbc_sl_orig, clrs_orig, rfbc_orig = \ |
| 64 | fbc.get_points_rfbc_thresholded(0, emphasis=0.01) |
| 65 | |
| 66 | # check mean RFBC against tested value |
| 67 | npt.assert_almost_equal(np.mean(rfbc_orig), 1.0500466494329224, decimal=4) |
| 68 | |
| 69 |
nothing calls this directly
no outgoing calls
no test coverage detected