# ImageMesh for continuous 3D images

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

1. ImageMesh[], works on binary 3D images, allows control of algorithms, marching cubes, etc.
2. 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]]


DiscretizeGraphics[g]


Or refine the increment in the Table command:

distanceFunction = SignedRegionDistance[Ball[]];
step = 0.02;
imageData =
Table[distanceFunction[{x, y, z}], {x, -1, 1, step}, {y, -1, 1,
step}, {z, -1, 1, step}];
fixedLevel = 0;
imageBinarized = Binarize[Image3D[-imageData], fixedLevel]

ImageMesh[imageBinarized, Method -> #] & /@ {"Exact", "MarchingCubes",
"DualMarchingCubes"}


• DiscretizeGraphics[g] works great, thank you! Refining the increments is not really an option, though, I hope to apply this algorithm to data that is {millions,millions, 3 to 5} in size . Having more voxels will cost me a lot. I would like to use an advanced algorithm i can control (like in ImageMesh), but with continuous data, like in ListContour... Oct 9, 2018 at 20:56