This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at imagej.net.

Find Peaks

Find Peaks (ImageJ/Fiji)
Author Tiago Ferreira
Maintainer BAR update site
File on GitHub
Source on GitHub
Initial release February 2014
Category Analysis, Scripting, Plugins


A BAR script (written in BeanShell) that retrieves local maxima and minima from an ImageJ plot. The easiest way to install Find Peaks is by subscribing to the BAR update site.

Options

Analysis of synthetic data plotted from a .csv file. CSV files can be imported into ImageJ by drag and drop, or by using File▷ Import▷ Results. Once options are specified, coordinates of retrieved peaks are logged to the table of a new plot window
Peak amplitude
The smallest depth (in Y-axis units) that a qualified valley must exceed. By default, it is set to one standard deviation of the data.
Min. value of maxima
The smallest value (in Y-axis units) a qualified maxima must exceed. This filter is disabled when set to NaN (Not a Number).
Max. value of minima
The highest value (in Y-axis units) a qualified minima must not exceed. This filter is disabled when set to NaN (Not a Number).
Min. peak distance
The smallest separation between peaks (in X-axis units). When this value is not zero (the default), smaller peaks within the specified vicinity will be ignored. This works in the following way: 1) Identified peaks that fulfill all of the above criteria are sorted in descending order (largest to smallest amplitude); 2) Beginning with the largest peak, the script ignores all remaining peaks that are not separated by more than the specified Min. peak distance. Applies to both maxima and minima.
Exclude peaks on edges of plot
If active, a peak is only accepted if it is separated by two qualified valleys. If disabled (the default), peaks at the limits of the data range (i.e., flanked only by one valley) are also considered.
List values
If active, the Plot's table will be displayed (as frontmost window), allowing values to be saved programmatically when calling Find Peaks from other macros or scripts. Examples:
// From an ImageJ macro
run("Find Peaks", "min._peak_amplitude=35 min._peak_distance=0 min._value=NaN max._value=NaN list");
saveAs("Results", "/Path/to/Output/Directory/Plot Values.csv");
run("Close");

// From a script
IJ.run("Find Peaks", "min._peak_amplitude=35 min._peak_distance=0 min._value=NaN max._value=NaN list");
IJ.saveAs("Results", "/Path/to/Output/Directory/Plot Values.csv");
WindowManager.getActiveWindow().close()

Notes

  • Both maxima and minima are listed in descending order, from the largest to smallest amplitude
  • Peaks with flat tops are retrieved at their centers
  • Peak coordinates are logged according to the following layout: [X0,Y0]: Original data; [X1,Y1]: Maxima; [X2,Y2]: Minima
  • Min. peak distance can be used for peak width filtering
  • Use Scientific notation and Decimal places in Analyze › Set Measurements... to improve the representation of values that are too big or too small to be displayed in the decimal form
  • Find Peaks was initially though as a complementary tool for Sholl Analysis but it that can be applied to any dataset. For this reason, it is now part of BAR

Related Resources

Analysis of 1D-signals was discussed in March 2014 on the ImageJ mailing list. That discussion highlighted the following alternatives to Find Peaks:

Installation

The easiest way to install Find Peaks is by subscribing to the BAR update site.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.