Ejemplo n.º 1
0
 def test_example(self):
     fi = ants.image_read( ants.get_ants_data( 'r16' ) )
     mi = ants.image_read( ants.get_ants_data( 'r64' ) )
     mygr = ants.create_warped_grid( mi )
     
     mytx = ants.registration(fixed=fi, moving=mi, type_of_transform=('SyN') )
     mywarpedgrid = ants.create_warped_grid( mi, grid_directions=(False,True),
                         transform=mytx['fwdtransforms'], fixed_reference_image=fi )
Ejemplo n.º 2
0
warped_img_arr = warped_img.numpy(single_components=False)
# 从numpy数组得到antsimage
img = ants.from_numpy(warped_img_arr,
                      origin=None,
                      spacing=None,
                      direction=None,
                      has_components=False,
                      is_rgb=False)
# 生成图像的雅克比行列式
jac = ants.create_jacobian_determinant_image(domain_image=f_img,
                                             tx=mytx["fwdtransforms"][0],
                                             do_log=False,
                                             geom=False)
ants.image_write(jac, "./result/jac.nii.gz")
# 生成带网格的moving图像,实测效果不好
m_grid = ants.create_warped_grid(m_img)
m_grid = ants.create_warped_grid(m_grid,
                                 grid_directions=(False, False),
                                 transform=mytx['fwdtransforms'],
                                 fixed_reference_image=f_img)
ants.image_write(m_grid, "./result/m_grid.nii.gz")
'''
以下为其他不常用的函数:

ANTsTransform.apply_to_image(image, reference=None, interpolation='linear')
ants.read_transform(filename, dimension=2, precision='float')
# transform的格式是".mat"
ants.write_transform(transform, filename)
# field是ANTsImage类型
ants.transform_from_displacement_field(field)
'''