예제 #1
0
def make_matcher(): 
    I = load_image(example_data.get_filename('neurospin',
                                             'sulcal2000',
                                             'nobias_ammon.nii.gz'))
    J = load_image(example_data.get_filename('neurospin',
                                             'sulcal2000',
                                             'nobias_anubis.nii.gz'))


    # Create a registration instance
    R = IconicRegistration(I, J)
    R.set_source_fov(fixed_npoints=64**3)
    R.similarity = 'llr_cc'
    return R
예제 #2
0
def load_ppm(): 
    # Read input files 
    for i in range(ntissues):
        fname = os.path.join(datadir, tissues[i]+'_1000Prior.img')
        if i == 0: 
            im = load_image(fname)
            affine = im.affine
            data = np.zeros(list(im.shape)+[ntissues])
            data[:,:,:,0] = im.data
        else: 
            data[:,:,:,i] = load_image(fname).data
    
    #ppm = Image(data, affine)

    # Normalize and mask ppms 
    psum = data.sum(3)
    X,Y,Z = np.where(psum>0)
    for i in range(ntissues): 
        data[X,Y,Z,i] /= psum[X,Y,Z]
    mask = (X.astype('uint'), Y.astype('uint'), Z.astype('uint'))

    return data, mask, affine 
예제 #3
0
    pylab.pink()
    array = im.data
    if threshold==None: 
        pylab.imshow(array[:,slice,:])
    else:
        pylab.imshow(array[:,slice,:]>threshold)



"""
Main 
"""

# Load images 
I = load_image(example_data.get_filename('neurospin',
                                         'sulcal2000',
                                         'nobias_ammon.nii.gz'))
J = load_image(example_data.get_filename('neurospin',
                                         'sulcal2000',
                                         'nobias_anubis.nii.gz'))


# Create a registration instance
R = IconicRegistration(I, J)
R.set_source_fov(fixed_npoints=64**3)
R.similarity = 'llr_mi'
T = np.eye(4)
#T[0:3,3] = [4,5,6]

print R.eval(T)
예제 #4
0
def load_mri(): 
    fname = os.path.join(datadir, 'BiasCorIm.img')
    return load_image(fname)
예제 #5
0
def load_mri(): 
    fname = os.path.join(datadir, subjects[s_idx]+'.nii')
    print(fname)
    return load_image(fname)