Skip to content

Commit

Permalink
Merge tag 'v1.53m' of https://github.com/imagej/ImageJA
Browse files Browse the repository at this point in the history
v1.53m
  • Loading branch information
oeway committed Oct 15, 2021
2 parents f7cdc99 + 9ae834a commit 3f5aae2
Show file tree
Hide file tree
Showing 80 changed files with 1,737 additions and 670 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[![](https://travis-ci.org/imagej/ImageJA.svg?branch=master)](https://travis-ci.org/imagej/ImageJA)

ImageJA is a project that provides a clean [Git](https://imagej.net/Git)
history of the [ImageJ 1.x](https://imagej.net/ImageJ1) project, with a proper
`pom.xml` file so that it can be used with [Maven](https://imagej.net/Maven)
without hassles.
ImageJA is a project that provides a clean [Git](https://imagej.net/develop/git/)
history of the original [ImageJ](https://imagej.net/software/imagej) project,
with a proper `pom.xml` file so that it can be used with
[Maven](https://imagej.net/develop/maven) without hassles.

See the [ImageJA page](https://imagej.net/ImageJA) for details.
See the [ImageJA page](https://imagej.net/libs/imageja) for details.

## Editing this repository

Because much of the content in this repository is generated automatically, depending on the type of change you want to make your edit should go in one of three places:

* Source file content changes (e.g. bug fixes) should go to the [ImageJ1 repository](https://github.com/imagej/imagej1).
* Source file *location* changes (e.g. moving a file to the correct package) go in the [IJ1-builds repository](https://github.com/imagej/ij1-builds).
* Source file content changes (e.g. bug fixes) should go to the [imagej1 repository](https://github.com/imagej/imagej1). To submit changes in the ImageJ1 repository, see [Contributing#ImageJ](https://imagej.net/contribute/#imagej) on the Wiki.
* Source file *location* changes (e.g. moving a file to the correct package) go in the [ij1-builds repository](https://github.com/imagej/ij1-builds).
* Changes to the build structure (e.g. `pom.xml` updates) can be done directly in this repository.
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<copy file="IJ_Props.txt" todir="build" />
<copy file="images/microscope.gif" tofile="build/microscope.gif" />
<copy file="images/about.jpg" tofile="build/about.jpg" />
<copy file="plugins/MacAdapter.class" tofile="build/ij/plugin/MacAdapter.class" />
<copy file="plugins/MacAdapter.class" tofile="build/ij/plugin/MacAdapter.class" />
<copy file="plugins/MacAdapter9.class" tofile="build/ij/plugin/MacAdapter9.class" />
<copy todir="build/macros"><fileset dir="macros"/></copy>
<!-- Build ij.jar. -->
<jar jarfile="ij.jar" basedir="build"
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>30.0.0</version>
<version>31.1.0</version>
<relativePath />
</parent>

<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
<version>1.53j</version>
<version>1.53m</version>

<name>ImageJ</name>
<description>ImageJ is an open source Java image processing program inspired by NIH Image for the Macintosh.</description>
<url>https://imagej.net/</url>
Expand Down
133 changes: 133 additions & 0 deletions release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,139 @@
</head>
<body>

<li> <li> <u>1.53m 27 September 2021</u>
<ul>
<li> Thanks to Zoltan Kis, the <i>File&gt;Import&gt;Image Sequence</i>
dialog now displays the number of images that will be opened.
<li> Thanks to Norbert Vischer, exceptions on the Event Dispatch Thread
are now reported in the Log window.
<li> Thanks to Remi Berthoz, the <i>Analyze&gt;Tools&gt;Scale Bar</i>
command now has the ability to draw both vertical and/or
horizontal scale bars.
<li> Thanks to Stein Rorvik, added a "Colors..." command to the
Color Picker dropdown menu and made most of the commands in
that menu recordable.
<li> Thanks to Esteban Fernandez, added a "Fill color:"
field to the <i>Image&gt;Stacks&gt;Images to Stack</i>
dialog box.
<li> Thanks to Barry DeZonia, the findMinAndMax() methods
in the Short/Int/Float processors are now faster
(<i>Plugins&gt;Utilities&gt;Benchmark</i>
runs 3% faster).
<li> Thanks to Michael Schmid, added support for
drag and drop to JFileChooser dialogs.
<li> Thanks to Nicolas De Francesco, updated the
<i>Edit&gt;Selection&gt;Fit Rectangle</i> command so that
it produces more predictable results.
<li> Thanks to Philippe Carl, <i>File&gt;Import&gt;Image Sequence</i>
no longer limits the number of files that can be
imported to 40 when "Open as separate images"
is enabled.
<li> Thanks to Fred Damen, improved recording of the
ROI Manager's "Open..." and "Save..." commands, and
made the open(path) and save(path) methods public.
<li> Thanks to Michael Schmid, the
<i>File&gt;Import&gt;Image Sequence</i> command no
longer creates excessive image IDs.
<li> Thanks to Michael Schmid, added the FolderOpener.openProcessor()
method, used by the FileInfoVirtualStack class.
<li> Thanks to Norbert Vischer, fixed a bug that caused the
<i>Process&gt;Filters&gt;Convolve</i> command to sometimes not
be correctly recorded.
<li> Thanks to Fred Damen, fixed a bug that caused a null pointer
exception when the <i>File&gt;Import&gt;Results</i> dialog
was canceled.
<li> Thanks to Ved Sharma, fixed a bug that caused an invalid
macro error when assigning a string value returned by a user
defined function to an array element.
<li> Thanks to Fred Damen, fixed a bug that caused the RoiManager.save()
method to always return true.
<li> Thanks to Ved Sharma, fixed a bug that caused the
ROI Manager's "OR (Combine)" command to not work as
expected if the first ROI was composite.
<li> Thanks to Philippe Carl, fixed a bug that caused the
<i>File&gt;Import&gt;Image Sequence</i> command to not
work as expected when importing stacks and the
"Open as separate images" option was enabled.
<li> Thanks to Philippe Carl, fixed a bug that caused the
<i>Image&gt;Overlay&gt;Flatten</i> command to not work
with ROIs, or the ROI Manager in "Show All" mode, on
composite images.
<li> Thanks to Rodrigo Goncalves, fixed a bug that caused
the <i>File&gt;Save As&gt;Image Sequence</i> command to
display multiple error messages when the specified directory
did not exist.
<li> Thanks to Herbie Gluender, fixed a bug the caused the
exit(msg) macro function to fail when the argument was a
number or a call to a user-defined function.
<li> Thanks to Jerome Mutterer, fixed a typo in
OpenDialog.java that caused the GitHub version of ImageJ
to fail to compile.
<li> Thanks to Daniel Nebdal, fixed a bug that caused the
<i>Plugins&gt;Macros&gt;Edit</i> command to not open
".py" and ".bsh" files.
<li> Thanks to Remi Berthoz, fixed a bug that caused the
<i>Image&gt;Type&gt;RGB Stack</i> command to not work
correctly with RGB stacks that had multiple slices
and multiple frames.
<li> Thanks to Stein Rorvik, fixed a bug that caused
the Property.setSliceLabel() macro function to sometimes
not work as expected with single images.
<li> Thanks to Ved Sharma, fixed a regression that caused the
roiManager("Set Fill Color",color) macro function to fail when
used with a text selection.
<li> Thanks to 'natalia', fixed a 1.52p regression that caused
FITS images to open flipped vertically.
<li> Thanks to "J Xiong", fixed a regression that caused the
particle analyzer to not work the same as it did in ImageJ 1.52
with binary images that were not thresholded and the "Black background"
options was not set.
<li> Thanks to Hyung-song Nam, fixed a 1.53f regression that caused
menus to unexpectedly popup when using the "hand" tool to
scroll through images.
</ul>

<li> <u>1.53k 6 July 2021</u>
<ul>
<li> Thanks Mike Nelson, 16-bit images are
inverted using the full pixel value range (0-65535) or, if set,
using the "Unsigned 16-bit range" in the "Set" option of the
<i>Image&gt;Adjust&gt;Brightness/Contrast</i> dialog.
<li> Thanks to Alan Brooks, added the macOS-specific
MacAdapter9 plugin, which, on Java 9 or later,
supports drag and drop on the ImageJ.app and the
"About ImageJ" command.
<li> Thanks to Romain Guiet, the ROI Manager's
"Associate 'Show All' ROIs with slices" option is
now enabled by default.
<li> Thanks to Gilles Carpentier, the particle analyzer now assumes
the threshold is 255 unless "Black background" is not set,
the image does not have an inverted LUT and fewer than
half the pixels have a value of zero, in which case
the threshold is set to zero.
<li> Thanks to 'pdd2110', added the Property.setSliceLabel(label)
macro function.
<li> Thanks to 'John D.', added the GenericDialog.addButton() method
(<a href="http://wsr.imagej.net/plugins/Button_Example.java">example</a>).
<li> Thanks to 'Oodegard', fixed a bug that caused the
"Auto-next slice" option of the point tool to not
work as expected with hyperstacks.
<li> Thanks to Michael Schmid, fixed a bug that caused
NaN values in tables read from a file to be
strings instead of numbers.
<li> Thanks to Gabriel Landini and Michael Schmid, fixed a bug
that caused the "Top Hat" filter to fail when applying it to a
stack one slice at a time.
<li> Thanks to Laurent Thomas, fixed a bug that caused the
<i>Image&gt;Stacks&gt;Set Slice</i> command to not
work as expected with hyperstacks.
<li> Thanks to Laurent Thomas, fixed a bug that caused hyperstacks
to be displayed incorrectly if the Z or T sliders where
moved quickly and the images were slow to load.
<li> Thanks to Michael Schmid, fixed a bug that sometimes caused
the WindowManager.getIDList() method to throw an exception.
</ul>

<li> <u>1.53j 13 May 2021</u>
<ul>
<li> Thanks to 'VolkerH', the table created by
Expand Down
58 changes: 58 additions & 0 deletions src/main/java/MacAdapter9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package ij.plugin;
import ij.*;
import ij.io.*;
import java.awt.Desktop;
import java.awt.desktop.*;
import java.io.File;
import java.util.Vector;

/** This Mac-specific plugin is designed to handle the "About ImageJ"
* command in the ImageJ menu, to open files dropped on ImageJ.app
* and to open double-clicked files with creator code "imgJ".
* With Java 9 or newer, we use java.awt.desktop instead of the
* previous com.apple.eawt.* classes.
* @author Alan Brooks
*/
public class MacAdapter9 implements PlugIn, AboutHandler, OpenFilesHandler, QuitHandler, Runnable {
static Vector<String> paths = new Vector<String>();

public void run(String arg) {
Desktop dtop = Desktop.getDesktop();
dtop.setOpenFileHandler(this);
dtop.setAboutHandler(this);
dtop.setQuitHandler(this);
}

@Override
public void handleAbout(AboutEvent e) {
IJ.doCommand("About ImageJ...");
}

@Override
public void openFiles(OpenFilesEvent e) {
for (File file: e.getFiles()) {
paths.add(file.getPath());
Thread thread = new Thread(this, "Open");
thread.setPriority(thread.getPriority()-1);
thread.start();
}
}

@Override
public void handleQuitRequestWith(QuitEvent e, QuitResponse response) {
new Executer("Quit", null); // works with the CommandListener
}

// Not adding preference handling
// because we don't have the equivalent of app.setEnabledPreferencesMenu(true);
// @Override
// public void handlePreferences(PreferencesEvent e) {
// IJ.error("The ImageJ preferences are in the Edit>Options menu.");
// }

public void run() {
if (paths.size() > 0) {
(new Opener()).openAndAddToRecent(paths.remove(0));
}
}
}
14 changes: 8 additions & 6 deletions src/main/java/ij/IJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,12 @@ public static Object runPlugIn(String commandName, String className, String arg)
else
new PlugInFilterRunner(thePlugIn, commandName, arg);
} catch (ClassNotFoundException e) {
log("Plugin or class not found: \"" + className + "\"\n(" + e+")");
String path = Prefs.getCustomPropsPath();
if (path!=null);
log("Error may be due to custom properties at " + path);
if (!(className!=null && className.startsWith("ij.plugin.MacAdapter"))) {
log("Plugin or class not found: \"" + className + "\"\n(" + e+")");
String path = Prefs.getCustomPropsPath();
if (path!=null);
log("Error may be due to custom properties at " + path);
}
}
catch (InstantiationException e) {log("Unable to load plugin (ins)");}
catch (IllegalAccessException e) {log("Unable to load plugin, possibly \nbecause it is not public.");}
Expand Down Expand Up @@ -447,8 +449,8 @@ private static String convert(String command) {
commandTable.put("Line Graph (21K)", "Line Graph");
commandTable.put("Mitosis (26MB, 5D stack)", "Mitosis (5D stack)");
commandTable.put("MRI Stack (528K)", "MRI Stack");
commandTable.put("M51 Galaxy (177K, 16-bits)", "M51 Galaxy (16-bits))");
commandTable.put("Neuron (1.6M, 5 channels", "Neuron (5 channels");
commandTable.put("M51 Galaxy (177K, 16-bits)", "M51 Galaxy (16-bits)");
commandTable.put("Neuron (1.6M, 5 channels)", "Neuron (5 channels)");
commandTable.put("Nile Bend (1.9M)", "Nile Bend");
commandTable.put("Organ of Corti (2.8M, 4D stack)", "Organ of Corti (4D stack)");
commandTable.put("Particles (75K)", "Particles");
Expand Down
43 changes: 40 additions & 3 deletions src/main/java/ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.awt.image.*;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import com.leaningtech.client.Global;

/**
Expand Down Expand Up @@ -78,8 +79,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.53j";
public static final String BUILD = ""; //46
public static final String VERSION = "1.53m";
public static final String BUILD = ""; //41
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 @@ -217,11 +218,18 @@ public ImageJ(java.applet.Applet applet, int mode) {
}
if (IJ.isMacintosh()&&applet==null) {
try {
IJ.runPlugIn("ij.plugin.MacAdapter", "");
if (IJ.javaVersion()>8) // newer JREs use different drag-drop, about mechanism
IJ.runPlugIn("ij.plugin.MacAdapter9", "");
else
IJ.runPlugIn("ij.plugin.MacAdapter", "");
} catch(Throwable e) {}
}
if (applet==null)
IJ.runPlugIn("ij.plugin.DragAndDrop", "");
if (!getTitle().contains("Fiji")) {
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler());
System.setProperty("sun.awt.exception.handler",ExceptionHandler.class.getName());
}
String str = m.getMacroCount()==1?" macro":" macros";
configureProxy();
if (applet==null)
Expand Down Expand Up @@ -890,5 +898,34 @@ public void resize() {
progressBar.init((int)(ProgressBar.WIDTH*scale), (int)(ProgressBar.HEIGHT*scale));
pack();
}

/** Handles exceptions on the EDT. */
public static class ExceptionHandler implements Thread.UncaughtExceptionHandler {

// for EDT exceptions
public void handle(Throwable thrown) {
handleException(Thread.currentThread().getName(), thrown);
}

// for other uncaught exceptions
public void uncaughtException(Thread thread, Throwable thrown) {
handleException(thread.getName(), thrown);
}

protected void handleException(String tname, Throwable e) {
if (Macro.MACRO_CANCELED.equals(e.getMessage()))
return;
CharArrayWriter caw = new CharArrayWriter();
PrintWriter pw = new PrintWriter(caw);
e.printStackTrace(pw);
String s = caw.toString();
if (s!=null && s.contains("ij.")) {
if (IJ.getInstance()!=null)
s = IJ.getInstance().getInfo()+"\n"+s;
IJ.log(s);
}
}

} // inner class ExceptionHandler

}
Loading

0 comments on commit 3f5aae2

Please sign in to comment.