예제 #1
0
파일: test_shm.py 프로젝트: endolith/dipy
def testQballOdfModel():
    sphere, vecs_xy, bval, bvec, sig = make_fake_signal()
    qball_fitter = QballOdfModel(bval, bvec.T, 6, sphere=sphere)
    qball_fitter.angular_spacing_threshould = 0.

    norm_sig = sig
    S = qball_fitter.fit(norm_sig).odf()
    stepper = ClosestPeakSelector(qball_fitter, norm_sig, angle_limit=39)
    for ii in xrange(len(vecs_xy)):
        if np.dot(vecs_xy[ii], [0, 1., 0]) < .84:
            assert_raises(StopIteration, stepper.next_step, ii, [0, 1., 0])
        else:
            step = stepper.next_step(ii, [0, 1., 0])
            s2 = stepper.next_step(ii, vecs_xy[ii])
            assert step is not None
            assert np.dot(vecs_xy[ii], step) > .98
            step = stepper.next_step(ii, [1., 0, 0.])
            assert_array_almost_equal([1., 0, 0.], step)
예제 #2
0
def testQballOdfModel():
    v, e, vecs_xy, bval, bvec, sig = make_fake_signal()
    qball_fitter = QballOdfModel(bval, bvec.T, 6, odf_vertices=v, odf_edges=e)
    qball_fitter.angular_distance_threshold = 0.0

    norm_sig = sig
    C = qball_fitter.fit_data(norm_sig)
    S = qball_fitter.evaluate_odf(norm_sig)
    stepper = ClosestPeakSelector(qball_fitter, norm_sig, angle_limit=39)
    for ii in xrange(len(vecs_xy)):
        if np.dot(vecs_xy[ii], [0, 1.0, 0]) < 0.84:
            assert_raises(StopIteration, stepper.next_step, ii, [0, 1.0, 0])
        else:
            step = stepper.next_step(ii, [0, 1.0, 0])
            s2 = stepper.next_step(ii, vecs_xy[ii])
            assert step is not None
            assert np.dot(vecs_xy[ii], step) > 0.98
            step = stepper.next_step(ii, [1.0, 0, 0.0])
            assert_array_equal([1.0, 0, 0.0], step)
예제 #3
0
def testQballOdfModel():
    v, e, vecs_xy, bval, bvec, sig = make_fake_signal()
    qball_fitter = QballOdfModel(bval, bvec.T, 6, odf_vertices=v, odf_edges=e)
    qball_fitter.angular_distance_threshold = 0.

    norm_sig = sig
    C = qball_fitter.fit_data(norm_sig)
    S = qball_fitter.evaluate_odf(norm_sig)
    stepper = ClosestPeakSelector(qball_fitter, norm_sig, angle_limit=39)
    for ii in xrange(len(vecs_xy)):
        if np.dot(vecs_xy[ii], [0, 1., 0]) < .84:
            assert_raises(StopIteration, stepper.next_step, ii, [0, 1., 0])
        else:
            step = stepper.next_step(ii, [0, 1., 0])
            s2 = stepper.next_step(ii, vecs_xy[ii])
            assert step is not None
            assert np.dot(vecs_xy[ii], step) > .98
            step = stepper.next_step(ii, [1., 0, 0.])
            assert_array_equal([1., 0, 0.], step)
예제 #4
0
파일: test_shm.py 프로젝트: jgors/dipy
def testQballOdfModel():
    v, e, vecs_xy, bval, bvec, sig = make_fake_signal()
    qball_fitter = QballOdfModel(6, bval, bvec, sampling_points=v,
                                 sampling_edges=e)

    norm_sig = sig[..., 1:]
    C = qball_fitter.fit_data(norm_sig)
    S = qball_fitter.evaluate(norm_sig)
    stepper = ClosestPeakSelector(qball_fitter, norm_sig, angle_limit=39)
    for ii in xrange(len(vecs_xy)):
        if np.dot(vecs_xy[ii], [0, 1., 0]) < .84:
            assert_raises(StopIteration, stepper.next_step, ii, [0, 1., 0])
        else:
            step = stepper.next_step(ii, [0, 1., 0])
            s2 = stepper.next_step(ii, vecs_xy[ii])
            assert step is not None
            assert np.dot(vecs_xy[ii], step) > .98
            step = stepper.next_step(ii, [1., 0, 0.])
            assert_array_equal([1., 0, 0.], step)
예제 #5
0
파일: test_shm.py 프로젝트: jgors/dipy
def testQballOdfModel():
    v, e, vecs_xy, bval, bvec, sig = make_fake_signal()
    qball_fitter = QballOdfModel(6,
                                 bval,
                                 bvec,
                                 sampling_points=v,
                                 sampling_edges=e)

    norm_sig = sig[..., 1:]
    C = qball_fitter.fit_data(norm_sig)
    S = qball_fitter.evaluate(norm_sig)
    stepper = ClosestPeakSelector(qball_fitter, norm_sig, angle_limit=39)
    for ii in xrange(len(vecs_xy)):
        if np.dot(vecs_xy[ii], [0, 1., 0]) < .84:
            assert_raises(StopIteration, stepper.next_step, ii, [0, 1., 0])
        else:
            step = stepper.next_step(ii, [0, 1., 0])
            s2 = stepper.next_step(ii, vecs_xy[ii])
            assert step is not None
            assert np.dot(vecs_xy[ii], step) > .98
            step = stepper.next_step(ii, [1., 0, 0.])
            assert_array_equal([1., 0, 0.], step)