Skip to content

Commit ca5fe4a

Browse files
committed
FP: Add Option to display Plot's table
1 parent e9ec4ce commit ca5fe4a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Data_Analysis/Find_Peaks.bsh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Returns the local maxima and minima of an ImageJ plot. Requires ImageJ 1.48d or newer.
55
* 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
77
*/
88

99
import ij.IJ;
@@ -23,6 +23,7 @@ double minPeakDistance;
2323
double minMaximaValue = Double.NaN;
2424
double maxMinimaValue = Double.NaN;
2525
boolean excludeOnEdges;
26+
boolean listValues;
2627

2728
int[] findPositions(double[] values, double tolerance, boolean minima) {
2829
int[] positions = null;
@@ -57,15 +58,16 @@ boolean prompt() {
5758
gd.addNumericField("Min._value of maxima:", minMaximaValue, 2, 6, "(NaN: no filtering)");
5859
gd.addNumericField("Max._value of minima:", maxMinimaValue, 2, 6, "(NaN: no filtering)");
5960
gd.addCheckbox("Exclude peaks on edges of plot", excludeOnEdges);
61+
gd.addCheckbox("List values", listValues);
6062
gd.addHelp("http://fiji.sc/Find_Peaks");
6163
gd.showDialog();
62-
boolean dialogOKed = (gd.wasCanceled()) ? false : true;
6364
tolerance = gd.getNextNumber();
6465
minPeakDistance = gd.getNextNumber();
6566
minMaximaValue = gd.getNextNumber();
6667
maxMinimaValue = gd.getNextNumber();
6768
excludeOnEdges = gd.getNextBoolean();
68-
return dialogOKed;
69+
listValues = gd.getNextBoolean();
70+
return !gd.wasCanceled();
6971
}
7072

7173
int[] trimPeakHeight(int[] positions, boolean minima) {
@@ -158,7 +160,10 @@ plot.addLabel(0.25, 0, minima.length +" minima");
158160
plot.setColor(Color.BLACK);
159161
plot.addLabel(0.50, 0, "Min. amp.: "+ IJ.d2s(tolerance,2) +" Min. dx.: "+ IJ.d2s(minPeakDistance,2) );
160162
plot.setLineWidth(1);
163+
161164
if (plotTitle.startsWith("Peaks in"))
162165
pw.drawPlot(plot);
163166
else
164-
plot.show();
167+
pw = plot.show();
168+
if (listValues)
169+
pw.getResultsTable().show("Plot Values");

0 commit comments

Comments
 (0)