该程序将对给定的CT扫描进行分段。为此,我创建了一个深度学习模型。我在python中将CT扫描作为.nrrd文件读取,并将其转换为numpy数组,然后在此基础上训练我的模型。使用这个模型,我预测了一个正常工作的numpy阵列。当我尝试将此3d numpy数组转换为网格并最终转换为.stl格式时,就会出现问题
predImg = predictVolume(imgTarget)
vertices,faces,_,_ = marching_cubes_lewiner(predImg)
def dataToMesh(vert, faces):
mm = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, f in enumerate(faces):
for j in range(3):
mm.vectors[i][j] = vert[f[j],:]
return mm
mm = dataToMesh(vertices, faces)
mm.save('tooth-segmented.stl')
目前没有回答
相关问题 更多 >
编程相关推荐