# ImageJ Ops - Eccentricity Calculation

#1

I am very sorry to disturb you again, you all have answer me lot of time. :(. I have trouble in using Imagej-ops library. I am in a situation I need to calculate Eccentricity of a selected blob.

I hope this statistical feature can be calculated through DefaultEccenrricity class in imagej-ops.

I have searched any plugin which facilitate to calculate Eccentricity But I could’t find one. This plugin can calculate something but the given results from that plugin cannot accept. It gives unacceptable huge values.

Thank you very much for the time you spend on these issues.

#2

Good day!

If the object is selected, I’d apply

`IJ.run(imp, "Fit Ellipse", "");`

and then get the coordinates of the fitted ellipse. However, there are other ways to define eccentricity of irregular objects.

Regards

Herbie

#3

Hi…Good day to you…too…I was thinking about that too Fit a Ellipse(same area) to the object and measure the eccentricity. but I had issues how accurate that was. actually these blobs are extracted from the digital mammograms and blobs are suspected as tumors. Since I am converting some existing work done using matlab, I am trying to reproduce those matlab fuctions using imagej and java. I think in matlab also they do the same. So no worries I will try that. Thank you very much…!

#4

This is the implementation of DefaultEccentricity. Which first computes the major- and minor-axis of the ROI.

The major- and minor-axis are based on the second central moment of the ROI. A nice description can be found here.

I would guess that the ellipsoid fitting in imagej-ops is different to your Matlab implementation. Do you know how the ellipsoid is fitted in Matlab?

#5

Thank you very much for your in detail answer. Actually in matlab implementation it has used typical matlab eccentricity. As the description says it is same as DefaultEccentricity, This answer confirms it. In imagej ops. I have tried to use it but I face some difficulties of using it.(due to lack of knowledge in using imagej-ops in a java programme.) Then I have tried fitting the area to a ellipse and using EllipseFitter class in imagej. From that I have calculated the major and minor axis and then calculated the eccentricty from that raw data, as belows…!

``````        ImageProcessor ipr3 = myImage.getProcessor();
EllipseFitter ep = new EllipseFitter();
ImageStatistics IS = image.getStatistics();
ep.fit(ipr3,IS);

double majorAxis = ep.major;
double minorAxis = ep.minor;
double a = majorAxis/2;
double b = minorAxis/2;
double c = Math.sqrt((a*a)-(b*b));
double eccentricity = c/a;
``````

But I feel that it is much important to learn how use Imagej-ops library in java programmes.

#6

So whats wrong with your code that follows my suggestion?

What else do you expect from the use of the Imagej-ops library?

Clueless

Herbie

#7

I tried to indicate the usability and importance of imagej-ops may be very important in future steps. For this step I think this works perfectly @Herbie. As your suggestion I have built that code and thank you very much for the assistance. I hope major and minor axis which calculates from the EllipseFitter class also based on the second central moment of the ROI(I couldn’t find that information).

Thank you very much…!

#8

I don’t know about the approach using moments but a great difference is that moments can be computed from arbitrary shapes, i.e. they do not require a fitting function.

Regards

Herbie