def Affine_test(self,N,sizex,sizey,sizez,times,stop_time,typeofT,colors):
for i in range(times):
# Theta
idx = np.random.uniform(-1, 1);idy = np.random.uniform(-1, 1);idz = np.random.uniform(-1, 1)
swithx = np.random.uniform(0,1);swithy = np.random.uniform(0,1);swithz = np.random.uniform(0,1)
rotatex = np.random.uniform(-1, 1);rotatey = np.random.uniform(-1, 1);rotatez = np.random.uniform(-1, 1)
cx = np.array([idx,rotatey,rotatez,swithx]);cy = np.array([rotatex,idy,rotatez,swithy]);cz = np.array([rotatex,rotatey,idz,swithz])
# Source Grid
x = np.linspace(-sizex, sizex, N);y = np.linspace(-sizey, sizey, N);z = np.linspace(-sizez, sizez, N)
x, y, z = np.meshgrid(x, y, z)
xgs, ygs, zgs = x.flatten(), y.flatten(),z.flatten()
gps = np.vstack([xgs, ygs, zgs, np.ones_like(xgs)]).T
# transform
xgt = np.dot(gps, cx);ygt = np.dot(gps, cy);zgt = np.dot(gps, cz)
# display
showIm = ShowImage()
showIm.Show_transform(xgs,ygs,zgs,xgt,ygt,zgt,sizex,sizey,sizez,stop_time,typeofT,N,colors)
transformation_tests_func.py 文件源码
python
阅读 31
收藏 0
点赞 0
评论 0
评论列表
文章目录