Question about fit ellipsoid

I have a question about your software, bonej, particularly, fit ellipsoid function.

I have binary X-ray CT scan images, and when I stack them, it becomes a particle with very rough surface. I attached them at the end.
I want to find the best fit ellipsoid or a sphere of the outer space.
How can I do that?
On your website, I need a 3D image, and 9 point ROIs.

  1. What kind of input image does it require?
  2. I do not understand why do I need 9 points of ROIs.

Thank you.

The input image is not important. All that is required is 9 point ROIs saved in the ROI manager.

Typical usage is for things like defining the best fit ellipsoid to something like a joint surface (femoral condyle, mandibular condyle), where the surface is difficult to segment out, or where it is easy to place point ROIs on the surface.

If you set your ImageJ tool to point ROI, click on the point to add to the fit, then hit [t] on the keyboard (repeat 9 or more times), you will get points that Fit Ellipsoid then uses for a least squares fitting. You can also do a sphere fitting for a joint surface you expect to be spherical such as a femoral or humeral head .

You need 9 points because 9 is the smallest number of (x, y, z) coordinates that you can fit a unique ellipsoid to.

Hi Hun_Baek,

There are no special requirements for the image apart from it having at least five slices.

The tool tries to fit an ellipsoid around the points you draw on the image. This requires solving an equation with nine terms, so at least nine points are needed. These terms correspond to: translation in x, y and z, radii a, b, c, and orientation in relation to the xy-, xz- and yz- planes.

Best regards,

1 Like

Thank you very much for your reply.

I understood you for the most part.
I still do not understand where to select as point ROIs.
I uploaded one of ths image from the stack.
There are 100 images for a stack like the one attached.
Where would you select in that case?

You should put the points where you want the ellipsoid to go, e.g. on the boundary between white and black.

It may answer your question better to calculate moments of inertia. The inertia moments can be translated to an ellipsoid of inertia. This will, however, reflect the distribution of foreground pixels through the bulk of your sample and not just the surface.

Hi @Hun_Baek,

If you want to fit an 3D ellipsoid from a binary image, you can try the 3D fit ellipsoid 3D plugin part of the 3D ImageJ Suite. As explained by @mdoube it will compute the moments from the boundaries and fit an 3D ellipsoid.



1 Like

Hi @ThomasBoudier

As explained by @mdoube it will compute the moments from the boundaries and fit an 3D ellipsoid.

Could you please tell me any reference about this method?
I am writing a paper using 3D ellipsoid fitting by 3D Roi Manager

Thank you.

Hi @xackey2001,

This is based on the computation of moments, the documentation is updated :



1 Like

Hi @ThomasBoudier

Thank you very much!!


I am wondering if it is possible to display all 3 radii instead of only the one from the longest axis? Maybe even with their corresponding name (R1, R2, R3)? This would make it easier to distinguish axes which are very similar in length.

Hi @Sreusch

If you are using the 3D ellipsoid fitting plugin you will get all the information for all the radii/axes.



Hi @ThomasBoudier

I am aware of that. I was referring to the image outputs you get when using the 3D ellipsoid fitting. You get three images (“Ellipsoids”, “Vectors” and "Oriented Contours). In the “Vectors” output image only the longest vector R1 is being displayed. Is it possible to also display R2 and R3 in the same image?

Dear all

I calculated the ratio between the volume of the object and the volume of the best fitted ellipsoid. Is there a name for this value? It is ellipsoidality?

Hi @Sreusch,

The option will be available in the next update.



Hi All,

I have one question regarding ellipsoid fitting plugin.
What does it physically mean by 2 is main axis?
What are those angle 0, Angle 1 , angle 2
obj 0-255 (2 is main axis)
0: Vector 0 : (-0.999, -0.025, 0.031)
0: Value 0 : 0.583
0: Value sqrt 0 : 0.763
Angle 0 with plane XY 1.7532486772472475
Angle 0 with plane XZ 1.4571214312434044
Angle 0 with plane YZ 87.71999777313007

Hi @tuktuk,

There are 3 axes in an ellipsoid, in the computation of the matrix to compute the 3 vectors corresponding to these axes, by convention, the main longest axis is 2. So vector 0 correspond to the smallest axis, 1 the median axis and 2 the main largest axis. So angle 0 with plane XY is the angle between vector 0 and plane XY, …

Hope this helps


1 Like

Thank you so much. It will help a lot. I had one more confusion.

radii=5.464 3.081 1.707
Does it mean c2(largest axes), c1, c0? Something like this?

Yes, these are the radii for the three axes in descending order.



Thanks a lot. It will be helpfull

Actually we are doing some analysis. It will really helpful if we some more information.

0: Vector 0 : (-0.005, -0.015, -1)
0: Value 0 : 0.164
0: Value sqrt 0 : 0.405
What does it mean by value “0: Value 0 : 0.164” and “Value sqrt 0 : 0.405”
What information we can get from these lines?

‘Max :2.600365203138035
major from distance 2.3108689949005776 2.3108578034489624’