The function "imInertiaEllipsoid" computes inertia coefficients of the 3D image, and returns the associated equivalent 3D ellipsoid. The function "drawEllipsoid" can be used to display result.
The package also contains function imInertiaEllipse, that returns equivalent ellipse for 2D images. Results is similar to that obtained with IPT function regionprops, but with different output format. The result can be used directly with function 'drawEllipse'.
Display of 3D image in the example requires the "slicer" contribution, also on FileExchange (ID 27983).
Package includes functions from geom2d and geom3d contributions.
For Kim (small update to my previous comment):
actually the coefficient of 2 produces an ellipsoid that encloses most of the image voxels. This can be seen as an analogy to the computation of the interval containing 95% of the values of a random variable following gaussian distribution: the interval is given by +/-1.96 times the square root of the variance around the mean.
Hi Kim,
well, actually I do not remember where does the factor 2 comes from... I suppose I have adjusted manually such that the size of the resulting ellipsoid better fit the original image.
I'm just wondering why you multiplied 2 by square root of eigenvalues (for covariance matrix of points) (i.e., singular values that means scaling factors in each dimension) when caculating lengths of semi-axes (radii) of an elllipsoid at the imInertiaEllipsoid.m