Skip to content

Commit

Permalink
2014.02.09 (1.48r7)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Feb 9, 2014
1 parent 5b68e76 commit ebddd2e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 13 deletions.
3 changes: 2 additions & 1 deletion build.xml
Expand Up @@ -6,7 +6,7 @@
<!-- First, ensure the build directory exists. -->
<mkdir dir="build" />
<!-- Build everything; add debug="on" to debug -->
<javac srcdir="." destdir="build" optimize="on" source="1.5" target="1.5" debug="on">
<javac srcdir="." destdir="build" optimize="on" source="1.5" target="1.5" debug="on" includeantruntime="false">
<!-- The plugins directory only needs to be
present at runtime, not at build time. -->
<exclude name="plugins/**"/>
Expand All @@ -21,6 +21,7 @@
<copy file="images/about.jpg" tofile="build/about.jpg" />
<copy file="plugins/MacAdapter.class" tofile="build/MacAdapter.class" />
<copy file="plugins/JavaScriptEvaluator.class" tofile="build/JavaScriptEvaluator.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"
Expand Down
2 changes: 1 addition & 1 deletion ij/ImageJ.java
Expand Up @@ -77,7 +77,7 @@ public class ImageJ extends Frame implements ActionListener,

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.48r";
public static final String BUILD = "6";
public static final String BUILD = "7";
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
2 changes: 2 additions & 0 deletions ij/gui/Roi.java
Expand Up @@ -785,6 +785,8 @@ void move(int sx, int sy) {
}
startX = xNew;
startY = yNew;
if ((this instanceof TextRoi) && ((TextRoi)this).getAngle()!=0.0)
ignoreClipRect = true;
updateClipRect();
if ((lineWidth>1 && isLine()) || ignoreClipRect || ((this instanceof PolygonRoi)&&((PolygonRoi)this).isSplineFit()))
imp.draw();
Expand Down
17 changes: 13 additions & 4 deletions ij/gui/RoiProperties.java
Expand Up @@ -72,10 +72,12 @@ public boolean showDialog() {
boolean isText = roi instanceof TextRoi;
boolean isLine = roi.isLine();
int justification = TextRoi.LEFT;
double angle = 0.0;
if (isText) {
TextRoi troi = (TextRoi)roi;
Font font = troi.getCurrentFont();
strokeWidth = font.getSize();
angle = troi.getAngle();
justification = troi.getJustification();
}
String position = ""+roi.getPosition();
Expand All @@ -98,12 +100,16 @@ public boolean showDialog() {
gd.addStringField(nameLabel, name, 15);
gd.addStringField("Position:", position);
}
gd.addStringField("Stroke color:", linec);
if (isText) {
gd.addNumericField("Font size:", strokeWidth, digits);
gd.addStringField("Font color:", linec);
gd.addNumericField("Font size:", strokeWidth, digits, 4, "points");
digits = (int)angle==angle?0:1;
gd.addNumericField("Angle:", angle, digits, 4, "degrees");
gd.addChoice("Justification:", justNames, justNames[justification]);
} else
} else {
gd.addStringField("Stroke color:", linec);
gd.addNumericField("Width:", strokeWidth, digits);
}
if (!isLine) {
gd.addMessage("");
gd.addStringField("Fill color:", fillc);
Expand Down Expand Up @@ -137,8 +143,10 @@ public boolean showDialog() {
}
linec = gd.getNextString();
strokeWidth = gd.getNextNumber();
if (isText)
if (isText) {
angle = gd.getNextNumber();
justification = gd.getNextChoiceIndex();
}
if (!isLine)
fillc = gd.getNextString();
boolean applyToOverlay = false;
Expand All @@ -163,6 +171,7 @@ public boolean showDialog() {
font = new Font(font.getName(), font.getStyle(), (int)strokeWidth);
troi.setCurrentFont(font);
}
troi.setAngle(angle);
if (justification!=troi.getJustification())
troi.setJustification(justification);
} else
Expand Down
15 changes: 11 additions & 4 deletions ij/gui/TextRoi.java
Expand Up @@ -226,17 +226,24 @@ public void draw(Graphics g) {
if (Interpreter.isBatchMode() && ic!=null && ic.getDisplayList()!=null) return;
if (newFont || width==1)
updateBounds(g);
Color c = getStrokeColor();
setStrokeColor(getColor());
super.draw(g); // draw the rectangle
setStrokeColor(c);
double mag = getMagnification();
int sx = screenXD(getXBase());
int sy = screenYD(getYBase());
int swidth = (int)((bounds!=null?bounds.width:width)*mag);
int sheight = (int)((bounds!=null?bounds.height:height)*mag);
Rectangle r = null;
r = g.getClipBounds();
g.setClip(sx, sy, swidth, sheight);
drawText(g);
if (r!=null) g.setClip(r.x, r.y, r.width, r.height);
if (angle!=0.0)
drawText(g);
else {
r = g.getClipBounds();
g.setClip(sx, sy, swidth, sheight);
drawText(g);
if (r!=null) g.setClip(r.x, r.y, r.width, r.height);
}
}

public void drawOverlay(Graphics g) {
Expand Down
5 changes: 5 additions & 0 deletions ij/plugin/filter/Filler.java
Expand Up @@ -21,6 +21,11 @@ public int setup(String arg, ImagePlus imp) {
if (imp!=null)
roi = imp.getRoi();
isTextRoi = roi!=null && (roi instanceof TextRoi);
if (isTextRoi && (arg.equals("draw") || arg.equals("fill")) && ((TextRoi)roi).getAngle()!=0.0) {
String s = IJ.isMacOSX()?"command+b":"ctrl+b";
IJ.error("Draw rotated text by pressing "+s+" (Image>Overlay>Add Selection).");
return DONE;
}
IJ.register(Filler.class);
int baseCapabilities = DOES_ALL+ROI_REQUIRED;
if (arg.equals("clear")) {
Expand Down
6 changes: 4 additions & 2 deletions ij/plugin/frame/ThresholdAdjuster.java
Expand Up @@ -455,17 +455,19 @@ void updatePercentiles(ImagePlus imp, ImageProcessor ip) {
minThresholdInt>=0 && minThresholdInt<256 && maxThresholdInt>=0 && maxThresholdInt<256) {
int[] histogram = stats.histogram;
int below = 0, inside = 0, above = 0;
int minValue=0, maxValue=255;
if (imp.getBitDepth()==16 && !entireStack(imp)) {
ip.setRoi(imp.getRoi());
histogram = ip.getHistogram();
minThresholdInt = (int)Math.round(ip.getMinThreshold());
maxThresholdInt = (int)Math.round(ip.getMaxThreshold());
minValue=(int)ip.getMin(); maxValue=(int)ip.getMax();
}
for (int i=0; i<minThresholdInt; i++)
for (int i=minValue; i<minThresholdInt; i++)
below += histogram[i];
for (int i=minThresholdInt; i<=maxThresholdInt; i++)
inside += histogram[i];
for (int i=maxThresholdInt+1; i<histogram.length; i++)
for (int i=maxThresholdInt+1; i<maxValue; i++)
above += histogram[i];
int total = below + inside + above;
//IJ.log("<"+minThresholdInt+":"+below+" in:"+inside+"; >"+maxThresholdInt+":"+above+" sum="+total);
Expand Down
6 changes: 5 additions & 1 deletion release-notes.html
Expand Up @@ -5,11 +5,13 @@
</head>
<body>

<li> <u>1.48r 7 February 2014</u>
<li> <u>1.48r 9 February 2014</u>
<ul>
<li> Thanks to Michael Schmid, the <i>Image&gt;Adjust&gt;Threshold</i> widget
displays the percentile of thresholded pixels and has other improvements
(<a href="docs/thresholder148r.html">details</a>).
<li> With text selections, the <i>Edit&gt;Selection&gt;Properties</i> dialog
adds an "Angle:" field.
<li> Thanks to Michael Schmid, the <i>Edit&gt;Crop</i> command is undoable.
<li> Thanks to Aryeh Weiss, added the RoiEncoder.save() and RoiDecoder.open() methods
(<a href="macros/js/SaveAndOpenRoi.js">example</a></ul>).
Expand All @@ -25,6 +27,8 @@
<li> Thanks to Michael Schmid, fixed bugs that caused the ImageJ menus to disappear
on Macs when using the "Threshold", "B&C", "Channels", "CP" (Color Picker)
and "Command Finder" widgets.
<li> Fixed a bug that caused the text tool to draw the text outline in the foreground
color instead of the selection color.
<li> Fixed a 1.48r regression that could cause <i>Image&gt;Adjust&gt;Threshold</i>
to throw an exception.
</ul>
Expand Down

0 comments on commit ebddd2e

Please sign in to comment.