3
3
*
4
4
* Returns the local maxima and minima of an ImageJ plot. Requires ImageJ 1.48d or newer.
5
5
* See http://fiji.sc/Find_Peaks for details.
6
- * Tiago Ferreira, v1.0.3 2014.06.19
6
+ * Tiago Ferreira, v1.0.4 2015.04.15
7
7
*/
8
8
9
9
import ij.IJ;
@@ -23,6 +23,7 @@ double minPeakDistance;
23
23
double minMaximaValue = Double.NaN;
24
24
double maxMinimaValue = Double.NaN;
25
25
boolean excludeOnEdges;
26
+ boolean listValues;
26
27
27
28
int[] findPositions(double[] values, double tolerance, boolean minima) {
28
29
int[] positions = null;
@@ -57,15 +58,16 @@ boolean prompt() {
57
58
gd.addNumericField("Min._value of maxima:", minMaximaValue, 2, 6, "(NaN: no filtering)");
58
59
gd.addNumericField("Max._value of minima:", maxMinimaValue, 2, 6, "(NaN: no filtering)");
59
60
gd.addCheckbox("Exclude peaks on edges of plot", excludeOnEdges);
61
+ gd.addCheckbox("List values", listValues);
60
62
gd.addHelp("http://fiji.sc/Find_Peaks");
61
63
gd.showDialog();
62
- boolean dialogOKed = (gd.wasCanceled()) ? false : true;
63
64
tolerance = gd.getNextNumber();
64
65
minPeakDistance = gd.getNextNumber();
65
66
minMaximaValue = gd.getNextNumber();
66
67
maxMinimaValue = gd.getNextNumber();
67
68
excludeOnEdges = gd.getNextBoolean();
68
- return dialogOKed;
69
+ listValues = gd.getNextBoolean();
70
+ return !gd.wasCanceled();
69
71
}
70
72
71
73
int[] trimPeakHeight(int[] positions, boolean minima) {
@@ -158,7 +160,10 @@ plot.addLabel(0.25, 0, minima.length +" minima");
158
160
plot.setColor(Color.BLACK);
159
161
plot.addLabel(0.50, 0, "Min. amp.: "+ IJ.d2s(tolerance,2) +" Min. dx.: "+ IJ.d2s(minPeakDistance,2) );
160
162
plot.setLineWidth(1);
163
+
161
164
if (plotTitle.startsWith("Peaks in"))
162
165
pw.drawPlot(plot);
163
166
else
164
- plot.show();
167
+ pw = plot.show();
168
+ if (listValues)
169
+ pw.getResultsTable().show("Plot Values");
0 commit comments