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)
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)
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)