c7c80b8429ab70ea3b4d17451eac9cd5020e68a8,dipy/align/tests/test_imwarp.py,,test_em_3d_gauss_newton,#,760

Before Change


    mapping = optimizer.optimize(static, moving, None)
    m = optimizer.get_map()
    assert_equal(mapping, m)
    energy_profile = subsample_profile(
        optimizer.full_energy_profile, 10)
    print(energy_profile)

    if USING_VC_SSE2:
        expected_profile = \
            np.array([144.03694724, 63.06874155, 51.84694887, 39.6374044,

After Change


    that produces a change in the energy profile should be carefully validated
    to ensure no accuracy loss.
    """
    fname = get_data("t1_coronal_slice")
    nslices = 21
    b = 0.1
    m = 4

    image = np.load(fname)
    moving, static = get_warped_stacked_image(image, nslices, b, m)

    //Create the EM metric
    smooth=2.0
    inner_iter=20
    step_length=0.25
    q_levels=256
    double_gradient=True
    iter_type="gauss_newton"
    similarity_metric = metrics.EMMetric(
        3, smooth, inner_iter, q_levels, double_gradient, iter_type)

    //Create the optimizer
    level_iters = [20, 5]
    opt_tol = 1e-4
    inv_iter = 20
    inv_tol = 1e-3
    ss_sigma_factor = 1.0
    optimizer = imwarp.SymmetricDiffeomorphicRegistration(similarity_metric,
        level_iters, step_length, ss_sigma_factor, opt_tol, inv_iter, inv_tol)
    optimizer.verbosity = VerbosityLevels.DEBUG
    mapping = optimizer.optimize(static, moving, None)
    m = optimizer.get_map()
    assert_equal(mapping, m)

    warped = mapping.transform(moving)
    starting_energy = np.sum((static - moving)**2)
    final_energy = np.sum((static - warped)**2)
    reduced = 1.0 - final_energy/starting_energy

    assert(reduced > 0.9)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 25

Instances


Project Name: nipy/dipy
Commit Name: c7c80b8429ab70ea3b4d17451eac9cd5020e68a8
Time: 2015-12-16
Author: jomarocegueda@gmail.com
File Name: dipy/align/tests/test_imwarp.py
Class Name:
Method Name: test_em_3d_gauss_newton


Project Name: nipy/dipy
Commit Name: c7c80b8429ab70ea3b4d17451eac9cd5020e68a8
Time: 2015-12-16
Author: jomarocegueda@gmail.com
File Name: dipy/align/tests/test_imwarp.py
Class Name:
Method Name: test_em_3d_gauss_newton


Project Name: nipy/dipy
Commit Name: c7c80b8429ab70ea3b4d17451eac9cd5020e68a8
Time: 2015-12-16
Author: jomarocegueda@gmail.com
File Name: dipy/align/tests/test_imwarp.py
Class Name:
Method Name: test_em_3d_demons


Project Name: nipy/dipy
Commit Name: c7c80b8429ab70ea3b4d17451eac9cd5020e68a8
Time: 2015-12-16
Author: jomarocegueda@gmail.com
File Name: dipy/align/tests/test_imwarp.py
Class Name:
Method Name: test_em_2d_gauss_newton


Project Name: nipy/dipy
Commit Name: c7c80b8429ab70ea3b4d17451eac9cd5020e68a8
Time: 2015-12-16
Author: jomarocegueda@gmail.com
File Name: dipy/align/tests/test_imwarp.py
Class Name:
Method Name: test_em_2d_demons