Skip to content

Commit

Permalink
2023.10.20 (1.54h2; Plot.getValues macro function)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Oct 20, 2023
1 parent b66c034 commit 05cbc4f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public class ImageJ extends Frame implements ActionListener,
MouseListener, KeyListener, WindowListener, ItemListener, Runnable {

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.54g";
public static final String BUILD = ""; //33
public static final String VERSION = "1.54h";
public static final String BUILD = "2";
public static Color backgroundColor = new Color(237,237,237);
/** SansSerif, 12-point, plain font. */
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
Expand Down
14 changes: 10 additions & 4 deletions ij/gui/HistogramPlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,16 @@ public double[] getXValues() {

@Override
public void show() {
if (IJ.isMacro()&&Interpreter.isBatchMode())
super.show();
else
new HistogramWindow(this, WindowManager.getImage(srcImageID));
HistogramWindow hw = new HistogramWindow(this, WindowManager.getImage(srcImageID));
try {
ResultsTable rt = hw.getResultsTable();
int col = rt.getColumnIndex("value");
float[] xvalues = rt.getColumn(col);
col = rt.getColumnIndex("count");
float[] yvalues = rt.getColumn(col);
setProperty("XValues", xvalues); // Allows values to be retrieved by
setProperty("YValues", yvalues); // by Plot.getValues() macro function
} catch (Exception e) {}
}

}
9 changes: 8 additions & 1 deletion ij/macro/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2346,8 +2346,15 @@ void makeSelection() {
Variable yvar = getLastArrayVariable();
float[] xvalues = new float[0];
float[] yvalues = new float[0];
IJ.wait(100); //https://forum.image.sc/t/plot-getvalues-returns-odd-results/72673
ImagePlus imp = getImage();
long maxDelay = 100; //https://forum.image.sc/t/plot-getvalues-returns-odd-results
long t0 = System.currentTimeMillis();
while ((System.currentTimeMillis()-t0)<maxDelay) {
if (imp.getProperty("XValues")!=null || imp.getTitle().startsWith("Plot of"))
break;
IJ.wait(5);
imp = getImage();
}
ImageWindow win = imp.getWindow();
if (imp.getProperty("XValues")!=null) {
xvalues = (float[])imp.getProperty("XValues");
Expand Down
12 changes: 11 additions & 1 deletion ij/plugin/Distribution.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ public void run(ResultsTable rt) {
maxCount = stats.histogram[i];
}
stats.histYMax = maxCount;
new HistogramWindow(parameter+" Distribution", imp, stats);
HistogramWindow hw = new HistogramWindow(parameter+" Distribution", imp, stats);
try {
ResultsTable rt2 = hw.getResultsTable();
int col = rt2.getColumnIndex("bin start");
float[] xvalues = rt2.getColumn(col);
col = rt2.getColumnIndex("count");
float[] yvalues = rt2.getColumn(col);
ImagePlus img = hw.getImagePlus();
img.setProperty("XValues", xvalues); // Allows values to be retrieved by
img.setProperty("YValues", yvalues); // by Plot.getValues() macro function
} catch (Exception e) {}
}

int getIndex(String[] strings) {
Expand Down
8 changes: 8 additions & 0 deletions release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
</head>
<body>

<li> <u>1.54h 20 October 2023</u>
<ul>
<li> Thanks to 'IztokD', fixed bugs with the Plot.getValues() macro
function not working in batch mode.
<li> Thanks to Nick Condon, fixed a 1.53 regression that made the
Plot.getValues() macro function slower.
</ul>

<li> <u>1.54g 18 October 2023</u>
<ul>
<li> Thanks to Yuekan Jiao, added a "16-bit histogram"
Expand Down

0 comments on commit 05cbc4f

Please sign in to comment.