1

I did a 3D segmentation of an organ in a 3D volume of data acquired in CT. The output of the segmentation is defined as a binary 3D ndarray, where 1 is inside the organ, and 0 is outside the organ.

What is the best tool to extract the surface of this object as a mesh, that I can then export into a mesh format such as .stl?

Thanks!

BayesianMonk
  • 540
  • 7
  • 23

1 Answers1

0

I'm not sure that is a best variant, but there is easy way to do it if use MeshLib.

To install it on Windows use py -3.10 -m pip install --upgrade meshlib

Script to do this will look like:

import meshlib.mrmeshpy as mr
import meshlib.mrmeshnumpy as mrn

#convert 3D array to SimpleVolume data
simpleVolume = mrn.simpleVolumeFrom3Darray(inputData)

#convert SimpleVolume to FloatGrid data
floatGrid = mr.simpleVolumeToDenseGrid(simpleVolume )

#make mesh by iso-value = 0.5 and voxel size = (0.1, 0.1, 0.1)
mesh = mr.gridToMesh(floatGrid , mr.Vector3f(0.1, 0.1, 0.1), 0.5)

#save mesh
mr.saveMesh(mesh, "mesh.stl" )

I hope this helps you.