This project is interesting to me. If you can provide a "typical" data set, I may be able to write something for you.
No guarantees - but this fits in with other work I am doing, and some tools that I have at hand.
> On Jan 26, 2021, at 10:27, Kenneth R Sloan <
[hidden email]> wrote:
>
> The minimum enclosing sphere problem is well studied, but most people consider the general case of d dimensions - which may ignore the special properties of 3D. Also, the problem can be fraught with numerical issues. Google “minimal bounding sphere” for details.
>
> The computational geometry package, CGAL, contains an implementation.
>
> I am unaware of any ImageJ function that does this - so you are looking at writing something fairly significant in Java.
>
> Most of my ImageJ work involves Java plugins, and I have a collection of computational geometry routines that, alas, do not (yet) include this function.
>
> Finding the Convex Hull seems like a good first step, if only because it might make a very naive minimal sphere program fast enough. But...the best minimal sphere methods appear to be linear in the number of points (in fixed d), and 3D convex Hull is slower than that. The advantage might be that 3D Convex Hull might already exist and might let you get away with a very slow method to find the sphere from those vertices. That’s a lot of “mights”.
>
> Bottom line - I suspect that you will have to write your own code in Java to do this. I suspect this is true also for your alternative plan to find the max distance between vertices of the 3D Convex Hull. Of course, that program is much simpler.
>
> Questions: how many boundary points do you expect? How many vertices of the 3D Convex Hull do you expect? And...the kicker...how FAST do you need this computation to be?
>
> One more - do you need an exact solution, or is an approximation good enough?
>
> And another - how well behaved are your objects?
>
> On rereading - I see that you really want “longest axis”. That may be easier than “minimal bounding sphere” - but still unlikely to be a standard ImageJ computation. But, beware - “longest axis” can be tricky in a discrete world. Consider whether your application might prefer to find the axes of a best fitting ellipsoid, instead. For example, consider a brick - do you really want one of the diagonals?
>
> Finally, it’s not completely clear to me that the minimal bounding sphere identifies the longest axis!
> This may be so - it’s just not immediately clear...to me.
>
> For many similar problems, I find it easier to use ImageJ to locate the boundary points and write them out to be processed by an external program.
>
> On Tue, Jan 26, 2021 at 03:16 Roosch, Svenja <
[hidden email] <mailto:
[hidden email]>> wrote:
> Hello everyone!
>
>
> I have a stack of binary images that is to be interpreted as a 3D image. I have background (in black) and one irregular-shaped object in it (the model of a soil aggregate). I now want to know the longest axis of this object.
>
>
> I thought the easiest way would be to let a function find the smallest containing sphere and take the diameter. I am aware that in BoneJ, there is a function that allows to find an optimal sphere based on points that are marked by hand. This is, however, not quite what I need and I hope to find a solution without too much manual work, since actually, I have a bit more than one stack. Is anyone aware of a function that can do that?
>
>
> Another way might be to use the 3D Convex Hull package that can find me the vertices of a convex hull of a 3D object. Does anyone have an idea how to find the largest pair-wise distance between them in ImageJ? Or is this something that's better done with another program?
>
>
> Any hint is appreciated. Thanks in advance!
>
> All the best,
>
> Svenja
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html <
http://imagej.nih.gov/ij/list.html>
> --
> -Kenneth Sloan