I have a 3D image containing distance fields, and would like to produce a mesh region from a contour at a fixed level.
I found two options for this
ImageMesh[]
, works on binary 3D images, allows control of algorithms, marching cubes, etc.ListContourPlot3D[]
, extract mesh manually, no control of algorithm, cannot get a 3D region as output
I feel I must be missing a way to operate ImageMesh
(or ArrayMesh
) without having to turn my data into binary form, as imageData
contains continuous values. I do want additional control over algorithm, which is missing from the ListContourPlot3D[]
way.
Can someone suggest a better way of doing this ?
distanceFunction = SignedRegionDistance[Ball[]];
imageData = Table[distanceFunction[{x, y, z}], {x, -1, 1, 0.2}, {y, -1, 1, 0.2}, {z, -1, 1, 0.2}];
fixedLevel = 0;
imageBinarized = Binarize[Image3D[-imageData], fixedLevel]
ImageMesh[imageBinarized , Method -> #] & /@ {"Exact", "MarchingCubes", "DualMarchingCubes"}
Note that ListContourPlot3D
uses original continuous data, not binary image
g = ListContourPlot3D[imageData, Contours -> {0}]
g[[1]][[1]]