import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
image = *.GetOutput() #只要得到的数据类型为vtkimage即可
rows, cols, _ = image.GetDimensions()
scalars = image.GetPointData().GetScalars()
arr = vtk_to_numpy(scalars)
arr = arr.reshape(rows, cols, -1)
vtkimage to numpy
最新推荐文章于 2024-06-02 10:03:11 发布