Skip to content
Commits on Source (6)
......@@ -5,7 +5,7 @@
# Note that commands must be unique.
# Version 1.51
# Version 1.52
# Commands installed in the right-click popup menu
# Overridden in StartupMacros
......
The ant utility (http://ant.apache.org/) will compile and run ImageJ using
the build file (build.xml) in this directory. There is a version of ant at
http://imagej.nih.gov/ij/download/tools/ant/ant.zip
set up to use the JVM distributed with the Windows version of ImageJ.
The README included in the ZIP archive has more information.
the build file (build.xml) in this directory.
\ No newline at end of file
<!-- Runs ImageJ as an Applet -->
<html>
<head>
<title>ImageJ Applet</title>
</head>
<body>
<applet codebase="." code="ij.ImageJApplet.class" archive="ij.jar" width=0 height=0>
</applet>
</body>
</html>
......@@ -17,7 +17,6 @@
<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/MacAdapter.class" />
<copy file="plugins/MacClipboard.class" tofile="build/MacClipboard.class" />
<copy todir="build/macros"><fileset dir="macros"/></copy>
<!-- Build ij.jar. -->
<jar jarfile="ij.jar" basedir="build"
......
imagej (1.52d-1) UNRELEASED; urgency=medium
imagej (1.52g-1) unstable; urgency=medium
* Team upload.
[ David Miguel Susano Pinto ]
* New upstream release
......@@ -10,8 +12,9 @@ imagej (1.52d-1) UNRELEASED; urgency=medium
[ Andreas Tille ]
* Point Vcs-fields to Salsa
* debhelper 11
* Standards-Version: 4.2.1
-- David Miguel Susano Pinto <carandraug+dev@gmail.com> Tue, 19 Jun 2018 17:14:16 +0100
-- Andreas Tille <tille@debian.org> Tue, 09 Oct 2018 18:18:15 +0200
imagej (1.51q-1) unstable; urgency=medium
......
......@@ -9,7 +9,7 @@ Build-Depends-Indep: ant,
default-jdk-headless,
javahelper,
maven-repo-helper
Standards-Version: 4.1.4
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/med-team/imagej
Vcs-Git: https://salsa.debian.org/med-team/imagej.git
Homepage: https://imagej.nih.gov/ij
......
......@@ -12,12 +12,11 @@ Author: Carnë Draug <carandraug+dev@gmail.com>
Last-Update: 2017-08-12
--- a/build.xml
+++ b/build.xml
@@ -16,8 +16,6 @@
@@ -16,7 +16,6 @@
<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/MacAdapter.class" />
- <copy file="plugins/MacClipboard.class" tofile="build/MacClipboard.class" />
<copy todir="build/macros"><fileset dir="macros"/></copy>
<!-- Build ij.jar. -->
<jar jarfile="ij.jar" basedir="build"
......@@ -294,10 +294,7 @@ public class CompositeImage extends ImagePlus {
for (int i=1; i<nChannels; i++)
if (active[i]) cip[i].updateComposite(rgbPixels, 5);
}
if (IJ.isJava16())
createBufferedImage();
else
createImage();
createBufferedImage();
if (img==null && awtImage!=null)
img = awtImage;
singleChannel = false;
......@@ -339,27 +336,6 @@ public class CompositeImage extends ImagePlus {
return sampleModel;
}
/*
void createBlitterImage(int n) {
ImageProcessor ip = cip[n-1].duplicate();
if (ip instanceof FloatProcessor){
FloatBlitter fb = new FloatBlitter((FloatProcessor)ip);
for (int i=1; i<n; i++)
fb.copyBits(cip[i], 0, 0, Blitter.COPY_ZERO_TRANSPARENT);
} else if (ip instanceof ByteProcessor){
ByteBlitter bb = new ByteBlitter((ByteProcessor)ip);
for (int i=1; i<n; i++)
bb.copyBits(cip[i], 0, 0, Blitter.OR);
} else if (ip instanceof ShortProcessor){
ShortBlitter sb = new ShortBlitter((ShortProcessor)ip);
for (int i=n-2; i>=0; i--)
sb.copyBits(cip[i], 0, 0, Blitter. OR);
}
img = ip.createImage();
singleChannel = false;
}
*/
ImageStack getRGBStack(ImagePlus imp) {
ImageProcessor ip = imp.getProcessor();
int w = ip.getWidth();
......
......@@ -435,8 +435,17 @@ public class IJ {
if (logPanel!=null) {
if (s.startsWith("\\"))
handleLogCommand(s);
else
else {
if (s.endsWith("\n")) {
if (s.equals("\n\n"))
s= "\n \n ";
else if (s.endsWith("\n\n"))
s = s.substring(0, s.length()-2)+"\n \n ";
else
s = s+" ";
}
logPanel.append(s);
}
} else {
LogStream.redirectSystem(false);
System.out.println(s);
......@@ -1630,14 +1639,22 @@ public class IJ {
else if (title2.equals("temp")) {
String dir = System.getProperty("java.io.tmpdir");
if (isMacintosh()) dir = "/tmp/";
if (dir!=null && !dir.endsWith(File.separator)) dir += File.separator;
if (dir!=null && !dir.endsWith(File.separator))
dir += File.separator;
return dir;
} else if (title2.equals("image")) {
ImagePlus imp = WindowManager.getCurrentImage();
FileInfo fi = imp!=null?imp.getOriginalFileInfo():null;
if (fi!=null && fi.directory!=null)
return fi.directory;
else
if (fi!=null && fi.directory!=null) {
String dir = fi.directory;
if (dir!=null && !(dir.endsWith(File.separator)||dir.endsWith("/"))) {
if (IJ.isWindows()&&dir.contains(File.separator))
dir += File.separator;
else
dir += "/";
}
return dir;
} else
return null;
} else {
DirectoryChooser dc = new DirectoryChooser(title);
......@@ -1646,7 +1663,7 @@ public class IJ {
return dir;
}
}
/** Alias for getDirectory(). */
public static String getDir(String title) {
return getDirectory(title);
......@@ -1702,7 +1719,10 @@ public class IJ {
Use IJ.open() to display a file open dialog box.
*/
public static ImagePlus openImage(String path) {
return (new Opener()).openImage(path);
macroRunning = true;
ImagePlus imp = (new Opener()).openImage(path);
macroRunning = false;
return imp;
}
/** Opens the nth image of the specified tiff stack. */
......@@ -1841,6 +1861,9 @@ public class IJ {
if (path!=null && path.length()==0)
path = null;
format = format.toLowerCase(Locale.US);
Roi roi2 = imp!=null?imp.getRoi():null;
if (roi2!=null)
roi2.endPaste();
if (format.indexOf("tif")!=-1) {
saveAsTiff(imp, path);
return;
......@@ -1896,11 +1919,9 @@ public class IJ {
if (path==null)
run(format);
else {
if (path.contains(" ")) {
if (path.contains("]"))
error("ImageJ cannot save when file path contains both \" \" and \"]\"");
if (path.contains(" "))
run(imp, format, "save=["+path+"]");
} else
else
run(imp, format, "save="+path);
}
}
......@@ -2192,7 +2213,7 @@ public class IJ {
ArrayList list = new ArrayList();
Hashtable commands = Menus.getCommands();
Menu lutsMenu = Menus.getImageJMenu("Image>Lookup Tables");
if (lutsMenu==null)
if (commands==null || lutsMenu==null)
return new String[0];
for (int i=0; i<lutsMenu.getItemCount(); i++) {
MenuItem menuItem = lutsMenu.getItem(i);
......@@ -2234,6 +2255,8 @@ public class IJ {
PrintWriter pw = new PrintWriter(caw);
e.printStackTrace(pw);
String s = caw.toString();
if (s!=null && s.contains("ThreadDeath"))
return;
if (getInstance()!=null) {
s = IJ.getInstance().getInfo()+"\n \n"+s;
new TextWindow("Exception", s, 500, 340);
......
......@@ -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.52d";
public static final String BUILD = "";
public static final String VERSION = "1.52g";
public static final String BUILD = ""; //5
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);
......@@ -418,10 +418,16 @@ public class ImageJ extends Frame implements ActionListener,
ImagePlus imp = WindowManager.getCurrentImage();
boolean isStack = (imp!=null) && (imp.getStackSize()>1);
if (imp!=null && !control && ((keyChar>=32 && keyChar<=255) || keyChar=='\b' || keyChar=='\n')) {
if (imp!=null && ((keyChar>=32 && keyChar<=255) || keyChar=='\b' || keyChar=='\n')) {
Roi roi = imp.getRoi();
if (roi instanceof TextRoi) {
if ((flags & KeyEvent.META_MASK)!=0 && IJ.isMacOSX()) return;
if (roi!=null && roi instanceof TextRoi) {
if (imp.getOverlay()!=null && (control || alt || meta)
&& (keyCode==KeyEvent.VK_BACK_SPACE || keyCode==KeyEvent.VK_DELETE)) {
if (deleteOverlayRoi(imp))
return;
}
if ((flags & KeyEvent.META_MASK)!=0 && IJ.isMacOSX())
return;
if (alt) {
switch (keyChar) {
case 'u': case 'm': keyChar = IJ.micronSymbol; break;
......@@ -443,7 +449,6 @@ public class ImageJ extends Frame implements ActionListener,
else
cmd = (String)macroShortcuts.get(new Integer(keyCode));
if (cmd!=null) {
//MacroInstaller.runMacroCommand(cmd);
commandName = cmd;
MacroInstaller.runMacroShortcut(cmd);
return;
......
......@@ -69,6 +69,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
private String url;
private FileInfo fileInfo;
private int imageType = GRAY8;
private boolean typeSet;
private ImageStack stack;
private static int currentID = -1;
private int ID;
......@@ -658,6 +659,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
/** Replaces the image with the specified stack and updates
the display. Set 'title' to null to leave the title unchanged. */
public void setStack(String title, ImageStack newStack) {
int previousStackSize = getStackSize();
int newStackSize = newStack.getSize();
//IJ.log("setStack: "+newStackSize+" "+this);
if (newStackSize==0)
......@@ -693,10 +695,17 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
if (newStackSize>1 && !(win instanceof StackWindow)) {
if (isDisplayedHyperStack())
setOpenAsHyperStack(true);
activated = false;
win = new StackWindow(this, getCanvas()); // replaces this window
if (IJ.isMacro()) { // wait for stack window to be activated
long start = System.currentTimeMillis();
while (!activated) {
IJ.wait(5);
if ((System.currentTimeMillis()-start)>200)
break; // 0.2 second timeout
}
}
setPosition(1, 1, 1);
if (Interpreter.getInstance()!=null)
IJ.wait(25);
} else if (newStackSize>1 && invalidDimensions) {
if (isDisplayedHyperStack())
setOpenAsHyperStack(true);
......@@ -713,7 +722,10 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
}
repaintWindow();
}
if (resetCurrentSlice) setSlice(currentSlice);
if (resetCurrentSlice)
setSlice(currentSlice);
if (isComposite() && previousStackSize!=newStackSize)
compositeImage = false;
}
public void setStack(ImageStack newStack, int channels, int slices, int frames) {
......@@ -830,7 +842,11 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
}
/** For images with irregular ROIs, returns a byte mask, otherwise, returns
null. Mask pixels have a non-zero value. */
* null. Mask pixels have a non-zero value.and the dimensions of the
* mask are equal to the width and height of the ROI.
* @see ij.ImagePlus#createRoiMask
* @see ij.ImagePlus#createThresholdMask
*/
public ImageProcessor getMask() {
if (roi==null) {
if (ip!=null) ip.resetRoi();
......@@ -845,6 +861,34 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
}
return mask;
}
/** Returns an 8-bit binary (0 and 255) ROI or overlay mask
* that has the same dimensions as this image.
* @see ij.gui.Roi#getMask
*/
public ByteProcessor createRoiMask() {
Roi roi2 = getRoi();
Overlay overlay2 = getOverlay();
if (roi2==null && overlay2==null)
throw new IllegalArgumentException("ROI or overlay required");
ByteProcessor mask = new ByteProcessor(getWidth(),getHeight());
mask.setColor(255);
if (overlay2!=null) {
for (int i=0; i<overlay2.size(); i++)
mask.fill(overlay2.get(i));
} else if (roi2!=null)
mask.fill(roi2);
return mask;
}
/** Returns an 8-bit binary (0 and 255) threshold mask
* that has the same dimensions as this image.
* @see ij.plugin.Thresholder#createMask
* @see ij.process.ImageProcessor#createMask
*/
public ByteProcessor createThresholdMask() {
return Thresholder.createMask(this);
}
/** Get calibrated statistics for this image or ROI, including
histogram, area, mean, min and max, standard
......@@ -982,7 +1026,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
return 1;
else {
int slices = stack.getSize();
//if (compositeImage) slices /= nChannels;
if (slices<=0) slices = 1;
return slices;
}
......@@ -1118,8 +1161,17 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
is unknown. RGB images actually use 32 bits per pixel. */
public int getBitDepth() {
ImageProcessor ip2 = ip;
if (ip2==null)
return 0;
if (ip2==null) {
int bitDepth = 0;
switch (imageType) {
case GRAY8: bitDepth=typeSet?8:0; break;
case COLOR_256: bitDepth=8; break;
case GRAY16: bitDepth=16; break;
case GRAY32: bitDepth=32; break;
case COLOR_RGB: bitDepth=24; break;
}
return bitDepth;
}
if (ip2 instanceof ByteProcessor)
return 8;
else if (ip2 instanceof ShortProcessor)
......@@ -1150,6 +1202,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
Menus.updateMenus();
getLocalCalibration().setImage(this);
}
typeSet = true;
}
/** Returns the string value from the "Info" property string
......@@ -1785,13 +1838,14 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
deleteRoi();
}
public synchronized void saveRoi() {
if (roi!=null) {
roi.endPaste();
Rectangle r = roi.getBounds();
public void saveRoi() {
Roi roi2 = roi;
if (roi2!=null) {
roi2.endPaste();
Rectangle r = roi2.getBounds();
if ((r.width>0 || r.height>0)) {
Roi.previousRoi = (Roi)roi.clone();
if (IJ.debugMode) IJ.log("saveRoi: "+roi);
Roi.previousRoi = (Roi)roi2.clone();
if (IJ.debugMode) IJ.log("saveRoi: "+roi2);
}
}
}
......@@ -1914,9 +1968,9 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
fi.nImages = getImageStackSize();
fi.whiteIsZero = isInvertedLut();
fi.intelByteOrder = false;
if (fi.nImages==1)
fi.pixels = ip.getPixels();
else
if (fi.nImages==1 && ip!=null)
fi.pixels = ip.getPixels();
else if (stack!=null)
fi.pixels = stack.getImageArray();
Calibration cal = getCalibration();
if (cal.scaled()) {
......@@ -2389,7 +2443,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
ip.reset(ip.getMask());
}
updateAndDraw();
//deleteRoi();
} else if (roi!=null) {
roi.startPaste(clipboard);
Undo.setup(Undo.PASTE, this);
......@@ -2568,8 +2621,8 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
*/
public void flattenStack() {
if (IJ.debugMode) IJ.log("flattenStack");
if (getStackSize()==1 || !IJ.isJava16())
throw new UnsupportedOperationException("Image stack and Java 1.6 required");
if (getStackSize()==1)
throw new UnsupportedOperationException("Image stack required");
boolean composite = isComposite();
if (getBitDepth()!=24)
new ImageConverter(this).convertToRGB();
......
......@@ -101,8 +101,7 @@ public class LookUpTable extends Object {
bar.setColor(new Color(i, i, i));
bar.moveTo(i, 0); bar.lineTo(i, height);
}
}
else {
} else {
for (int i = 0; i<mapSize; i++) {
bar.setColor(new Color(rLUT[i]&0xff, gLUT[i]&0xff, bLUT[i]&0xff));
bar.moveTo(i, 0); bar.lineTo(i, height);
......
......@@ -114,6 +114,8 @@ public class Macro {
public static String getValue(String options, String key, String defaultValue) {
key = trimKey(key);
if (!options.endsWith(" "))
options = options + " ";
key += '=';
int index=-1;
do { // Require that key not be preceded by a letter
......@@ -128,8 +130,20 @@ public class Macro {
else
return options.substring(1, index);
} else if (options.charAt(0)=='[') {
index = options.indexOf("]",1);
if (index<=1)
int count = 1;
index = -1;
for (int i=1; i<options.length(); i++) {
char ch = options.charAt(i);
if (ch=='[')
count++;
else if (ch==']')
count--;
if (count==0) {
index = i;
break;
}
}
if (index<0)
return defaultValue;
else
return options.substring(1, index);
......
......@@ -305,6 +305,7 @@ public class Menus {
addExample(submenu, "Plasma Cloud", "Plasma_Cloud.js");
addExample(submenu, "Cloud Debugger", "Cloud_Debugger.js");
addExample(submenu, "Synthetic Images", "Synthetic_Images.js");
addExample(submenu, "Points", "Points.js");
addExample(submenu, "Spiral Rotation", "Spiral_Rotation.js");
addExample(submenu, "Example Plot", "Example_Plot.js");
addExample(submenu, "Semi-log Plot", "Semi-log_Plot.js");
......@@ -320,6 +321,7 @@ public class Menus {
addExample(submenu, "Custom Measurement", "Custom_Measurement.js");
addExample(submenu, "Terabyte VirtualStack", "Terabyte_VirtualStack.js");
addExample(submenu, "Event Listener", "Event_Listener.js");
addExample(submenu, "FFT Filter", "FFT_Filter.js");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("BeanShell");
......@@ -782,6 +784,8 @@ public class Menus {
/** Returns the specified ImageJ menu (e.g., "File>New") or null if it is not found. */
public static Menu getImageJMenu(String menuPath) {
if (menus==null)
return null;
if (menus.get(menuPath)!=null)
return getMenu(menuPath, false);
else
......
......@@ -449,7 +449,7 @@ public class Prefs {
static void loadOptions() {
int defaultOptions = ANTIALIASING+AVOID_RESLICE_INTERPOLATION+ANTIALIASED_TOOLS+MULTI_POINT_MODE
+(!IJ.isMacOSX()?RUN_SOCKET_LISTENER:0);
+(!IJ.isMacOSX()?RUN_SOCKET_LISTENER:0)+BLACK_BACKGROUND;
int options = getInt(OPTIONS, defaultOptions);
usePointerCursor = (options&USE_POINTER)!=0;
//antialiasedText = (options&ANTIALIASING)!=0;
......
......@@ -352,7 +352,7 @@ public class WindowManager {
}
/** Removes the specified window from the Window menu. */
public synchronized static void removeWindow(Window win) {
public static void removeWindow(Window win) {
if (win instanceof ImageWindow)
removeImageWindow((ImageWindow)win);
else {
......
......@@ -106,6 +106,7 @@ public class EllipseRoi extends PolygonRoi {
}
}
state = NORMAL;
modifyRoi();
}
protected void moveHandle(int sx, int sy) {
......
......@@ -1303,7 +1303,7 @@ public class ImageCanvas extends Canvas implements MouseListener, MouseMotionLis
oxd = points.xpoints[0];
}
}
((PointRoi)roi).addPoint(imp, oxd, oyd);
((PointRoi)roi).addUserPoint(imp, oxd, oyd);
imp.setRoi(roi);
return;
}
......
......@@ -493,6 +493,11 @@ public class Line extends Roi {
}
return p;
}
/** Returns the number of points in this selection; equivalent to getPolygon().npoints. */
public int size() {
return getStrokeWidth()<=1?2:4;
}
public void drawPixels(ImageProcessor ip) {
ip.setLineWidth(1);
......
......@@ -291,6 +291,12 @@ public class OvalRoi extends Roi {
Polygon p = getPolygon();
return new FloatPolygon(toFloat(p.xpoints), toFloat(p.ypoints), p.npoints);
}
/** Returns the number of points in this selection; equivalent to getPolygon().npoints. */
public int size() {
return getPolygon().npoints;
}
/** Tests if the specified point is inside the boundary of this OvalRoi.
* Authors: Barry DeZonia and Michael Schmid
......