This issue has already been mentionned here but I couldn’t find any clear answer.
Theoretically, working with the radii of the ellipse that fits the object should be the best way for me to measure my objects. However, it looks like the radii are highly underestimated by Ilastik, I get a final size value that is almost 50% below the expected value. I saw that some other people encountered this problem, has any of you found a solution ?
I don’t know how the radii are calculated by Ilastik but there must be a mistake in the code of the feature. Indeed, if I make a circle with a 50 pixels diameter, the radii that Ilastik gives me are both 25 pixels long which is exactly half the length I expected.
A confusion between the diameter and the radius must have been made, the radii are then divided by 2 whereas they shouldn’t be.
I have similar observations.
My solution for today:
I import the file with Object Identities into FIJI, where, using the MorphoLibJ plugin, I take the necessary measurements (at the same time, you can apply a scale (pix to metric) for the image).
I agree that there has been a simple error in the coding of Ilastik. In order to get the proper radii you must simply multiply them by 2. This is probably going to have to be the workaround that we use. It would be good to notify users of this problem in the Ilastik documentation. It took me a long time to figure out what was happening.
TLDR: Radii in ilastik are the eigenvalues (-> variance) of the PCA of all object pixels. There is no non-data dependent factor to get the radii of an ellipse fitted to the data. Maybe the naming of these features should be improved - however, I don’t think we’ll change that due to legacy reasons. Size is underestimated.
Quote from the description text for the radii:
“Eigenvalues of the PCA on the coordinates of the object’s pixels. Very roughly, this corresponds to the radii of an ellipse fit to the object. The radii are ordered, with the largest value as first.”
In ilastik, the PCA measuress are used in machine learning as a feature, exploiting the property of the PCA to generate similar values for similar objects in classification.
A statement like the following, underscores that naming the feature “Radii” is not intuitive.
A factor of 2 is only true under certain conditions, namely the object has elliptical shape, all inside pixels are filled -> no defects whatsoever.
In contrast, if your object were a very thin elliptical ring, you’d get a pretty accurate estimate of the radii with the factor \sqrt2…
So inferring the radius of a fitted ellipse from PCA involves quite some knowledge about the object.
But we are working with real objects, most likely. So no perfect ellipses. What do you mean by ellipse fitted to the data?
smallest ellipse that encloses all object pixels?
ellipse that minimizes distance to all boundary points?
that is a sensible solution if you’re interested in proper ellipse fits.