Loading IJ_Props.txt +0 −1 Original line number Diff line number Diff line Loading @@ -414,7 +414,6 @@ new_07="Plugin Frame",ij.plugin.NewPlugin("frame") new_08="Plugin Tool",ij.plugin.NewPlugin("plugin-tool") new_09=- new_10="Text Window...",ij.plugin.NewPlugin("text+dialog") new_11="Table...",ij.plugin.NewPlugin("table") # Plugins installed in the Help/About submenu about01="About This Submenu...",ij.plugin.SimpleCommands("about") Loading build.xml +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ <!-- First, ensure the build directory exists. --> <mkdir dir="build" /> <!-- Build everything; add debug="on" to debug --> <javac srcdir="./ij" destdir="build" optimize="on" source="1.5" target="1.5" debug="on" includeantruntime="false" encoding="utf-8"> <javac srcdir="./ij" destdir="build" optimize="on" source="1.6" target="1.6" debug="on" includeantruntime="false" encoding="utf-8"> </javac> </target> Loading ij/Executer.java +8 −47 Original line number Diff line number Diff line Loading @@ -146,58 +146,19 @@ public class Executer implements Runnable { if (openRecent(cmd)) return; // is it an example in Help>Examples menu? if (openExample(cmd)) if (Editor.openExample(cmd)) return; if ("Auto Threshold".equals(cmd)&&(String)table.get("Auto Threshold...")!=null) runCommand("Auto Threshold..."); else if ("Enhance Local Contrast (CLAHE)".equals(cmd)&&(String)table.get("CLAHE ")!=null) runCommand("CLAHE "); else { if ("Table...".equals(cmd)) IJ.runPlugIn("ij.plugin.NewPlugin", "table"); else IJ.error("Unrecognized command: \"" + cmd+"\""); } } private boolean openExample(String name) { boolean isMacro = name.endsWith(".ijm"); boolean isJava = name.endsWith(".java"); boolean isJavaScript = name.endsWith(".js"); boolean isBeanShell = name.endsWith(".bsh"); boolean isPython = name.endsWith(".py"); if (!(isMacro||isJava||isJavaScript||isBeanShell||isPython)) return false; boolean run = !isJava && (Prefs.autoRunExamples||IJ.shiftKeyDown()||IJ.controlKeyDown()||IJ.altKeyDown()); int rows = 24; int columns = 70; int options = Editor.MENU_BAR; String text = null; Editor ed = new Editor(rows, columns, 0, options); String dir = "Macro/"; if (isJava) dir = "Java/"; else if (isJavaScript) dir = "JavaScript/"; else if (isBeanShell) dir = "BeanShell/"; else if (isPython) dir = "Python/"; String url = "http://wsr.imagej.net/download/Examples/"+dir+name; text = IJ.openUrlAsString(url); if (text.startsWith("<Error: ")) { IJ.error("Open Example", text); return true; } ed.create(name, text); if (run) { if (isJavaScript) ed.evaluateScript(".js"); else if (isBeanShell) ed.evaluateScript(".bsh"); else if (isPython) ed.evaluateScript(".py"); else if (!name.contains("_Tool")) IJ.runMacro(text); } return true; } /** Opens a .lut file from the ImageJ/luts directory and returns 'true' if successful. */ Loading ij/IJ.java +56 −29 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ public class IJ { private static ProgressBar progressBar; private static TextPanel textPanel; private static String osname, osarch; private static boolean isMac, isWin, isJava16, isJava17, isJava18, isJava19, isLinux, is64Bit; private static boolean isMac, isWin, isLinux, is64Bit; private static int javaVersion; private static boolean controlDown, altDown, spaceDown, shiftDown; private static boolean macroRunning; private static Thread previousThread; Loading @@ -75,13 +76,23 @@ public class IJ { isWin = osname.startsWith("Windows"); isMac = !isWin && osname.startsWith("Mac"); isLinux = osname.startsWith("Linux"); String version = System.getProperty("java.version").substring(0,3); if (version.compareTo("2.9")<=0) { // JVM on Sharp Zaurus PDA claims to be "3.1"! isJava16 = version.compareTo("1.5")>0; isJava17 = version.compareTo("1.6")>0; isJava18 = version.compareTo("1.7")>0; isJava19 = version.compareTo("1.8")>0; } String version = System.getProperty("java.version"); if (version.startsWith("1.8")) javaVersion = 8; else if (version.startsWith("1.6")) javaVersion = 6; else if (version.startsWith("1.9")||version.startsWith("9")) javaVersion = 9; else if (version.startsWith("10")) javaVersion = 10; else if (version.startsWith("11")) javaVersion = 11; else if (version.startsWith("12")) javaVersion = 12; else if (version.startsWith("1.7")) javaVersion = 7; else javaVersion = 6; dfs = new DecimalFormatSymbols(Locale.US); df = new DecimalFormat[10]; df[0] = new DecimalFormat("0", dfs); Loading Loading @@ -144,8 +155,6 @@ public class IJ { Returns any string value returned by the macro, or null. Scripts always return null. The equivalent macro function is runMacro(). */ public static String runMacroFile(String name, String arg) { if (ij==null && Menus.getCommands()==null) init(); Macro_Runner mr = new Macro_Runner(); return mr.runMacroFile(name, arg); } Loading Loading @@ -501,7 +510,7 @@ public class IJ { Frame frame = WindowManager.getFrontWindow(); if (frame!=null && (frame instanceof TextWindow)) { TextWindow tw = (TextWindow)frame; if (tw.getTextPanel().getResultsTable()==null) { if (tw.getResultsTable()==null) { IJ.error("Rename", "\""+tw.getTitle()+"\" is not a results table"); return; } Loading @@ -513,7 +522,7 @@ public class IJ { } } /** Changes the name of a results window from 'oldTitle' to 'newTitle'. */ /** Changes the name of a table window from 'oldTitle' to 'newTitle'. */ public static void renameResults(String oldTitle, String newTitle) { Frame frame = WindowManager.getFrame(oldTitle); if (frame==null) { Loading @@ -521,22 +530,20 @@ public class IJ { return; } else if (frame instanceof TextWindow) { TextWindow tw = (TextWindow)frame; if (tw.getTextPanel().getResultsTable()==null) { error("Rename", "\""+oldTitle+"\" is not a results table"); if (tw.getResultsTable()==null) { error("Rename", "\""+oldTitle+"\" is not a table"); return; } tw.rename(newTitle); } else error("Rename", "\""+oldTitle+"\" is not a results table"); error("Rename", "\""+oldTitle+"\" is not a table"); } /** Deletes 'row1' through 'row2' of the "Results" window. Arguments must be in the range 0-Analyzer.getCounter()-1. */ /** Deletes 'row1' through 'row2' of the "Results" window, where 'row1' and 'row2' must be in the range 0-Analyzer.getCounter()-1. */ public static void deleteRows(int row1, int row2) { int n = row2 - row1 + 1; ResultsTable rt = Analyzer.getResultsTable(); for (int i=row1; i<row1+n; i++) rt.deleteRow(row1); rt.deleteRows(row1, row2); rt.show("Results"); } Loading Loading @@ -956,6 +963,11 @@ public class IJ { return isWin; } /** Returns the Java version (6, 7, 8, 9, 10, etc.). */ public static int javaVersion() { return javaVersion; } /** Always returns true. */ public static boolean isJava2() { return true; Loading @@ -973,22 +985,22 @@ public class IJ { /** Returns true if ImageJ is running on a Java 1.6 or greater JVM. */ public static boolean isJava16() { return isJava16; return javaVersion >= 6; } /** Returns true if ImageJ is running on a Java 1.7 or greater JVM. */ public static boolean isJava17() { return isJava17; return javaVersion >= 7; } /** Returns true if ImageJ is running on a Java 1.8 or greater JVM. */ public static boolean isJava18() { return isJava18; return javaVersion >= 8; } /** Returns true if ImageJ is running on a Java 1.9 or greater JVM. */ public static boolean isJava19() { return isJava19; return javaVersion >= 9; } /** Returns true if ImageJ is running on Linux. */ Loading Loading @@ -1151,6 +1163,16 @@ public class IJ { img.setRoi(new PointRoi(x, y)); } /** Creates an Roi. */ public static Roi Roi(double x, double y, double width, double height) { return new Roi(x, y, width, height); } /** Creates an OvalRoi. */ public static OvalRoi OvalRoi(double x, double y, double width, double height) { return new OvalRoi(x, y, width, height); } /** Sets the display range (minimum and maximum displayed pixel values) of the current image. */ public static void setMinAndMax(double min, double max) { setMinAndMax(getImage(), min, max, 7); Loading Loading @@ -1327,8 +1349,11 @@ public class IJ { if (impC!=null && impC!=imp && impT!=null) impC.saveRoi(); WindowManager.setTempCurrentImage(imp); Interpreter.activateImage(imp); WindowManager.setWindow(null); } else { if (imp==null) return; ImageWindow win = imp.getWindow(); if (win!=null) { win.toFront(); Loading Loading @@ -1821,10 +1846,12 @@ public class IJ { return; } else if (format.indexOf("jpeg")!=-1 || format.indexOf("jpg")!=-1) { path = updateExtension(path, ".jpg"); format = "Jpeg..."; JpegWriter.save(imp, path, FileSaver.getJpegQuality()); return; } else if (format.indexOf("gif")!=-1) { path = updateExtension(path, ".gif"); format = "Gif..."; GifWriter.save(imp, path); return; } else if (format.indexOf("text image")!=-1) { path = updateExtension(path, ".txt"); format = "Text Image..."; Loading Loading @@ -2010,8 +2037,8 @@ public class IJ { options = NewImage.FILL_BLACK; else if (type.contains("ramp")) options = NewImage.FILL_RAMP; else if (type.contains("random")) options = NewImage.FILL_RANDOM; else if (type.contains("noise") || type.contains("random")) options = NewImage.FILL_NOISE; options += NewImage.CHECK_AVAILABLE_MEMORY; return NewImage.createImage(title, width, height, depth, bitDepth, options); } Loading ij/ImageJ.java +47 −47 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ import ij.text.*; import ij.macro.Interpreter; import ij.io.Opener; import ij.util.*; import ij.macro.MacroRunner; import java.awt.*; import java.util.*; import java.awt.event.*; Loading Loading @@ -79,7 +78,7 @@ 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.51q"; public static final String VERSION = "1.52d"; public static final String BUILD = ""; public static Color backgroundColor = new Color(237,237,237); /** SansSerif, 12-point, plain font. */ Loading Loading @@ -118,6 +117,7 @@ public class ImageJ extends Frame implements ActionListener, private boolean embedded; private boolean windowClosed; private static String commandName; private static boolean batchMode; boolean hotkey; Loading Loading @@ -180,7 +180,6 @@ public class ImageJ extends Frame implements ActionListener, addWindowListener(this); setFocusTraversalKeysEnabled(false); m.installStartupMacroSet(); //add custom tools runStartupMacro(); Point loc = getPreferredLocation(); Dimension tbSize = toolbar.getPreferredSize(); Loading @@ -195,7 +194,7 @@ public class ImageJ extends Frame implements ActionListener, Dimension size = getSize(); if (size!=null) { if (IJ.debugMode) IJ.log("size: "+size); if (IJ.isWindows() && size.height>108) { if (IJ.isWindows() && (size.height>108||IJ.javaVersion()>=10)) { // workaround for IJ window layout and FileDialog freeze problems with Windows 10 Creators Update IJ.wait(10); pack(); Loading @@ -217,23 +216,20 @@ public class ImageJ extends Frame implements ActionListener, } if (IJ.isMacintosh()&&applet==null) { Object qh = null; try { qh = IJ.runPlugIn("MacAdapter", ""); } catch(Throwable e) {} if (qh==null) IJ.runPlugIn("QuitHandler", ""); } if (applet==null) IJ.runPlugIn("ij.plugin.DragAndDrop", ""); String str = m.getMacroCount()==1?" macro":" macros"; IJ.showStatus(version()+ m.getPluginCount() + " commands; " + m.getMacroCount() + str); configureProxy(); if (applet==null) loadCursors(); } private void runStartupMacro() { String macro = (new Startup()).getStartupMacro(); if (macro!=null && macro.length()>4) new MacroRunner(macro); (new ij.macro.StartupRunner()).run(batchMode); // run RunAtStartup and AutoRun macros IJ.showStatus(version()+ m.getPluginCount() + " commands; " + m.getMacroCount() + str); } private void loadCursors() { Loading Loading @@ -373,7 +369,7 @@ public class ImageJ extends Frame implements ActionListener, MenuItem item = (MenuItem)e.getSource(); MenuComponent parent = (MenuComponent)item.getParent(); String cmd = e.getItem().toString(); if ("Autorun".equals(cmd)) // Examples>Autorun if ("Autorun Examples".equals(cmd)) // Examples>Autorun Examples Prefs.autoRunExamples = e.getStateChange()==1; else if ((Menu)parent==Menus.window) WindowManager.activateWindow(cmd, item); Loading Loading @@ -455,7 +451,13 @@ public class ImageJ extends Frame implements ActionListener, } } if ((!Prefs.requireControlKey || control || meta) && keyChar!='+') { if (keyCode==KeyEvent.VK_SEPARATOR) keyCode = KeyEvent.VK_DECIMAL; boolean functionKey = keyCode>=KeyEvent.VK_F1 && keyCode<=KeyEvent.VK_F12; boolean numPad = keyCode==KeyEvent.VK_DIVIDE || keyCode==KeyEvent.VK_MULTIPLY || keyCode==KeyEvent.VK_DECIMAL || (keyCode>=KeyEvent.VK_NUMPAD0 && keyCode<=KeyEvent.VK_NUMPAD9); if ((!Prefs.requireControlKey||control||meta||functionKey||numPad) && keyChar!='+') { Hashtable shortcuts = Menus.getShortcuts(); if (shift) cmd = (String)shortcuts.get(new Integer(keyCode+200)); Loading @@ -477,13 +479,15 @@ public class ImageJ extends Frame implements ActionListener, if (cmd==null) { switch (keyCode) { case KeyEvent.VK_TAB: WindowManager.putBehind(); return; case KeyEvent.VK_BACK_SPACE: // delete case KeyEvent.VK_BACK_SPACE: case KeyEvent.VK_DELETE: if (!(shift||control||alt||meta)) { if (deleteOverlayRoi(imp)) return; if (imp!=null&&imp.getOverlay()!=null&&imp==GelAnalyzer.getGelImage()) return; cmd="Clear"; hotkey=true; } break; //case KeyEvent.VK_BACK_SLASH: cmd=IJ.altKeyDown()?"Animation Options...":"Start Animation"; break; case KeyEvent.VK_EQUALS: cmd="In [+]"; break; Loading Loading @@ -678,31 +682,28 @@ public class ImageJ extends Frame implements ActionListener, } public static void main(String args[]) { if (System.getProperty("java.version").substring(0,3).compareTo("1.5")<0) { javax.swing.JOptionPane.showMessageDialog(null,"ImageJ "+VERSION+" requires Java 1.5 or later."); System.exit(0); } boolean noGUI = false; int mode = STANDALONE; arguments = args; //System.setProperty("file.encoding", "UTF-8"); int nArgs = args!=null?args.length:0; boolean commandLine = false; for (int i=0; i<nArgs; i++) { String arg = args[i]; if (arg==null) continue; if (args[i].startsWith("-")) { if (args[i].startsWith("-batch")) if (arg.startsWith("-batch")) { noGUI = true; else if (args[i].startsWith("-debug")) batchMode = true; } else if (arg.startsWith("-macro") || arg.endsWith(".ijm") || arg.endsWith(".txt")) batchMode = true; else if (arg.startsWith("-debug")) IJ.setDebugMode(true); else if (args[i].startsWith("-ijpath") && i+1<nArgs) { else if (arg.startsWith("-ijpath") && i+1<nArgs) { if (IJ.debugMode) IJ.log("-ijpath: "+args[i+1]); Prefs.setHomeDir(args[i+1]); commandLine = true; args[i+1] = null; } else if (args[i].startsWith("-port")) { int delta = (int)Tools.parseDouble(args[i].substring(5, args[i].length()), 0.0); } else if (arg.startsWith("-port")) { int delta = (int)Tools.parseDouble(arg.substring(5, arg.length()), 0.0); commandLine = true; if (delta==0) mode = EMBEDDED; Loading @@ -710,7 +711,6 @@ public class ImageJ extends Frame implements ActionListener, port = DEFAULT_PORT+delta; } } } // If existing ImageJ instance, pass arguments to it and quit. boolean passArgs = mode==STANDALONE && !noGUI; if (IJ.isMacOSX() && !commandLine) Loading Loading
IJ_Props.txt +0 −1 Original line number Diff line number Diff line Loading @@ -414,7 +414,6 @@ new_07="Plugin Frame",ij.plugin.NewPlugin("frame") new_08="Plugin Tool",ij.plugin.NewPlugin("plugin-tool") new_09=- new_10="Text Window...",ij.plugin.NewPlugin("text+dialog") new_11="Table...",ij.plugin.NewPlugin("table") # Plugins installed in the Help/About submenu about01="About This Submenu...",ij.plugin.SimpleCommands("about") Loading
build.xml +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ <!-- First, ensure the build directory exists. --> <mkdir dir="build" /> <!-- Build everything; add debug="on" to debug --> <javac srcdir="./ij" destdir="build" optimize="on" source="1.5" target="1.5" debug="on" includeantruntime="false" encoding="utf-8"> <javac srcdir="./ij" destdir="build" optimize="on" source="1.6" target="1.6" debug="on" includeantruntime="false" encoding="utf-8"> </javac> </target> Loading
ij/Executer.java +8 −47 Original line number Diff line number Diff line Loading @@ -146,58 +146,19 @@ public class Executer implements Runnable { if (openRecent(cmd)) return; // is it an example in Help>Examples menu? if (openExample(cmd)) if (Editor.openExample(cmd)) return; if ("Auto Threshold".equals(cmd)&&(String)table.get("Auto Threshold...")!=null) runCommand("Auto Threshold..."); else if ("Enhance Local Contrast (CLAHE)".equals(cmd)&&(String)table.get("CLAHE ")!=null) runCommand("CLAHE "); else { if ("Table...".equals(cmd)) IJ.runPlugIn("ij.plugin.NewPlugin", "table"); else IJ.error("Unrecognized command: \"" + cmd+"\""); } } private boolean openExample(String name) { boolean isMacro = name.endsWith(".ijm"); boolean isJava = name.endsWith(".java"); boolean isJavaScript = name.endsWith(".js"); boolean isBeanShell = name.endsWith(".bsh"); boolean isPython = name.endsWith(".py"); if (!(isMacro||isJava||isJavaScript||isBeanShell||isPython)) return false; boolean run = !isJava && (Prefs.autoRunExamples||IJ.shiftKeyDown()||IJ.controlKeyDown()||IJ.altKeyDown()); int rows = 24; int columns = 70; int options = Editor.MENU_BAR; String text = null; Editor ed = new Editor(rows, columns, 0, options); String dir = "Macro/"; if (isJava) dir = "Java/"; else if (isJavaScript) dir = "JavaScript/"; else if (isBeanShell) dir = "BeanShell/"; else if (isPython) dir = "Python/"; String url = "http://wsr.imagej.net/download/Examples/"+dir+name; text = IJ.openUrlAsString(url); if (text.startsWith("<Error: ")) { IJ.error("Open Example", text); return true; } ed.create(name, text); if (run) { if (isJavaScript) ed.evaluateScript(".js"); else if (isBeanShell) ed.evaluateScript(".bsh"); else if (isPython) ed.evaluateScript(".py"); else if (!name.contains("_Tool")) IJ.runMacro(text); } return true; } /** Opens a .lut file from the ImageJ/luts directory and returns 'true' if successful. */ Loading
ij/IJ.java +56 −29 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ public class IJ { private static ProgressBar progressBar; private static TextPanel textPanel; private static String osname, osarch; private static boolean isMac, isWin, isJava16, isJava17, isJava18, isJava19, isLinux, is64Bit; private static boolean isMac, isWin, isLinux, is64Bit; private static int javaVersion; private static boolean controlDown, altDown, spaceDown, shiftDown; private static boolean macroRunning; private static Thread previousThread; Loading @@ -75,13 +76,23 @@ public class IJ { isWin = osname.startsWith("Windows"); isMac = !isWin && osname.startsWith("Mac"); isLinux = osname.startsWith("Linux"); String version = System.getProperty("java.version").substring(0,3); if (version.compareTo("2.9")<=0) { // JVM on Sharp Zaurus PDA claims to be "3.1"! isJava16 = version.compareTo("1.5")>0; isJava17 = version.compareTo("1.6")>0; isJava18 = version.compareTo("1.7")>0; isJava19 = version.compareTo("1.8")>0; } String version = System.getProperty("java.version"); if (version.startsWith("1.8")) javaVersion = 8; else if (version.startsWith("1.6")) javaVersion = 6; else if (version.startsWith("1.9")||version.startsWith("9")) javaVersion = 9; else if (version.startsWith("10")) javaVersion = 10; else if (version.startsWith("11")) javaVersion = 11; else if (version.startsWith("12")) javaVersion = 12; else if (version.startsWith("1.7")) javaVersion = 7; else javaVersion = 6; dfs = new DecimalFormatSymbols(Locale.US); df = new DecimalFormat[10]; df[0] = new DecimalFormat("0", dfs); Loading Loading @@ -144,8 +155,6 @@ public class IJ { Returns any string value returned by the macro, or null. Scripts always return null. The equivalent macro function is runMacro(). */ public static String runMacroFile(String name, String arg) { if (ij==null && Menus.getCommands()==null) init(); Macro_Runner mr = new Macro_Runner(); return mr.runMacroFile(name, arg); } Loading Loading @@ -501,7 +510,7 @@ public class IJ { Frame frame = WindowManager.getFrontWindow(); if (frame!=null && (frame instanceof TextWindow)) { TextWindow tw = (TextWindow)frame; if (tw.getTextPanel().getResultsTable()==null) { if (tw.getResultsTable()==null) { IJ.error("Rename", "\""+tw.getTitle()+"\" is not a results table"); return; } Loading @@ -513,7 +522,7 @@ public class IJ { } } /** Changes the name of a results window from 'oldTitle' to 'newTitle'. */ /** Changes the name of a table window from 'oldTitle' to 'newTitle'. */ public static void renameResults(String oldTitle, String newTitle) { Frame frame = WindowManager.getFrame(oldTitle); if (frame==null) { Loading @@ -521,22 +530,20 @@ public class IJ { return; } else if (frame instanceof TextWindow) { TextWindow tw = (TextWindow)frame; if (tw.getTextPanel().getResultsTable()==null) { error("Rename", "\""+oldTitle+"\" is not a results table"); if (tw.getResultsTable()==null) { error("Rename", "\""+oldTitle+"\" is not a table"); return; } tw.rename(newTitle); } else error("Rename", "\""+oldTitle+"\" is not a results table"); error("Rename", "\""+oldTitle+"\" is not a table"); } /** Deletes 'row1' through 'row2' of the "Results" window. Arguments must be in the range 0-Analyzer.getCounter()-1. */ /** Deletes 'row1' through 'row2' of the "Results" window, where 'row1' and 'row2' must be in the range 0-Analyzer.getCounter()-1. */ public static void deleteRows(int row1, int row2) { int n = row2 - row1 + 1; ResultsTable rt = Analyzer.getResultsTable(); for (int i=row1; i<row1+n; i++) rt.deleteRow(row1); rt.deleteRows(row1, row2); rt.show("Results"); } Loading Loading @@ -956,6 +963,11 @@ public class IJ { return isWin; } /** Returns the Java version (6, 7, 8, 9, 10, etc.). */ public static int javaVersion() { return javaVersion; } /** Always returns true. */ public static boolean isJava2() { return true; Loading @@ -973,22 +985,22 @@ public class IJ { /** Returns true if ImageJ is running on a Java 1.6 or greater JVM. */ public static boolean isJava16() { return isJava16; return javaVersion >= 6; } /** Returns true if ImageJ is running on a Java 1.7 or greater JVM. */ public static boolean isJava17() { return isJava17; return javaVersion >= 7; } /** Returns true if ImageJ is running on a Java 1.8 or greater JVM. */ public static boolean isJava18() { return isJava18; return javaVersion >= 8; } /** Returns true if ImageJ is running on a Java 1.9 or greater JVM. */ public static boolean isJava19() { return isJava19; return javaVersion >= 9; } /** Returns true if ImageJ is running on Linux. */ Loading Loading @@ -1151,6 +1163,16 @@ public class IJ { img.setRoi(new PointRoi(x, y)); } /** Creates an Roi. */ public static Roi Roi(double x, double y, double width, double height) { return new Roi(x, y, width, height); } /** Creates an OvalRoi. */ public static OvalRoi OvalRoi(double x, double y, double width, double height) { return new OvalRoi(x, y, width, height); } /** Sets the display range (minimum and maximum displayed pixel values) of the current image. */ public static void setMinAndMax(double min, double max) { setMinAndMax(getImage(), min, max, 7); Loading Loading @@ -1327,8 +1349,11 @@ public class IJ { if (impC!=null && impC!=imp && impT!=null) impC.saveRoi(); WindowManager.setTempCurrentImage(imp); Interpreter.activateImage(imp); WindowManager.setWindow(null); } else { if (imp==null) return; ImageWindow win = imp.getWindow(); if (win!=null) { win.toFront(); Loading Loading @@ -1821,10 +1846,12 @@ public class IJ { return; } else if (format.indexOf("jpeg")!=-1 || format.indexOf("jpg")!=-1) { path = updateExtension(path, ".jpg"); format = "Jpeg..."; JpegWriter.save(imp, path, FileSaver.getJpegQuality()); return; } else if (format.indexOf("gif")!=-1) { path = updateExtension(path, ".gif"); format = "Gif..."; GifWriter.save(imp, path); return; } else if (format.indexOf("text image")!=-1) { path = updateExtension(path, ".txt"); format = "Text Image..."; Loading Loading @@ -2010,8 +2037,8 @@ public class IJ { options = NewImage.FILL_BLACK; else if (type.contains("ramp")) options = NewImage.FILL_RAMP; else if (type.contains("random")) options = NewImage.FILL_RANDOM; else if (type.contains("noise") || type.contains("random")) options = NewImage.FILL_NOISE; options += NewImage.CHECK_AVAILABLE_MEMORY; return NewImage.createImage(title, width, height, depth, bitDepth, options); } Loading
ij/ImageJ.java +47 −47 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ import ij.text.*; import ij.macro.Interpreter; import ij.io.Opener; import ij.util.*; import ij.macro.MacroRunner; import java.awt.*; import java.util.*; import java.awt.event.*; Loading Loading @@ -79,7 +78,7 @@ 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.51q"; public static final String VERSION = "1.52d"; public static final String BUILD = ""; public static Color backgroundColor = new Color(237,237,237); /** SansSerif, 12-point, plain font. */ Loading Loading @@ -118,6 +117,7 @@ public class ImageJ extends Frame implements ActionListener, private boolean embedded; private boolean windowClosed; private static String commandName; private static boolean batchMode; boolean hotkey; Loading Loading @@ -180,7 +180,6 @@ public class ImageJ extends Frame implements ActionListener, addWindowListener(this); setFocusTraversalKeysEnabled(false); m.installStartupMacroSet(); //add custom tools runStartupMacro(); Point loc = getPreferredLocation(); Dimension tbSize = toolbar.getPreferredSize(); Loading @@ -195,7 +194,7 @@ public class ImageJ extends Frame implements ActionListener, Dimension size = getSize(); if (size!=null) { if (IJ.debugMode) IJ.log("size: "+size); if (IJ.isWindows() && size.height>108) { if (IJ.isWindows() && (size.height>108||IJ.javaVersion()>=10)) { // workaround for IJ window layout and FileDialog freeze problems with Windows 10 Creators Update IJ.wait(10); pack(); Loading @@ -217,23 +216,20 @@ public class ImageJ extends Frame implements ActionListener, } if (IJ.isMacintosh()&&applet==null) { Object qh = null; try { qh = IJ.runPlugIn("MacAdapter", ""); } catch(Throwable e) {} if (qh==null) IJ.runPlugIn("QuitHandler", ""); } if (applet==null) IJ.runPlugIn("ij.plugin.DragAndDrop", ""); String str = m.getMacroCount()==1?" macro":" macros"; IJ.showStatus(version()+ m.getPluginCount() + " commands; " + m.getMacroCount() + str); configureProxy(); if (applet==null) loadCursors(); } private void runStartupMacro() { String macro = (new Startup()).getStartupMacro(); if (macro!=null && macro.length()>4) new MacroRunner(macro); (new ij.macro.StartupRunner()).run(batchMode); // run RunAtStartup and AutoRun macros IJ.showStatus(version()+ m.getPluginCount() + " commands; " + m.getMacroCount() + str); } private void loadCursors() { Loading Loading @@ -373,7 +369,7 @@ public class ImageJ extends Frame implements ActionListener, MenuItem item = (MenuItem)e.getSource(); MenuComponent parent = (MenuComponent)item.getParent(); String cmd = e.getItem().toString(); if ("Autorun".equals(cmd)) // Examples>Autorun if ("Autorun Examples".equals(cmd)) // Examples>Autorun Examples Prefs.autoRunExamples = e.getStateChange()==1; else if ((Menu)parent==Menus.window) WindowManager.activateWindow(cmd, item); Loading Loading @@ -455,7 +451,13 @@ public class ImageJ extends Frame implements ActionListener, } } if ((!Prefs.requireControlKey || control || meta) && keyChar!='+') { if (keyCode==KeyEvent.VK_SEPARATOR) keyCode = KeyEvent.VK_DECIMAL; boolean functionKey = keyCode>=KeyEvent.VK_F1 && keyCode<=KeyEvent.VK_F12; boolean numPad = keyCode==KeyEvent.VK_DIVIDE || keyCode==KeyEvent.VK_MULTIPLY || keyCode==KeyEvent.VK_DECIMAL || (keyCode>=KeyEvent.VK_NUMPAD0 && keyCode<=KeyEvent.VK_NUMPAD9); if ((!Prefs.requireControlKey||control||meta||functionKey||numPad) && keyChar!='+') { Hashtable shortcuts = Menus.getShortcuts(); if (shift) cmd = (String)shortcuts.get(new Integer(keyCode+200)); Loading @@ -477,13 +479,15 @@ public class ImageJ extends Frame implements ActionListener, if (cmd==null) { switch (keyCode) { case KeyEvent.VK_TAB: WindowManager.putBehind(); return; case KeyEvent.VK_BACK_SPACE: // delete case KeyEvent.VK_BACK_SPACE: case KeyEvent.VK_DELETE: if (!(shift||control||alt||meta)) { if (deleteOverlayRoi(imp)) return; if (imp!=null&&imp.getOverlay()!=null&&imp==GelAnalyzer.getGelImage()) return; cmd="Clear"; hotkey=true; } break; //case KeyEvent.VK_BACK_SLASH: cmd=IJ.altKeyDown()?"Animation Options...":"Start Animation"; break; case KeyEvent.VK_EQUALS: cmd="In [+]"; break; Loading Loading @@ -678,31 +682,28 @@ public class ImageJ extends Frame implements ActionListener, } public static void main(String args[]) { if (System.getProperty("java.version").substring(0,3).compareTo("1.5")<0) { javax.swing.JOptionPane.showMessageDialog(null,"ImageJ "+VERSION+" requires Java 1.5 or later."); System.exit(0); } boolean noGUI = false; int mode = STANDALONE; arguments = args; //System.setProperty("file.encoding", "UTF-8"); int nArgs = args!=null?args.length:0; boolean commandLine = false; for (int i=0; i<nArgs; i++) { String arg = args[i]; if (arg==null) continue; if (args[i].startsWith("-")) { if (args[i].startsWith("-batch")) if (arg.startsWith("-batch")) { noGUI = true; else if (args[i].startsWith("-debug")) batchMode = true; } else if (arg.startsWith("-macro") || arg.endsWith(".ijm") || arg.endsWith(".txt")) batchMode = true; else if (arg.startsWith("-debug")) IJ.setDebugMode(true); else if (args[i].startsWith("-ijpath") && i+1<nArgs) { else if (arg.startsWith("-ijpath") && i+1<nArgs) { if (IJ.debugMode) IJ.log("-ijpath: "+args[i+1]); Prefs.setHomeDir(args[i+1]); commandLine = true; args[i+1] = null; } else if (args[i].startsWith("-port")) { int delta = (int)Tools.parseDouble(args[i].substring(5, args[i].length()), 0.0); } else if (arg.startsWith("-port")) { int delta = (int)Tools.parseDouble(arg.substring(5, arg.length()), 0.0); commandLine = true; if (delta==0) mode = EMBEDDED; Loading @@ -710,7 +711,6 @@ public class ImageJ extends Frame implements ActionListener, port = DEFAULT_PORT+delta; } } } // If existing ImageJ instance, pass arguments to it and quit. boolean passArgs = mode==STANDALONE && !noGUI; if (IJ.isMacOSX() && !commandLine) Loading