code
stringlengths
3
6.57k
warp.detach()
numpy()
np.moveaxis(warp, 1, -1)
RegularGridInterpolator((x, y)
RegularGridInterpolator((x, y)
nib.freesurfer.read_geometry(lh_sphere)
cartesian_to_spherical(coords[:, 0], coords[:, 1], coords[:, 2])
math.degrees(2 * np.pi)
math.degrees(np.pi)
t.reshape(-1, 1)
p.reshape(-1, 1)
np.concatenate((p, t)
interpolate_function_x(pts)
interpolate_function_y(pts)
np.clip(y_prime, 0, 360)
np.clip(x_prime, -90, 90)
math.radians(i)
math.radians(i)
np.array(t_prime)
np.array(p_prime)
nib.freesurfer.read_morph_data(lh_sulc_sub)
nib.freesurfer.read_morph_data(lh_sulc_atlas)
nib.freesurfer.read_geometry(lh_sphere_sub)
cartesian_to_spherical(coords_sub[:, 0], coords_sub[:, 1], coords_sub[:, 2])
nib.freesurfer.read_geometry(lh_sphere_atlas)
cartesian_to_spherical(coords_atlas[:, 0], coords_atlas[:, 1], coords_atlas[:, 2])
nib.freesurfer.read_geometry(lh_sphere_freesurfer)
plt.figure(figsize=(14, 7)
fig.add_subplot(141)
plt.title('Moving')
fig.add_subplot(142)
ax.scatter(phi_atlas.degree, theta_atlas.degree, s=0.1, c=lh_morph_sulc_atlas)
plt.title('Fixed')
fig.add_subplot(143)
math.degrees(p)
math.degrees(t)
ax.scatter(phi_prime, thtea_prime, s=0.1, c=lh_morph_sulc_sub)
plt.title('Moved')
fig.add_subplot(144)
ax.scatter(phi_reg.degree, theta_reg.degree, s=0.1, c=lh_morph_sulc_sub)
plt.title('Moved FreeSurfer')
plt.savefig(imagesavefilename)
xyz2degree(lh_sphere, lh_sulc)
return (x, y, z)
nib.freesurfer.read_geometry(lh_sphere)
cartesian_to_spherical(coords[:, 0], coords[:, 1], coords[:, 2])
to (512, 256)
math.degrees(2 * np.pi)
math.degrees(np.pi)
np.clip(ys, 0, 511)
np.clip(xs, 0, 255)
nib.freesurfer.read_morph_data(lh_sulc)
xs.astype(np.int32)
ys.astype(np.int32)
np.zeros((512, 256)
xyz2degree2(phi, theta, lh_sulc)
to (512, 256)
math.degrees(2 * np.pi)
math.degrees(np.pi)
np.clip(ys, 0, 511)
np.clip(xs, 0, 255)
nib.freesurfer.read_morph_data(lh_sulc)
xs.astype(np.int32)
ys.astype(np.int32)
np.zeros((512, 256)
and (args.gpu != '-1')
vxm.py.utils.load_volfile(args.moving, add_batch_axis=True, add_feat_axis=add_feat_axis)
vxm.networks.VxmDense.load(args.model, device)
model.to(device)
model.eval()
normalize_forword(moving, type=normalize_type)
normalize_forword(fixed, type=normalize_type)
domainnorm(moving)
minmaxnormalize(moving)
minmaxnormalize(fixed)
torch.from_numpy(moving)
to(device)
float()
permute(0, 3, 1, 2)
torch.from_numpy(fixed)
to(device)
float()
permute(0, 3, 1, 2)
model(input_moving, input_fixed, registration=True)
normalize_backword(moved, a_moving, b_moving, type=normalize_type)
backdomainnorm(moved)
nib.freesurfer.read_geometry(args.sphere_sub)
np.empty(shape=c.shape)
interpolate(warp, args.sphere_sub)
spherical_to_cartesian(r, phi_prime, theta_prime)
nib.freesurfer.io.write_geometry(args.sphere_reg, coords, faces)
xyz2degree(lh_sphere_sub, lh_sulc_sub)
xyz2degree2(phi_prime, theta_prime, lh_sulc_sub)
xyz2degree(lh_sphere_freesurfer, lh_sulc_sub)
print(np.nanmax(dif_moved_moving)
np.nanmin(dif_moved_moving)
np.nanmean(dif_moved_moving)
plt.figure(figsize=(14, 7)
plt.imshow(dif_moved_moving)
plt.title('moved_moving')