Beispiel #1
0
def test_voxel2streamline():
    streamline = [[[1.1, 2.4, 2.9], [4, 5, 3], [5, 6, 3], [6, 7, 3]],
                  [[1, 2, 3], [4, 5, 3], [5, 6, 3]]]
    affine = np.eye(4)
    v2f, v2fn = life.voxel2streamline(streamline, False, affine)
    npt.assert_equal(v2f, {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0]})
    npt.assert_equal(v2fn, {0: {0: [0], 1: [1], 2: [2], 3: [3]},
                            1: {0: [0], 1: [1], 2: [2]}})
    affine = np.array([[0.9, 0, 0, 10],
                       [0, 0.9, 0, -100],
                       [0, 0, 0.9, 2],
                       [0, 0, 0, 1]])

    xform_sl = life.transform_streamlines(streamline, np.linalg.inv(affine))
    v2f, v2fn = life.voxel2streamline(xform_sl, False, affine)
    npt.assert_equal(v2f, {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0]})
    npt.assert_equal(v2fn, {0: {0: [0], 1: [1], 2: [2], 3: [3]},
                            1: {0: [0], 1: [1], 2: [2]}})
Beispiel #2
0
def test_voxel2streamline():
    streamline = [[[1.1, 2.4, 2.9], [4, 5, 3], [5, 6, 3], [6, 7, 3]],
                  [[1, 2, 3], [4, 5, 3], [5, 6, 3]]]
    affine = np.eye(4)
    v2f, v2fn = life.voxel2streamline(streamline, affine)
    npt.assert_equal(v2f, {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0]})
    npt.assert_equal(v2fn, {0: {0: [0], 1: [1], 2: [2], 3: [3]},
                            1: {0: [0], 1: [1], 2: [2]}})
    affine = np.array([[0.9, 0, 0, 10],
                       [0, 0.9, 0, -100],
                       [0, 0, 0.9, 2],
                       [0, 0, 0, 1]])

    xform_sl = life.transform_streamlines(streamline, np.linalg.inv(affine))
    v2f, v2fn = life.voxel2streamline(xform_sl, affine)
    npt.assert_equal(v2f, {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0]})
    npt.assert_equal(v2fn, {0: {0: [0], 1: [1], 2: [2], 3: [3]},
                            1: {0: [0], 1: [1], 2: [2]}})