Skip to content
Commits on Source (6)
......@@ -153,8 +153,8 @@ stacks10="Reslice [/]...",ij.plugin.Slicer
stacks11="Orthogonal Views[H]",ij.plugin.Orthogonal_Views
stacks12="Z Project...",ij.plugin.ZProjector
stacks13="3D Project...",ij.plugin.Projector
stacks14="Plot XY Profile",ij.plugin.StackPlotter
stacks15="Plot Z-axis Profile",ij.plugin.ZAxisProfiler
stacks14="Plot Z-axis Profile",ij.plugin.ZAxisProfiler
stacks15="Measure Stack...",ij.plugin.SimpleCommands("measure")
stacks16="Label...",ij.plugin.filter.StackLabeler
stacks17="Statistics",ij.plugin.Stack_Statistics
......@@ -166,14 +166,16 @@ animation_03="Animation Options...",ij.plugin.Animator("options")
# Plugins installed in the Image/Stacks/Tools submenu
tools_01="Combine...",ij.plugin.StackCombiner
tools_02="Concatenate...",ij.plugin.Concatenator
tools_03="Reduce...",ij.plugin.StackReducer
tools_04="Reverse",ij.plugin.StackReverser
tools_05="Insert...",ij.plugin.StackInserter
tools_06="Montage to Stack...",ij.plugin.StackMaker
tools_07="Make Substack...",ij.plugin.SubstackMaker
tools_08="Grouped Z Project...",ij.plugin.GroupedZProjector
tools_09="Set Label...",ij.plugin.SimpleCommands("set")
tools_03="Grouped Z Project...",ij.plugin.GroupedZProjector
tools_04="Insert...",ij.plugin.StackInserter
tools_05="Magic Montage Tools",ij.plugin.SimpleCommands("magic")
tools_06="Make Substack...",ij.plugin.SubstackMaker
tools_07="Montage to Stack...",ij.plugin.StackMaker
tools_08="Plot XY Profile",ij.plugin.StackPlotter
tools_09="Reduce...",ij.plugin.StackReducer
tools_10="Remove Slice Labels",ij.plugin.SimpleCommands("remove")
tools_11="Reverse",ij.plugin.StackReverser
tools_12="Set Label...",ij.plugin.SimpleCommands("set")
# Plugins installed in the Image/Hyperstacks submenu
hyperstacks01="New Hyperstack...",ij.plugin.HyperStackMaker
......
imagej (1.52i-1) UNRELEASED; urgency=medium
* New upstream version 1.52i
-- David Miguel Susano Pinto <carandraug+dev@gmail.com> Wed, 12 Dec 2018 17:57:38 +0000
imagej (1.52g-1) unstable; urgency=medium
* Team upload.
......@@ -465,4 +471,3 @@ imagej (1.37m-1) unstable; urgency=low
* Initial release (Closes: #4526773, #6353442).
-- Paolo Ariano <paolo.ariano@unito.it> Fri, 28 Apr 2006 11:41:53 +0200
......@@ -8,13 +8,13 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>16.2.0</version>
<version>23.2.0</version>
<relativePath />
</parent>
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
<version>1.51p</version>
<version>1.52i</version>
<name>ImageJ</name>
<description>ImageJ is an open source Java image processing program inspired by NIH Image for the Macintosh.</description>
......@@ -61,11 +61,8 @@
<archive>https://list.nih.gov/archives/imagej.html</archive>
</mailingList>
<mailingList>
<name>ImageJ-devel</name>
<subscribe>https://imagej.net/mailman/listinfo/imagej-devel</subscribe>
<unsubscribe>https://imagej.net/mailman/listinfo/imagej-devel</unsubscribe>
<post>imagej-devel@imagej.net</post>
<archive>https://imagej.net/pipermail/imagej-devel/</archive>
<name>Image.sc Forum</name>
<archive>https://forum.image.sc/</archive>
</mailingList>
</mailingLists>
......@@ -90,6 +87,7 @@
<license.copyrightOwners>N/A</license.copyrightOwners>
<scijava.jvm.version>1.6</scijava.jvm.version>
<scijava.jvm.build.version>1.6</scijava.jvm.build.version>
<javac.path>${java.home}/../lib/tools.jar</javac.path>
</properties>
......
......@@ -17,5 +17,3 @@ Registry:
Entry: imagej
- Name: SciCrunch
Entry: SCR_003070
- Name: OMICtools
Entry: OMICS_13947
......@@ -315,7 +315,6 @@ public class CompositeImage extends ImagePlus {
imageSource.newPixels();
}
/** Uses less memory but only works correctly with Java 1.6 and later. */
void createBufferedImage() {
if (rgbSampleModel==null)
rgbSampleModel = getRGBSampleModel();
......@@ -510,6 +509,11 @@ public class CompositeImage extends ImagePlus {
setup(nChannels, getImageStack());
}
public void completeReset() {
cip = null;
lut = null;
}
/* Sets the LUT of the current channel. */
public void setChannelLut(LUT table) {
int c = getChannelIndex();
......
......@@ -642,8 +642,8 @@ public class IJ {
}
/** Displays a message in a dialog box titled "ImageJ". If a
macro is running, it is aborted. Writes to the Java console
if the ImageJ window is not present.*/
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) {
error(null, msg);
if (Thread.currentThread().getName().endsWith("JavaScript"))
......@@ -652,9 +652,9 @@ public class IJ {
Macro.abort();
}
/**Displays a message in a dialog box with the specified title.
If a macro is running, it is aborted. Writes to the Java
console if ImageJ is not present. */
/** Displays a message in a dialog box with the specified title. If a
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 title, String msg) {
if (msg!=null && msg.endsWith(Macro.MACRO_CANCELED))
return;
......@@ -672,6 +672,13 @@ public class IJ {
Macro.abort();
}
/** Aborts any currently running JavaScript, or use IJ.error(string)
to abort a JavaScript with a message. */
public static void exit() {
if (Thread.currentThread().getName().endsWith("JavaScript"))
throw new RuntimeException(Macro.MACRO_CANCELED);
}
/**
* Returns the last error message written by IJ.error() or null if there
* was no error since the last time this method was called.
......
......@@ -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.52g";
public static final String BUILD = ""; //5
public static final String VERSION = "1.52i";
public static final String BUILD = ""; //52
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,7 +418,7 @@ public class ImageJ extends Frame implements ActionListener,
ImagePlus imp = WindowManager.getCurrentImage();
boolean isStack = (imp!=null) && (imp.getStackSize()>1);
if (imp!=null && ((keyChar>=32 && keyChar<=255) || keyChar=='\b' || keyChar=='\n')) {
if (imp!=null && !meta && ((keyChar>=32 && keyChar<=255) || keyChar=='\b' || keyChar=='\n')) {
Roi roi = imp.getRoi();
if (roi!=null && roi instanceof TextRoi) {
if (imp.getOverlay()!=null && (control || alt || meta)
......
......@@ -90,6 +90,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
private boolean noUpdateMode;
private ImageCanvas flatteningCanvas;
private Overlay overlay;
private boolean compositeChanges;
private boolean hideOverlay;
private static int default16bitDisplayRange;
private boolean antialiasRendering = true;
......@@ -156,7 +157,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
private void setID() {
ID = --currentID;
//IJ.log("New "+this);
}
/** Locks the image so other threads can test to see if it
......@@ -556,28 +556,38 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
if (newProperties!=null)
newProperties = (Properties)(newProperties.clone());
if (imp.getWindow()!=null)
imp = imp.duplicate();
imp = imp.duplicateAll();
ImageStack stack2 = imp.getStack();
if (imp.isHyperStack())
setOpenAsHyperStack(true);
LUT[] luts = null;
if (imp.isComposite() && this.isComposite()) {
if (imp.isComposite() && (this instanceof CompositeImage)) {
if (((CompositeImage)imp).getMode()!=((CompositeImage)this).getMode())
((CompositeImage)this).setMode(((CompositeImage)imp).getMode());
luts = ((CompositeImage)imp).getLuts();
}
LUT lut = !imp.isComposite()?imp.getProcessor().getLut():null;
setStack(stack2, imp.getNChannels(), imp.getNSlices(), imp.getNFrames());
compositeImage = imp.isComposite();
if (luts!=null) {
((CompositeImage)this).setLuts(luts);
updateAndDraw();
((CompositeImage)this).setMode(((CompositeImage)imp).getMode());
updateAndRepaintWindow();
} else if (lut!=null) {
getProcessor().setLut(lut);
updateAndRepaintWindow();
}
setTitle(imp.getTitle());
setCalibration(imp.getCalibration());
setOverlay(imp.getOverlay());
properties = newProperties;
if (getProperty(Plot.PROPERTY_KEY)!=null && win instanceof PlotWindow) {
Plot plot = (Plot)(getProperty(Plot.PROPERTY_KEY));
((PlotWindow)win).setPlot(plot);
plot.setImagePlus(this);
}
setFileInfo(imp.getOriginalFileInfo());
setProperty ("Info", imp.getProperty ("Info"));
}
/** Replaces the ImageProcessor with the one specified and updates the
......@@ -659,9 +669,10 @@ 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) {
//IJ.log("setStack1: "+nChannels+" "+nSlices+" "+nFrames);
int bitDepth1 = getBitDepth();
int previousStackSize = getStackSize();
int newStackSize = newStack.getSize();
//IJ.log("setStack: "+newStackSize+" "+this);
if (newStackSize==0)
throw new IllegalArgumentException("Stack is empty");
if (!newStack.isVirtual()) {
......@@ -687,16 +698,25 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
this.stack = newStack;
oneSliceStack = false;
setProcessor2(title, ip, newStack);
if (bitDepth1!=0 && bitDepth1!=getBitDepth())
compositeChanges = true;
if (compositeChanges && (this instanceof CompositeImage)) {
this.compositeImage = getStackSize()!=getNSlices();
((CompositeImage)this).completeReset();
if (bitDepth1!=0 && bitDepth1!=getBitDepth())
((CompositeImage)this).resetDisplayRanges();
}
compositeChanges = false;
if (win==null) {
if (resetCurrentSlice) setSlice(currentSlice);
return;
}
boolean invalidDimensions = (isDisplayedHyperStack()||isComposite()) && (win instanceof StackWindow) && !((StackWindow)win).validDimensions();
boolean invalidDimensions = (isDisplayedHyperStack()||(this instanceof CompositeImage)) && (win instanceof StackWindow) && !((StackWindow)win).validDimensions();
if (newStackSize>1 && !(win instanceof StackWindow)) {
if (isDisplayedHyperStack())
setOpenAsHyperStack(true);
activated = false;
win = new StackWindow(this, getCanvas()); // replaces this window
win = new StackWindow(this, dimensionsChanged?null:getCanvas()); // replaces this window
if (IJ.isMacro()) { // wait for stack window to be activated
long start = System.currentTimeMillis();
while (!activated) {
......@@ -724,24 +744,16 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
}
if (resetCurrentSlice)
setSlice(currentSlice);
if (isComposite() && previousStackSize!=newStackSize)
compositeImage = false;
}
public void setStack(ImageStack newStack, int channels, int slices, int frames) {
if (newStack==null || channels*slices*frames!=newStack.getSize())
throw new IllegalArgumentException("channels*slices*frames!=stackSize");
int channelsBefore = this.nChannels;
if (IJ.debugMode) IJ.log("setStack: "+newStack.getSize()+" "+channels+" ("+channelsBefore+") "+slices+" "+frames+" "+isComposite());
if (IJ.debugMode) IJ.log("setStack: "+newStack.getSize()+" "+channels+" "+slices+" "+frames+" "+isComposite());
compositeChanges = channels!=this.nChannels;
this.nChannels = channels;
this.nSlices = slices;
this.nFrames = frames;
if (channelsBefore!=channels && isComposite()) {
ImageStack stack2 = this.stack;
this.stack = newStack;
((CompositeImage)this).reset();
this.stack = stack2;
}
setStack(null, newStack);
}
......@@ -863,7 +875,9 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
}
/** Returns an 8-bit binary (0 and 255) ROI or overlay mask
* that has the same dimensions as this image.
* that has the same dimensions as this image. Creates an
* ROI mask If the image has both an ROI and an overlay.
* @see #createThresholdMask
* @see ij.gui.Roi#getMask
*/
public ByteProcessor createRoiMask() {
......@@ -873,11 +887,23 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
throw new IllegalArgumentException("ROI or overlay required");
ByteProcessor mask = new ByteProcessor(getWidth(),getHeight());
mask.setColor(255);
if (overlay2!=null) {
if (roi2!=null)
mask.fill(roi2);
else if (overlay2!=null) {
if (overlay2.size()==1 && (overlay2.get(0) instanceof ImageRoi)) {
ImageRoi iRoi = (ImageRoi)overlay2.get(0);
ImageProcessor ip = iRoi.getProcessor();
if (ip.getWidth()!=mask.getWidth() || ip.getHeight()!=mask.getHeight())
return mask;
for (int i=0; i<ip.getPixelCount(); i++) {
if (ip.get(i)!=0)
mask.set(i, 255);
}
} else {
for (int i=0; i<overlay2.size(); i++)
mask.fill(overlay2.get(i));
} else if (roi2!=null)
mask.fill(roi2);
}
}
return mask;
}
......@@ -1012,14 +1038,28 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
notifyListeners(UPDATED);
}
/** Returns the width of this image in pixels. */
public int getWidth() {
return width;
}
/** Returns the height of this image in pixels. */
public int getHeight() {
return height;
}
/** Returns the size of this image in bytes. */
public double getSizeInBytes() {
double size = ((double)getWidth()*getHeight()*getStackSize());
int type = getType();
switch (type) {
case ImagePlus.GRAY16: size *= 2.0; break;
case ImagePlus.GRAY32: size *= 4.0; break;
case ImagePlus.COLOR_RGB: size *= 4.0; break;
}
return size;
}
/** If this is a stack, returns the number of slices, else returns 1. */
public int getStackSize() {
if (stack==null || oneSliceStack)
......@@ -1074,7 +1114,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
new StackWindow(this);
}
dimensionsSet = true;
//IJ.log("setDimensions: "+ nChannels+" "+nSlices+" "+nFrames);
}
/** Returns 'true' if this image is a hyperstack. */
......@@ -1105,7 +1144,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
/** Returns the image depth (number of z-slices). */
public int getNSlices() {
//IJ.log("getNSlices: "+ nChannels+" "+nSlices+" "+nFrames);
verifyDimensions();
return nSlices;
}
......@@ -1268,6 +1306,8 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
index1 = findKey(info, key+": "); // standard 'key: value' pair?
if (index1<0) // Bio-Formats metadata?
index1 = findKey(info, key+" = ");
if (index1<0) // '=' with no spaces
index1 = findKey(info, key+"=");
if (index1<0) // otherwise not found
return null;
if (index1==info.length())
......@@ -1519,7 +1559,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
boolean channelChanged = channel!=getChannel();
setSlice((frame-1)*nChannels*nSlices + (slice-1)*nChannels + channel);
updatePosition(channel, slice, frame);
if (channelChanged && isComposite())
if (channelChanged && isComposite() && !noUpdateMode)
updateImage();
}
}
......@@ -1724,8 +1764,14 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
ip.resetRoi();
}
roi.setImage(this);
if ((roi instanceof PointRoi) && ((PointRoi)roi).addToOverlay()) {
IJ.run(this, "Add Selection...", "");
roi = null;
return;
}
if (updateDisplay)
draw();
if (roi!=null)
roi.notifyListeners(RoiListener.CREATED);
}
......@@ -1743,6 +1789,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
starting screen coordinates. The selection type is determined by which tool in
the tool bar is active. The user interactively sets the selection size and shape. */
public void createNewRoi(int sx, int sy) {
Roi previousRoi = roi;
deleteRoi();
switch (Toolbar.getToolId()) {
case Toolbar.RECTANGLE:
......@@ -1774,6 +1821,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
break;
case Toolbar.TEXT:
roi = new TextRoi(sx, sy, this);
((TextRoi)roi).setPreviousRoi(previousRoi);
break;
case Toolbar.POINT:
roi = new PointRoi(sx, sy, this);
......@@ -1924,7 +1972,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
url2 = fi.url;
} else
return;
//IJ.log("revert: "+path+" "+fi);
IJ.showStatus("Loading: " + path);
ImagePlus imp = IJ.openImage(path);
if (imp!=null) {
......@@ -2096,6 +2143,7 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
/** Returns a copy of this image or stack, cropped if there is an ROI.
* @see #duplicateAll
* @see #crop
* @see ij.plugin.Duplicator#run
*/
......@@ -2103,8 +2151,21 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
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);
setRoi(roi);
return imp2;
}
/** 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() {
......@@ -2381,8 +2442,6 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
case ImagePlus.GRAY16: bytesPerPixel = 2; break;
case ImagePlus.GRAY32: case ImagePlus.COLOR_RGB: bytesPerPixel = 4;
}
//Roi roi3 = clipboard.getRoi();
//IJ.log("copy: "+clipboard +" "+ "roi3="+(roi3!=null?""+roi3:""));
if (!batchMode) {
msg = (cut)?"Cut":"Copy";
IJ.showStatus(msg + ": " + (clipboard.getWidth()*clipboard.getHeight()*bytesPerPixel)/1024 + "k");
......@@ -2411,13 +2470,11 @@ public class ImagePlus implements ImageObserver, Measurements, Cloneable {
if (cr==null)
cr = new Rectangle(0, 0, w, h);
if (r==null || (cr.width!=r.width || cr.height!=r.height)) {
// create a new roi centered on visible part of image
ImageCanvas ic = null;
if (win!=null)
ic = win.getCanvas();
// Create a new roi centered on visible part of image, or centered on image if clipboard is >= image
ImageCanvas ic = win!=null?ic = win.getCanvas():null;
Rectangle srcRect = ic!=null?ic.getSrcRect():new Rectangle(0,0,width,height);
int xCenter = srcRect.x + srcRect.width/2;
int yCenter = srcRect.y + srcRect.height/2;
int xCenter = w>=width ? width/2 : srcRect.x + srcRect.width/2;
int yCenter = h>=height ? height/2 : srcRect.y + srcRect.height/2;
if (cRoi!=null && cRoi.getType()!=Roi.RECTANGLE) {
cRoi.setImage(this);
cRoi.setLocation(xCenter-w/2, yCenter-h/2);
......
......@@ -276,6 +276,8 @@ public class Menus {
addExample(submenu, "Histograms", "Histograms_.ijm");
addExample(submenu, "Bar Charts", "Bar_Charts_.ijm");
addExample(submenu, "Shapes", "Plot_Shapes_.ijm");
addExample(submenu, "Plot Styles", "Plot_Styles_.ijm");
addExample(submenu, "Random Data", "Random_Data_.ijm");
submenu.addActionListener(listener);
menu.add(submenu);
......@@ -311,6 +313,8 @@ public class Menus {
addExample(submenu, "Semi-log Plot", "Semi-log_Plot.js");
addExample(submenu, "Arrow Plot", "Arrow_Plot.js");
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, "Process Folder", "Batch_Process_Folder.js");
addExample(submenu, "Sine/Cosine Table", "Sine_Cosine_Table.js");
addExample(submenu, "Non-numeric Table", "Non-numeric_Table.js");
......
......@@ -178,6 +178,8 @@ public class Prefs {
public static boolean closingAll;
/** Dialog "Cancel" button is on right on Linux */
public static boolean dialogCancelButtonOnRight;
/** Support TRANSFORM Undo in macros */
public static boolean supportMacroUndo;
static boolean commandLineMacro;
static Properties ijPrefs = new Properties();
......
......@@ -12,11 +12,14 @@ import java.awt.image.*;
public class Undo {
public static final int NOTHING = 0;
/** Undo using ImageProcessor.snapshot. */
public static final int FILTER = 1;
/** Undo using an ImageProcessor copy. */
public static final int TYPE_CONVERSION = 2;
public static final int PASTE = 3;
public static final int COMPOUND_FILTER = 4;
public static final int COMPOUND_FILTER_DONE = 5;
/** Undo using a single image, or composite color stack, copy (limited to 200MB). */
public static final int TRANSFORM = 6;
public static final int OVERLAY_ADDITION = 7;
public static final int ROI = 8;
......@@ -51,8 +54,10 @@ public class Undo {
ipCopy = imp.getProcessor();
calCopy = (Calibration)imp.getCalibration().clone();
} else if (what==TRANSFORM) {
if (!IJ.macroRunning())
impCopy = new ImagePlus(imp.getTitle(), imp.getProcessor().duplicate());
if ((!IJ.macroRunning()||Prefs.supportMacroUndo) && (imp.getStackSize()==1||imp.getDisplayMode()==IJ.COMPOSITE) && imp.getSizeInBytes()<209715200)
impCopy = imp.duplicateAll();
else
reset();
} else if (what==MACRO) {
impCopy = new ImagePlus(imp.getTitle(), imp.getProcessor().duplicate());
whatToUndo = TRANSFORM;
......@@ -82,6 +87,7 @@ public class Undo {
}
public static void reset() {
if (IJ.debugMode) IJ.log("Undo.reset: "+ whatToUndo+" "+impCopy);
if (whatToUndo==COMPOUND_FILTER || whatToUndo==OVERLAY_ADDITION)
return;
whatToUndo = NOTHING;
......@@ -91,13 +97,12 @@ public class Undo {
calCopy = null;
roiCopy = null;
lutCopy = null;
//if (IJ.debugMode) IJ.log("Undo.reset");
}
public static void undo() {
ImagePlus imp = WindowManager.getCurrentImage();
if (IJ.debugMode) IJ.log("Undo.undo: "+ whatToUndo+" "+imp+" "+imageID);
if (IJ.debugMode) IJ.log("Undo.undo: "+ whatToUndo+" "+imp+" "+impCopy);
if (imp==null || imageID!=imp.getID()) {
if (imp!=null && !IJ.macroRunning()) { // does image still have an undo buffer?
ImageProcessor ip2 = imp.getProcessor();
......@@ -113,8 +118,6 @@ public class Undo {
if (ip!=null) {
if (!IJ.macroRunning()) {
ip.swapPixelArrays();
//IJ.log("undo-filter: "+displayRangeMin+" "+displayRangeMax);
//ip.setMinAndMax(displayRangeMin,displayRangeMax);
imp.updateAndDraw();
return; // don't reset
} else {
......@@ -138,7 +141,7 @@ public class Undo {
break;
case TRANSFORM:
if (impCopy!=null)
imp.setProcessor(impCopy.getTitle(), impCopy.getProcessor());
imp.setStack(impCopy.getStack());
break;
case PASTE:
Roi roi = imp.getRoi();
......
......@@ -54,7 +54,7 @@ public class GUI {
public static Rectangle getZeroBasedMaxBounds() {
if (maxBounds==null)
getMaxWindowBounds();
if (IJ.debugMode) IJ.log("GUI.getZeroBasedMaxBounds: "+zeroBasedMaxBounds);
//if (IJ.debugMode) IJ.log("GUI.getZeroBasedMaxBounds: "+zeroBasedMaxBounds);
return zeroBasedMaxBounds;
}
......@@ -110,7 +110,7 @@ public class GUI {
break;
}
}
if (IJ.debugMode) IJ.log("GUI.getZeroBasedMonitor: "+bounds2);
//if (IJ.debugMode) IJ.log("GUI.getZeroBasedMonitor: "+bounds2);
if (bounds2!=null) {
bounds = bounds2;
zeroBasedMaxBounds = bounds2;
......
......@@ -1508,13 +1508,17 @@ FocusListener, ItemListener, KeyListener, AdjustmentListener, WindowListener {
public void paint(Graphics g) {
super.paint(g);
if (firstPaint && IJ.isMacOSX() && IJ.isJava18()) {
IJ.wait(25);
if (firstPaint && IJ.isMacOSX() && IJ.isJava18()) { // fix for incompletely drawn dialogs on Macs
EventQueue.invokeLater(new Runnable() {
public void run() {
IJ.wait(50);
Dimension size = getSize();
if (size!=null)
setSize(size.width+2,size.height+2);
firstPaint = false;
}
});
}
}
public void windowClosing(WindowEvent e) {
......@@ -1532,9 +1536,12 @@ FocusListener, ItemListener, KeyListener, AdjustmentListener, WindowListener {
}
void showHelp() {
if (helpURL.startsWith("<html>"))
new HTMLDialog(this, "", helpURL);
else {
if (helpURL.startsWith("<html>")) {
if (this instanceof NonBlockingGenericDialog)
new HTMLDialog("", helpURL, false); // non blocking
else
new HTMLDialog(this, "", helpURL); //modal
} else {
String macro = "run('URL...', 'url="+helpURL+"');";
new MacroRunner(macro);
}
......
......@@ -506,24 +506,6 @@ public class HistogramWindow extends ImageWindow implements Measurements, Action
this.imp.updateAndDraw();
}
/*
void rescale() {
Graphics g = img.getGraphics();
plotScale *= 2;
if ((newMaxCount/plotScale)<50) {
plotScale = 1;
frame = new Rectangle(XMARGIN, YMARGIN, HIST_WIDTH, HIST_HEIGHT);
g.setColor(Color.white);
g.fillRect(frame.x, frame.y, frame.width, frame.height);
g.setColor(Color.black);
}
drawPlot(newMaxCount/plotScale, g);
//ImageProcessor ip = new ColorProcessor(img);
//this.imp.setProcessor(null, ip);
this.imp.setImage(img);
}
*/
public void actionPerformed(ActionEvent e) {
Object b = e.getSource();
if (b==live)
......
......@@ -126,6 +126,7 @@ public class ImageRoi extends Roi {
ImagePlus imp = new ImagePlus("", img);
roi2.setProcessor(imp.getProcessor());
roi2.setOpacity(getOpacity());
roi2.zeroTransparent = !zeroTransparent;
roi2.setZeroTransparent(zeroTransparent);
return roi2;
}
......
......@@ -353,13 +353,7 @@ public class ImageWindow extends Frame implements FocusListener, WindowListener,
public static String getImageSize(ImagePlus imp) {
if (imp==null)
return null;
double size = ((double)imp.getWidth()*imp.getHeight()*imp.getStackSize())/1024.0;
int type = imp.getType();
switch (type) {
case ImagePlus.GRAY16: size *= 2.0; break;
case ImagePlus.GRAY32: size *= 4.0; break;
case ImagePlus.COLOR_RGB: size *= 4.0; break;
}
double size = imp.getSizeInBytes()/1024.0;
String s2=null, s3=null;
if (size<1024.0)
{s2=IJ.d2s(size,0); s3="K";}
......
......@@ -612,6 +612,7 @@ public class Line extends Roi {
case KeyEvent.VK_RIGHT: x2R+=inc; break;
}
grow(ic.screenXD(x+x2R), ic.screenYD(y+y2R));
notifyListeners(RoiListener.MOVED);
}
public boolean getDrawOffset() {
......
......@@ -90,6 +90,15 @@ public class Overlay {
}
}
/** Returns the ROI with the specified name or null if not found. */
public Roi get(String name) {
int index = getIndex(name);
if (index==-1)
return null;
else
return get(index);
}
/** Returns the index of the ROI with the specified name, or -1 if not found. */
public int getIndex(String name) {
if (name==null) return -1;
......
This diff is collapsed.
This diff is collapsed.