Esempio n. 1
0
def test_registration():
    aff = ireg.affine_register(anat_img,
                               anat_img)
    print aff
Esempio n. 2
0
print ('Source brain: %s' % source)
print ('Target brain: %s' % target)
print ('Similarity measure: %s' % similarity)
print ('Optimizer: %s' % optimizer)

# Get data
print('Fetching image data...')
I = load_image(source_file)
J = load_image(target_file)

# Perform affine normalization 
print('Setting up registration...')
tic = time.time()
T = affine_register(I, J, 
                    similarity=similarity, 
                    interp=interp, 
                    normalize=normalize, 
                    optimizer=optimizer)
toc = time.time()
print('  Registration time: %f sec' % (toc-tic))


# Resample source image
print('Resampling source image...')
tic = time.time()
It = affine_resample(I, J, T) 
toc = time.time()
print('  Resampling time: %f sec' % (toc-tic))

# Save resampled source
outfile =  source+'_TO_'+target+'.nii'