颗粒CT扫描数据使用Avizo重建后,需要将每个颗粒单独保存为一个文件,再进行后续的分析。前几部都可参考以下视频。
【Avizo Amira培训练习】 孔隙(或颗粒)分析 Colorize by Measure_哔哩哔哩_bilibili
每个颗粒单独分割后,软件内不支持批量将分割结果导出,只能通过python脚本将每个颗粒导出。因为python调用的是左侧project,因此只能导出VRWL文件,再通过python转为stl\obj格式。
需要先按照如下路径分割颗粒
python脚本自动化操作的是上述红框内的部分,起点是pmma1-483(3).label,通过修改Interactive Thresholding(2)中的intensityRange来选择要保存的颗粒。
要注意的是Interactive Thresholding(2)、Generate Surface、Smooth Surface、Export to VRML都要勾选auto-refresh,否则就在代码中加入thresh.execute()执行“Apply”,二者选其一即可。
num = int(hx_project.get('pmma1-483(3).label').range[1])
for i in range(1, num + 1):
thresh = hx_project.get('Interactive Thresholding(2)')
thresh.ports.intensityRange.range=(i,i)
thresh.execute()
export = hx_project.get('Export to VRML')
export.ports.filename.filenames = f'D:/fooling_around/PMMAbubble/pmma1_wrl/{str(i).zfill(3)}.wrl'
export.execute()
如果弹出警告框,需要手动点击Continue,如果颗粒很多可以使用鼠标连点器……这很工程。