test_auxiliary_methods.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:LabelsManager 作者: SebastianoF 项目源码 文件源码
def test_set_new_data_simple_modifications():

    aff = np.eye(4); aff[2, 1] = 42.0

    im_0 = nib.Nifti1Image(np.zeros([3,3,3]), affine=aff)
    im_0_header = im_0.header
    # default intent_code
    assert_equals(im_0_header['intent_code'], 0)
    # change intento code
    im_0_header['intent_code'] = 5

    # generate new nib from the old with new data
    im_1 = set_new_data(im_0, np.ones([3,3,3]))
    im_1_header = im_1.header
    # see if the infos are the same as in the modified header
    assert_array_equal(im_1.get_data()[:], np.ones([3,3,3]))
    assert_equals(im_1_header['intent_code'], 5)
    assert_array_equal(im_1.get_affine(), aff)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号