Area under the curve


Hello guys,

I’ve one simple question, but after some hours (to be honest days) of google research 'm still unable to solve my problem:

I get a graph as results of an experiment of mine. Just a simple graph. Now I want ImageJ to measure the area unter this graph on particular sections and probably I’m just to stupid to get it. The best tries I got have been via using Analyze>Tools>Line graph (after using threshold till my graph gets red etc.), when a new window opens and I can select some areas under my curve but only the ones “pre-rasterized” by the grid ImageJ uses. I don’t want to do it by selecting areas “free-hand” because of the deviations in measurement…

Is there any chance to calculate my areas of interest in ImageJ or do I have to export the values and do the calculation in Excel?

I attached an JEPG of my graph.

I know for really working with you need a .TIFF or .RAW but for illustrating what my graphs look like it should be ok.

Thank you vermy much for your help an greetings from Germany!


Good day,

you write that you have the plotted curve as function values. If this is the case, then you really should use a 1D signal processing software, such as Origin, Kaleidagraph or the like to do the integration (area). Maybe even Exel will do but I can’t tell because I never used it.




Dear @Elros,

I propose you a python script that implement the simplest trapezoidal rule for integration, from here:

and use the analyse line graph tool of imageJ/Fiji

so essentially in someway it isolates your graph and get the x,y coordinates and integrate doing a trapezoidal approximation (that I hope to have implemented well :wink: ).

I think it’s necessary to set black as foreground and white as background in the colors menu and also uncheck black background in the process, binary menu.

from ij import IJ, WindowManager

def trapezoidal_rule(xValues,yValues):
    n = len(xValues);
    area = 0
    for i in range(0, n-1):    	
    	area +=  (xValues[i+1]-xValues[i])/2*(yValues[i+1]+yValues[i])      	
    return area

imp = IJ.openImage("");, "8-bit", "");
IJ.setAutoThreshold(imp, "Default");, "Convert to Mask", "");, "Dilate", "");, "Dilate", "");
IJ.doWand(imp, 15, 33, 0.0, "Legacy");, "Analyze Line Graph", "");
myPlot = WindowManager.getWindow("Line Graph")
# get the DATA! :)
rt_plot = myPlot.getResultsTable()

xValues = rt_plot.getColumn(0) #get XValues
yValues = rt_plot.getColumn(1) #get corresponding YValues

area = trapezoidal_rule(xValues,yValues)


In any case, I agree with @Herbie that maybe use some more numerical tool it could be better to analyse your graph.

Let me know if it helps you,
have a nice day