在VTK中,我如何读取.stl文件并写入.mha文件

问题描述 投票:0回答:2

一些示例如何在主题中完成任务?在Python中更可取。

我假设.stl是3D表面图像,.mha是3D体积(像素的3维数组(已压缩?))。必须在中间进行一些处理(填充在表面内部)。

谢谢,

路易斯·贡萨尔维斯

multidimensional-array stl vtk
2个回答
0
投票

您可以在this example中检查vtkplotter

enter image description here

要保存音量,请添加:write(v, 'vol.mhd')


0
投票

[您也可以尝试使用VTK的PolyDataToImageDataStencil过滤器。大概就是vtkplotter在下面使用的。

以下是使用vtkPolyDataToImageStencil的Python示例:https://lorensen.github.io/VTKExamples/site/Python/PolyData/PolyDataToImageDataStencil/

这是该类的文档:https://vtk.org/doc/nightly/html/classvtkPolyDataToImageStencil.html

© www.soinside.com 2019 - 2024. All rights reserved.