Skip to content

Commit

Permalink
2024.12.05 (1.54m; Release version)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Dec 6, 2024
1 parent af2a85e commit 7257bdd
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 51 deletions.
12 changes: 12 additions & 0 deletions functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -3642,6 +3642,13 @@ <h1>Built-in Macro Functions</h1>
Sets the selection stroke width.
<br>

<a name="Roi.setMinStrokeWidth"></a>
<b>Roi.setMinStrokeWidth(minWidth)</b><br>
Sets the minimum scaled stroke width
(<a href="http://wsr.imagej.net/macros/Polygons.ijm">example</a>).
Requires 1.54m.
<br>

<a name="Roi.setUnscalableStrokeWidth"></a>
<b>Roi.setUnscalableStrokeWidth(width)</b><br>
Sets the width of the line used to draw this
Expand Down Expand Up @@ -4595,6 +4602,11 @@ <h1>Built-in Macro Functions</h1>
to 8-bit and 16-bit are density calibrated when this
option is enabled, so results from measurements stay the same.
<br>
<a name="setOption_SetIJMenuBar"></a>
<b>setOption("SetIJMenuBar", boolean)</b><br>
Set the ImageJ menu bar on image window activation on Macs.
Requires 1.54m.
<br>
<a name="setOption_Show_All"></a>
<b>setOption("Show All", boolean)</b><br>
Enables/disables the the "Show All" mode in the ROI Manager.
Expand Down
4 changes: 2 additions & 2 deletions ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ImageJ extends Frame implements ActionListener,

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.54m";
public static final String BUILD = "28";
public static final String BUILD = ""; //37
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 Expand Up @@ -675,7 +675,7 @@ public void windowActivated(WindowEvent e) {
if (IJ.isMacintosh() && !quitting) {
IJ.wait(10); // may be needed for Java 1.4 on OS X
MenuBar mb = Menus.getMenuBar();
if (mb!=null && mb!=getMenuBar()) {
if (mb!=null && mb!=getMenuBar() && !IJ.isMacro()) {
setMenuBar(mb);
Menus.setMenuBarCount++;
//if (IJ.debugMode) IJ.log("setMenuBar: "+Menus.setMenuBarCount);
Expand Down
2 changes: 1 addition & 1 deletion ij/Prefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public class Prefs {
public static boolean autoRunExamples = true;
/** Ignore stack positions when displaying points. */
public static boolean showAllPoints;
/** Set MenuBar on Macs running Java 8. */
/** Set ImageJ menu bar on image window activation on Macs. */
public static boolean setIJMenuBar = IJ.isMacOSX();
/** "ImageJ" window is always on top. */
public static boolean alwaysOnTop;
Expand Down
5 changes: 2 additions & 3 deletions ij/gui/ImageWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ public void focusGained(FocusEvent e) {

public void windowActivated(WindowEvent e) {
if (IJ.debugMode) IJ.log("windowActivated: "+imp.getTitle());
if (IJ.isMacOSX())
if (IJ.isMacOSX() && Prefs.setIJMenuBar && !IJ.isMacro())
setImageJMenuBar(this);
if (imp==null)
return;
Expand Down Expand Up @@ -753,14 +753,13 @@ public static void setImageJMenuBar(ImageWindow win) {
if (mb!=null && mb==win.getMenuBar())
setMenuBar = false;
setMenuBarTime = 0L;
if (setMenuBar && ij!=null && !ij.quitting() && !Interpreter.nonBatchMacroRunning()) {
if (setMenuBar && ij!=null && !ij.quitting()) {
IJ.wait(10); // may be needed for Java 1.4 on OS X
long t0 = System.currentTimeMillis();
win.setMenuBar(mb);
long time = System.currentTimeMillis()-t0;
setMenuBarTime = time;
Menus.setMenuBarCount++;
//if (IJ.debugMode) IJ.log("setMenuBar: "+time+"ms ("+Menus.setMenuBarCount+")");
if (time>2000L)
Prefs.setIJMenuBar = false;
}
Expand Down
2 changes: 0 additions & 2 deletions ij/macro/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,6 @@ private void selectWindow() {
}
IJ.selectWindow(title);
resetImage();
interp.selectCount++;
}

void setForegroundColor() {
Expand Down Expand Up @@ -3234,7 +3233,6 @@ void selectImage() {
interp.getRightParen();
}
resetImage();
interp.selectCount++;
}

void selectImage(String title) {
Expand Down
26 changes: 6 additions & 20 deletions ij/macro/Interpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class Interpreter implements MacroConstants {
int loopDepth;
static boolean tempShowMode;
boolean waitingForUser;
int selectCount;

static TextWindow arrayWindow;
int inspectStkIndex = -1;
Expand Down Expand Up @@ -1975,8 +1974,6 @@ private String runStringFunction(String str) {
str = ""+str.length();
} else if (tokenString.equals("contains")) {
str = ""+str.contains(func.getStringArg());
} else if (tokenString.equals("charAt")) {
str = ""+str.charAt((int)func.getArg());
} else if (tokenString.equals("replaceAll")) {
str = func.replace(str);
} else
Expand All @@ -2000,6 +1997,11 @@ private String runStringFunction(String str) {
case TO_UPPER_CASE: getParens(); str = str.toUpperCase(Locale.US); break;
case REPLACE: str = func.replace(str); break;
case TRIM: getParens(); str = str.trim(); break;
case CHARAT:
int index = (int)func.getArg();
func.checkIndex(index, 0, str.length()-1);
str = ""+str.charAt(index);
break;
default:
str = null;
}
Expand Down Expand Up @@ -2094,11 +2096,6 @@ void finishUp() {
}
if (func.unUpdatedTable!=null)
func.unUpdatedTable.show(func.unUpdatedTable.getTitle());
if (IJ.isMacOSX() && selectCount>0 && debugger==null) {
Frame frame = WindowManager.getFrontWindow();
if (frame!=null && (frame instanceof ImageWindow))
ImageWindow.setImageJMenuBar((ImageWindow)frame);
}
}

/** Aborts currently running macro. */
Expand Down Expand Up @@ -2519,18 +2516,7 @@ static void setTempShowMode(boolean mode) {
}

private static Interpreter lastInterp;

public static boolean nonBatchMacroRunning() {
Interpreter interp = getInstance();
if (interp==null)
return false;
int count = interp.selectCount;
if (interp==lastInterp)
interp.selectCount++;
lastInterp = interp;
return !interp.waitingForUser && interp.debugger==null && count>0 && !isBatchMode();
}


public void setApplyMacroTable(ResultsTable rt) {
applyMacroTable = rt;
}
Expand Down
6 changes: 3 additions & 3 deletions ij/macro/MacroConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,20 @@ public interface MacroConstants {
TO_LOWER_CASE=2011, TO_UPPER_CASE=2012, RUN_MACRO=2013, EVAL=2014, TO_STRING=2015, REPLACE=2016,
DIALOG=2017, GET_METADATA=2018, FILE=2019, SELECTION_NAME=2020, GET_VERSION=2021, GET_RESULT_LABEL=2022,
CALL=2023, STRING=2024, EXT=2025, EXEC=2026, LIST=2027, DEBUG=2028, IJ_CALL=2029, GET_RESULT_STRING=2030,
GET_DIR=2031, TRIM=2032;
GET_DIR=2031, TRIM=2032, CHARAT=2033;

static final String[] stringFunctions = {"d2s", "toHex", "toBinary", "getTitle", "getString", "substring",
"fromCharCode", "getInfo", "getDirectory", "getArgument", "getImageInfo",
"toLowerCase", "toUpperCase", "runMacro", "eval", "toString", "replace",
"Dialog", "getMetadata", "File", "selectionName", "getVersion", "getResultLabel",
"call", "String", "Ext", "exec", "List", "debug", "IJ", "getResultString",
"getDir", "trim"};
"getDir", "trim", "charAt"};
static final int[] stringFunctionIDs = {D2S, TO_HEX, TO_BINARY, GET_TITLE, GET_STRING, SUBSTRING,
FROM_CHAR_CODE, GET_INFO, GET_DIRECTORY, GET_ARGUMENT, GET_IMAGE_INFO,
TO_LOWER_CASE, TO_UPPER_CASE, RUN_MACRO, EVAL, TO_STRING, REPLACE,
DIALOG, GET_METADATA, FILE, SELECTION_NAME, GET_VERSION, GET_RESULT_LABEL,
CALL, STRING, EXT, EXEC, LIST, DEBUG, IJ_CALL, GET_RESULT_STRING,
GET_DIR, TRIM};
GET_DIR, TRIM, CHARAT};

// Array functions
static final int GET_PROFILE=3000, NEW_ARRAY=3001, SPLIT=3002, GET_FILE_LIST=3003,
Expand Down
2 changes: 2 additions & 0 deletions ij/plugin/BatchProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ij.process.*;
import ij.gui.*;
import ij.util.Tools;
import ij.util.StringSorter;
import ij.io.*;
import ij.macro.Interpreter;
import java.awt.*;
Expand Down Expand Up @@ -189,6 +190,7 @@ void processFolder(String inputPath, String outputPath) {
list = FolderOpener.getFilteredList(list, filter, "Batch Processor");
if (list==null)
return;
StringSorter.sort(list);
int index = 0;
int startingCount = WindowManager.getImageCount();
for (int i=0; i<list.length; i++) {
Expand Down
10 changes: 6 additions & 4 deletions ij/plugin/CommandFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,15 @@ public void mouseClicked(MouseEvent e) {
long now = System.currentTimeMillis();
int row = table.getSelectedRow();
int col = table.getSelectedColumn();
IJ.wait(10);
// Display cell contents in status bar
if (tableModel==null)
return;
String value = tableModel.getValueAt(row, col).toString();
IJ.showStatus(value);
String value = (String)tableModel.getValueAt(row, col);
if (value!=null)
IJ.showStatus(value);
else
IJ.showStatus("");
// Is this fast enough to be a double-click?
long thisClickInterval = now - lastClickTime;
if (thisClickInterval < multiClickInterval) {
Expand Down Expand Up @@ -636,8 +640,6 @@ private void closeWindow() {
}

public void windowActivated(WindowEvent e) {
if (IJ.isMacOSX() && frame != null && Prefs.setIJMenuBar)
frame.setMenuBar(Menus.getMenuBar());
}

public void windowDeactivated(WindowEvent e) {
Expand Down
4 changes: 0 additions & 4 deletions ij/plugin/frame/PlugInFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ public void close() {
}

public void windowActivated(WindowEvent e) {
if (Prefs.setIJMenuBar) {
this.setMenuBar(Menus.getMenuBar());
Menus.setMenuBarCount++;
}
WindowManager.setWindow(this);
}

Expand Down
2 changes: 0 additions & 2 deletions ij/plugin/frame/Recorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1023,8 +1023,6 @@ public static void setBlackBackground() {

/** Override windowActivated in PlugInFrame. */
public void windowActivated(WindowEvent e) {
if (IJ.isMacintosh() && !IJ.isJava17() && Prefs.setIJMenuBar)
this.setMenuBar(Menus.getMenuBar());
WindowManager.setWindow(this);
}

Expand Down
24 changes: 14 additions & 10 deletions release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@
<body>


<li> <u>1.54m28 29 November 2024</u>
<li> <u>1.54m 5 December 2024</u>
<ul>
<li> Thanks to 'Jerry1144', added the setOption("setIJMenuBar",boolean)
macro function
(<a href="http://wsr.imagej.net/macros/MacWindowSwitchingDemo.ijm">example</a>). DOC
<li> Thanks to Kenneth Sloan, added the Roi.setMinStrokeWidth(minStrokeWidth)
macro function and Java method that you can use to specify a
minimum scaled stroke width
(<a href="http://wsr.imagej.net/macros/Polygons.ijm">example</a>). DOC
<li> Thanks to Michael Cammer, the <i>Orthogonal Views</i> command
no longer removes overlays.
<li> Thanks to 'Patricia' and Herbie Gluender, the
<i>Image&gt;Transform&gt;Image to Results</i> command
now shows NaNs when values are outside non-rectangular
selections.
<li> Thanks to Kevin Terretaz, CommandFinder
<li> Thanks to Kevin Terretaz, Command Finder
(<i>Plugins&gt;Utilities&gt;Find Commands</i>) filtering is more
precise and flexible. It now splits the input into individual words
and returns commands where all words are found in either the command
name or the menu path.
<li> Thanks to 'Jerry1144', added the setOption("SetIJMenuBar",boolean)
macro function.
<li> Thanks to Kenneth Sloan, added the Roi.setMinStrokeWidth(minStrokeWidth)
macro function and Java method that you can use to specify a
minimum scaled stroke width
(<a href="http://wsr.imagej.net/macros/Polygons.ijm">example</a>).
<li> Thanks to Bram van den Broek, fixed bug with duplicating hyperstacks when
the selection was outside the image border.
<li> Thanks to Giovanni Cardone and Michael Schmid, fixed bug with
right arrow in dialox box sliders not working as expected on
right arrow in dialog box sliders not working as expected on
Linux and Windows.
<li> Thanks to Giovanni Cardone and Michael Schmid, fixed bug where
the ImageProcessor.getLine() method returned a smaller than
Expand All @@ -50,6 +49,11 @@
not checked and "One row per slice" was.
<li> Thanks to 'scouser27', fixed a bug with how perimeters
of rotated rectangle selections are calculated.
<li> Thanks to Jurgen_Gluch and Ved Sharma, fixed bugs where the charAt()
macro function would return a number instead of a string and would
throw an exception if the index was out of range.
<li> Fixed a 1.54i regression that caused the Command Finder to throw an
exception when clicking on a blank field.
</ul>

<li> <u>1.54k 15 September 2024</u>
Expand Down

0 comments on commit 7257bdd

Please sign in to comment.