def cut_cube(npy_img,voxelCoord, z, width, y_bias, x_bias):
#voxelcoord: y,x,z
npy_ct = npy_img[int(voxelCoord[2] - z / 2):int(voxelCoord[2] + z / 2),:,:]
# datatype(z,y,x) = float32,to input to tensorflow
# y_bias, x bias for data augmentation
cube = np.ndarray([z, width, width], dtype=np.float32)
cube[:, :, :] = npy_ct[:,
int(voxelCoord[0] - width / 2 + y_bias):int(voxelCoord[0] + width / 2 + y_bias),
int(voxelCoord[1] - width / 2 + x_bias):int(voxelCoord[1] + width / 2 + x_bias)]
cube = normalizePlanes(cube)
return cube
评论列表
文章目录