Counting the number of maxima in the profileplot

Does the following capture your issue? If yes, then proceed

I used the ProfilePlot API for getting the profile of the binary imagery and now wants to count and display the number of peaks using IJ.log(""+num_of_peaks). I also tried to use the condition profile[j-1]<profile[j]<profile[j+1]. But did not got the exact result. Appreciate your help

Hi @harsha09,

you can use maxima = Array.findMaxima(profile, tolerance) to get the maxima. Have a look at the Extrema of current line profile example at https://imagej.nih.gov/ij/macros/examples/FindMaxima1D.txt

2 Likes

Hi @volker

Thanks for the help.