Advertisement

pyvista进行三维重建3D体素数据

阅读量:
复制代码
 import pyvista as pv

    
 from pyvista import examples
    
 import numpy as np
    
 import vtk
    
 from scipy import ndimage
    
  
    
 pv.rcParams["use_panel"] = False
    
  
    
 # 1.载入体素数据raw格式
    
 imgData = np.fromfile('3d.raw', dtype=np.uint16)
    
 imgData = imgData.reshape(821, 1206, 276)/255.0 #灰度调整到0~255,数据还原为原始长宽高
    
 imgData =  np.asarray(imgData,dtype=np.uint8)
    
 #imgData = ndimage.zoom(imgData,0.5,order=3) #资源不够可考虑压缩
    
  
    
  
    
 # 2.创建标准网格
    
 grid = pv.UniformGrid()
    
 # Set the grid dimensions: shape + 1 because we want to inject our value

全部评论 (0)

还没有任何评论哟~