Loading IJ_Props.txt +3 −2 Original line number Diff line number Diff line Loading @@ -378,8 +378,9 @@ macros01="Install...",ij.plugin.MacroInstaller macros02="Run...",ij.plugin.Macro_Runner macros03="Edit...",ij.plugin.Compiler("edit") macros04="Startup Macros...",ij.plugin.Commands("startup") macros05="Record...",ij.plugin.frame.Recorder macros06=- macros05="Interactive Interpreter...[j]",ij.plugin.SimpleCommands("interactive") macros06="Record...",ij.plugin.frame.Recorder macros07=- # Plugins installed in the Plugins/Shortcuts submenu shortcuts01="Add Shortcut... ",ij.plugin.Hotkeys("install") Loading ij/IJ.java +27 −10 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ public class IJ { private static DecimalFormatSymbols dfs; private static boolean trustManagerCreated; private static String smoothMacro; private static Interpreter macroInterpreter; static { osname = System.getProperty("os.name"); Loading Loading @@ -151,7 +152,7 @@ public class IJ { The file is assumed to be in the macros folder unless <code>name</code> is a full path. The optional string argument (<code>arg</code>) can be retrieved in the called macro or script (v1.42k or later) using the getArgument() function. macro or script using the getArgument() function. 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) { Loading Loading @@ -309,9 +310,17 @@ public class IJ { macroRunning = false; Macro.setOptions(null); testAbort(); macroInterpreter = null; //IJ.log("run2: "+command+" "+Thread.currentThread().hashCode()); } /** The macro interpreter uses this method to run commands. */ public static void run(Interpreter interpreter, String command, String options) { macroInterpreter = interpreter; run(command, options); macroInterpreter = null; } /** Converts commands that have been renamed so macros using the old names continue to work. */ private static String convert(String command) { Loading Loading @@ -572,7 +581,12 @@ public class IJ { /**Displays a "no images are open" dialog box.*/ public static void noImage() { error("No Image", "There are no images open."); String msg = "There are no images open."; if (macroInterpreter!=null) { macroInterpreter.abort(msg); macroInterpreter = null; } else error("No Image", msg); } /** Displays an "out of memory" message to the "Log" window. */ Loading Loading @@ -645,6 +659,11 @@ public class IJ { macro or JavaScript is running, it is aborted. Writes to the Java console if the ImageJ window is not present.*/ public static void error(String msg) { if (macroInterpreter!=null) { macroInterpreter.abort(msg); macroInterpreter = null; return; } error(null, msg); if (Thread.currentThread().getName().endsWith("JavaScript")) throw new RuntimeException(Macro.MACRO_CANCELED); Loading Loading @@ -914,7 +933,6 @@ public class IJ { break; case KeyEvent.VK_SHIFT: shiftDown=true; updateStatus(); if (debugMode) beep(); break; case KeyEvent.VK_SPACE: { Loading @@ -936,7 +954,7 @@ public class IJ { case KeyEvent.VK_CONTROL: controlDown=false; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break; case KeyEvent.VK_ALT: altDown=false; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=false; updateStatus(); if (debugMode) beep(); break; case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: spaceDown=false; ImageWindow win = WindowManager.getCurrentWindow(); Loading @@ -951,10 +969,9 @@ public class IJ { private static void updateStatus() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { ImageCanvas ic = imp.getCanvas(); if (ic!=null && imp.getCalibration().scaled()) { Point p = ic.getCursorLoc(); imp.mouseMoved(p.x, p.y); Roi roi = imp.getRoi(); if (roi!=null && imp.getCalibration().scaled()) { roi.showStatus(); } } } Loading Loading @@ -2237,7 +2254,7 @@ public class IJ { } static void abort() { if (ij!=null || Interpreter.isBatchMode()) if ((ij!=null || Interpreter.isBatchMode()) && macroInterpreter==null) throw new RuntimeException(Macro.MACRO_CANCELED); } Loading ij/ImageJ.java +2 −2 Original line number Diff line number Diff line Loading @@ -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.52i"; public static final String BUILD = ""; //52 public static final String VERSION = "1.52j"; public static final String BUILD = ""; //42 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); Loading ij/ImagePlus.java +60 −43 Original line number Diff line number Diff line Loading @@ -172,7 +172,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { return false; } else { locked = true; if (IJ.debugMode) IJ.log(title + ": lock"); return true; } } Loading @@ -192,7 +191,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { /** Unlocks the image. */ public synchronized void unlock() { locked = false; if (IJ.debugMode) IJ.log(title + ": unlock"); } private void waitForImage(Image image) { Loading Loading @@ -556,7 +554,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { if (newProperties!=null) newProperties = (Properties)(newProperties.clone()); if (imp.getWindow()!=null) imp = imp.duplicateAll(); imp = imp.duplicate(); ImageStack stack2 = imp.getStack(); if (imp.isHyperStack()) setOpenAsHyperStack(true); Loading Loading @@ -964,32 +962,33 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { } /** Returns an ImageStatistics object generated using the specified measurement options and histogram bin count. Note: except for float images, the number of bins is currently fixed at 256. */ specified measurement options and histogram bin count. */ public ImageStatistics getStatistics(int mOptions, int nBins) { return getStatistics(mOptions, nBins, 0.0, 0.0); } /** Returns an ImageStatistics object generated using the specified measurement options, histogram bin count and histogram range. Note: for 8-bit and RGB images, the number of bins is fixed at 256 and the histogram range is always 0-255. */ specified measurement options, histogram bin count and histogram range. */ public ImageStatistics getStatistics(int mOptions, int nBins, double histMin, double histMax) { ImageProcessor ip2 = ip; int bitDepth = getBitDepth(); if (nBins!=256 && (bitDepth==8||bitDepth==24)) ip2 =ip.convertToShort(false); if (roi!=null && roi.isArea()) ip.setRoi(roi); ip2.setRoi(roi); else ip.resetRoi(); ip.setHistogramSize(nBins); ip2.resetRoi(); ip2.setHistogramSize(nBins); Calibration cal = getCalibration(); if (getType()==GRAY16&& !(histMin==0.0&&histMax==0.0)) {histMin=cal.getRawValue(histMin); histMax=cal.getRawValue(histMax);} ip.setHistogramRange(histMin, histMax); ImageStatistics stats = ImageStatistics.getStatistics(ip, mOptions, cal); ip.setHistogramSize(256); ip.setHistogramRange(0.0, 0.0); if (getType()==GRAY16&& !(histMin==0.0&&histMax==0.0)) { histMin = cal.getRawValue(histMin); histMax=cal.getRawValue(histMax); } ip2.setHistogramRange(histMin, histMax); ImageStatistics stats = ImageStatistics.getStatistics(ip2, mOptions, cal); ip2.setHistogramSize(256); ip2.setHistogramRange(0.0, 0.0); return stats; } Loading Loading @@ -2142,20 +2141,11 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { } /** Returns a copy of this image or stack, cropped if there is an ROI. * @see #duplicateAll /** Returns a copy of this image or stack. * @see #crop * @see ij.plugin.Duplicator#run */ public ImagePlus duplicate() { return (new Duplicator()).run(this); } /** Returns a copy of this image or stack. * @see #duplicate * @see #crop */ public ImagePlus duplicateAll() { Roi roi = getRoi(); deleteRoi(); ImagePlus imp2 =(new Duplicator()).run(this); Loading @@ -2165,7 +2155,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { /** Returns a copy this image or stack slice, cropped if there is an ROI. * @see #duplicate * @see #duplicateAll * @see ij.plugin.Duplicator#crop */ public ImagePlus crop() { Loading Loading @@ -2866,6 +2855,34 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { } } /** Plots a 256 bin histogram of this image and returns the PlotWindow. */ public PlotWindow plotHistogram() { return plotHistogram(256); } /** Plots a histogram of this image using the specified number of bins and returns the PlotWindow. */ public PlotWindow plotHistogram(int bins) { ImageStatistics stats = getStatistics(AREA+MEAN+MODE+MIN_MAX, bins); Plot plot = new Plot("Hist_"+getTitle(), "Value", "Frequency"); plot.setColor("black", "#999999"); plot.setFont(new Font("SansSerif",Font.PLAIN,14)); double[] y = stats.histogram(); int n = y.length; double[] x = new double[n]; int bits = getBitDepth(); boolean eightBit = bits==8 || bits==24; double min = !eightBit?stats.min:0; for (int i=0; i<n; i++) x[i] = min+i*stats.binSize; plot.add("bar", x, y); if (bins!=256) plot.addLegend(bins+" bins", "auto"); if (eightBit) plot.setLimits(0,256,0,Double.NaN); return plot.show(); } public String toString() { return "img[\""+getTitle()+"\" ("+getID()+"), "+getBitDepth()+"-bit, "+width+"x"+height+"x"+getNChannels()+"x"+getNSlices()+"x"+getNFrames()+"]"; } Loading ij/Menus.java +1 −0 Original line number Diff line number Diff line Loading @@ -315,6 +315,7 @@ public class Menus { addExample(submenu, "Dynamic Plot", "Dynamic_Plot.js"); addExample(submenu, "Plot Styles", "Plot_Styles.js"); addExample(submenu, "Plot Random Data", "Plot_Random_Data.js"); addExample(submenu, "Histogram Plots", "Histogram_Plots.js"); addExample(submenu, "Process Folder", "Batch_Process_Folder.js"); addExample(submenu, "Sine/Cosine Table", "Sine_Cosine_Table.js"); addExample(submenu, "Non-numeric Table", "Non-numeric_Table.js"); Loading Loading
IJ_Props.txt +3 −2 Original line number Diff line number Diff line Loading @@ -378,8 +378,9 @@ macros01="Install...",ij.plugin.MacroInstaller macros02="Run...",ij.plugin.Macro_Runner macros03="Edit...",ij.plugin.Compiler("edit") macros04="Startup Macros...",ij.plugin.Commands("startup") macros05="Record...",ij.plugin.frame.Recorder macros06=- macros05="Interactive Interpreter...[j]",ij.plugin.SimpleCommands("interactive") macros06="Record...",ij.plugin.frame.Recorder macros07=- # Plugins installed in the Plugins/Shortcuts submenu shortcuts01="Add Shortcut... ",ij.plugin.Hotkeys("install") Loading
ij/IJ.java +27 −10 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ public class IJ { private static DecimalFormatSymbols dfs; private static boolean trustManagerCreated; private static String smoothMacro; private static Interpreter macroInterpreter; static { osname = System.getProperty("os.name"); Loading Loading @@ -151,7 +152,7 @@ public class IJ { The file is assumed to be in the macros folder unless <code>name</code> is a full path. The optional string argument (<code>arg</code>) can be retrieved in the called macro or script (v1.42k or later) using the getArgument() function. macro or script using the getArgument() function. 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) { Loading Loading @@ -309,9 +310,17 @@ public class IJ { macroRunning = false; Macro.setOptions(null); testAbort(); macroInterpreter = null; //IJ.log("run2: "+command+" "+Thread.currentThread().hashCode()); } /** The macro interpreter uses this method to run commands. */ public static void run(Interpreter interpreter, String command, String options) { macroInterpreter = interpreter; run(command, options); macroInterpreter = null; } /** Converts commands that have been renamed so macros using the old names continue to work. */ private static String convert(String command) { Loading Loading @@ -572,7 +581,12 @@ public class IJ { /**Displays a "no images are open" dialog box.*/ public static void noImage() { error("No Image", "There are no images open."); String msg = "There are no images open."; if (macroInterpreter!=null) { macroInterpreter.abort(msg); macroInterpreter = null; } else error("No Image", msg); } /** Displays an "out of memory" message to the "Log" window. */ Loading Loading @@ -645,6 +659,11 @@ public class IJ { macro or JavaScript is running, it is aborted. Writes to the Java console if the ImageJ window is not present.*/ public static void error(String msg) { if (macroInterpreter!=null) { macroInterpreter.abort(msg); macroInterpreter = null; return; } error(null, msg); if (Thread.currentThread().getName().endsWith("JavaScript")) throw new RuntimeException(Macro.MACRO_CANCELED); Loading Loading @@ -914,7 +933,6 @@ public class IJ { break; case KeyEvent.VK_SHIFT: shiftDown=true; updateStatus(); if (debugMode) beep(); break; case KeyEvent.VK_SPACE: { Loading @@ -936,7 +954,7 @@ public class IJ { case KeyEvent.VK_CONTROL: controlDown=false; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break; case KeyEvent.VK_ALT: altDown=false; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=false; updateStatus(); if (debugMode) beep(); break; case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: spaceDown=false; ImageWindow win = WindowManager.getCurrentWindow(); Loading @@ -951,10 +969,9 @@ public class IJ { private static void updateStatus() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { ImageCanvas ic = imp.getCanvas(); if (ic!=null && imp.getCalibration().scaled()) { Point p = ic.getCursorLoc(); imp.mouseMoved(p.x, p.y); Roi roi = imp.getRoi(); if (roi!=null && imp.getCalibration().scaled()) { roi.showStatus(); } } } Loading Loading @@ -2237,7 +2254,7 @@ public class IJ { } static void abort() { if (ij!=null || Interpreter.isBatchMode()) if ((ij!=null || Interpreter.isBatchMode()) && macroInterpreter==null) throw new RuntimeException(Macro.MACRO_CANCELED); } Loading
ij/ImageJ.java +2 −2 Original line number Diff line number Diff line Loading @@ -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.52i"; public static final String BUILD = ""; //52 public static final String VERSION = "1.52j"; public static final String BUILD = ""; //42 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); Loading
ij/ImagePlus.java +60 −43 Original line number Diff line number Diff line Loading @@ -172,7 +172,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { return false; } else { locked = true; if (IJ.debugMode) IJ.log(title + ": lock"); return true; } } Loading @@ -192,7 +191,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { /** Unlocks the image. */ public synchronized void unlock() { locked = false; if (IJ.debugMode) IJ.log(title + ": unlock"); } private void waitForImage(Image image) { Loading Loading @@ -556,7 +554,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { if (newProperties!=null) newProperties = (Properties)(newProperties.clone()); if (imp.getWindow()!=null) imp = imp.duplicateAll(); imp = imp.duplicate(); ImageStack stack2 = imp.getStack(); if (imp.isHyperStack()) setOpenAsHyperStack(true); Loading Loading @@ -964,32 +962,33 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { } /** Returns an ImageStatistics object generated using the specified measurement options and histogram bin count. Note: except for float images, the number of bins is currently fixed at 256. */ specified measurement options and histogram bin count. */ public ImageStatistics getStatistics(int mOptions, int nBins) { return getStatistics(mOptions, nBins, 0.0, 0.0); } /** Returns an ImageStatistics object generated using the specified measurement options, histogram bin count and histogram range. Note: for 8-bit and RGB images, the number of bins is fixed at 256 and the histogram range is always 0-255. */ specified measurement options, histogram bin count and histogram range. */ public ImageStatistics getStatistics(int mOptions, int nBins, double histMin, double histMax) { ImageProcessor ip2 = ip; int bitDepth = getBitDepth(); if (nBins!=256 && (bitDepth==8||bitDepth==24)) ip2 =ip.convertToShort(false); if (roi!=null && roi.isArea()) ip.setRoi(roi); ip2.setRoi(roi); else ip.resetRoi(); ip.setHistogramSize(nBins); ip2.resetRoi(); ip2.setHistogramSize(nBins); Calibration cal = getCalibration(); if (getType()==GRAY16&& !(histMin==0.0&&histMax==0.0)) {histMin=cal.getRawValue(histMin); histMax=cal.getRawValue(histMax);} ip.setHistogramRange(histMin, histMax); ImageStatistics stats = ImageStatistics.getStatistics(ip, mOptions, cal); ip.setHistogramSize(256); ip.setHistogramRange(0.0, 0.0); if (getType()==GRAY16&& !(histMin==0.0&&histMax==0.0)) { histMin = cal.getRawValue(histMin); histMax=cal.getRawValue(histMax); } ip2.setHistogramRange(histMin, histMax); ImageStatistics stats = ImageStatistics.getStatistics(ip2, mOptions, cal); ip2.setHistogramSize(256); ip2.setHistogramRange(0.0, 0.0); return stats; } Loading Loading @@ -2142,20 +2141,11 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { } /** Returns a copy of this image or stack, cropped if there is an ROI. * @see #duplicateAll /** Returns a copy of this image or stack. * @see #crop * @see ij.plugin.Duplicator#run */ public ImagePlus duplicate() { return (new Duplicator()).run(this); } /** Returns a copy of this image or stack. * @see #duplicate * @see #crop */ public ImagePlus duplicateAll() { Roi roi = getRoi(); deleteRoi(); ImagePlus imp2 =(new Duplicator()).run(this); Loading @@ -2165,7 +2155,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { /** Returns a copy this image or stack slice, cropped if there is an ROI. * @see #duplicate * @see #duplicateAll * @see ij.plugin.Duplicator#crop */ public ImagePlus crop() { Loading Loading @@ -2866,6 +2855,34 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable { } } /** Plots a 256 bin histogram of this image and returns the PlotWindow. */ public PlotWindow plotHistogram() { return plotHistogram(256); } /** Plots a histogram of this image using the specified number of bins and returns the PlotWindow. */ public PlotWindow plotHistogram(int bins) { ImageStatistics stats = getStatistics(AREA+MEAN+MODE+MIN_MAX, bins); Plot plot = new Plot("Hist_"+getTitle(), "Value", "Frequency"); plot.setColor("black", "#999999"); plot.setFont(new Font("SansSerif",Font.PLAIN,14)); double[] y = stats.histogram(); int n = y.length; double[] x = new double[n]; int bits = getBitDepth(); boolean eightBit = bits==8 || bits==24; double min = !eightBit?stats.min:0; for (int i=0; i<n; i++) x[i] = min+i*stats.binSize; plot.add("bar", x, y); if (bins!=256) plot.addLegend(bins+" bins", "auto"); if (eightBit) plot.setLimits(0,256,0,Double.NaN); return plot.show(); } public String toString() { return "img[\""+getTitle()+"\" ("+getID()+"), "+getBitDepth()+"-bit, "+width+"x"+height+"x"+getNChannels()+"x"+getNSlices()+"x"+getNFrames()+"]"; } Loading
ij/Menus.java +1 −0 Original line number Diff line number Diff line Loading @@ -315,6 +315,7 @@ public class Menus { addExample(submenu, "Dynamic Plot", "Dynamic_Plot.js"); addExample(submenu, "Plot Styles", "Plot_Styles.js"); addExample(submenu, "Plot Random Data", "Plot_Random_Data.js"); addExample(submenu, "Histogram Plots", "Histogram_Plots.js"); addExample(submenu, "Process Folder", "Batch_Process_Folder.js"); addExample(submenu, "Sine/Cosine Table", "Sine_Cosine_Table.js"); addExample(submenu, "Non-numeric Table", "Non-numeric_Table.js"); Loading