I tried to use the function isosurface
with marching_cube
, from Meshing.jl
.
I have volumetric data in an array of size(91, 109, 91), with Float64 values in the interval [-3, 3], and I wanted to get the mesh for the isosurface corresponding to iso=1.25 (a brain).
Inspecting the array (https://drive.google.com/file/d/12eBKRzlnSD8gZJmpV9ahPmFPK9Mcat4B/view?usp=sharing)
findall(x->x==1.25, brain_vol)
I get:
CartesianIndex{3}[]
Although no array element has exact this value, I was expecting that calling
verts, triangles = Meshing.isosurface(brain_vol, MarchingCubes(iso=1.25));
to get the brain mesh (because other tools work even in this case), but plotting it I get an empty plot.
Trying with Python skimage marching_cube
verts, triangles= skimage.measure.marching_cubes_lewiner(brain_vol, 1.25)
I get:
I suspect that the algorithm used by skimage selects values at some distance from the transmitted iso-value.
My question:
Is there a keyword that must be set when calling Meshing.isosurface()
to ensure that it generate the right mesh?
Meshing.isosurface(brain_vol, MarchingCubes(iso=1.25));
returns non-empty verts
and triangles
, but using almost the same code(Plotly JS vs plotly.py) for visualizing meshes, I get an empty plot with PlotlyJS, that works for any other mesh I tested. Here is the code to get the brain mesh:
using Meshing
using NPZ
brain_vol = npzread("MNI152.npy")
verts, triangles = Meshing.isosurface(brain_vol, MarchingCubes(iso=1.25));