@azonenberg So, focus stacking, but using image metadata instead of relying on visual detection of sharpness? No idea how to do that, I think you would need a 3D model of the subject to generate the mask.
@miermont The desired end goal would be a 3d polygon mesh of the sample, texture mapped with the focus stacked image.
@azonenberg That seems like an active research topic. I hope you'll find something usable.
@miermont Yeah its not at all an urgent need but I'll keep an eye open.
Basically I'm already used to navigating samples in 3D by focusing to figure out which features are above/below others intuitively. Seems like something you could do computationally to 3D pinpoint specific features, I just don't know how to do it.
@miermont Mathematica can do it https://www.wolfram.com/language/12/image-computation-for-microscopy/3d-reconstruction-via-focus-stacking.html?product=mathematica
Whether there's anything f/oss for Linux that can do the same is another question.
@miermont No the opposite. Use sharpness to stack then extract a 3d model from the focal plane masks.