Skip to content

Commit 5a3ef4a

Browse files
committed
2025.09.05 (1.54r2; Point selections)
1 parent cdd38e4 commit 5a3ef4a

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

ij/ImageJ.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public class ImageJ extends Frame implements ActionListener,
7878
MouseListener, KeyListener, WindowListener, ItemListener, Runnable {
7979

8080
/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
81-
public static final String VERSION = "1.54q";
82-
public static final String BUILD = ""; //21
81+
public static final String VERSION = "1.54r";
82+
public static final String BUILD = "2";
8383
public static Color backgroundColor = new Color(237,237,237);
8484
/** SansSerif, 12-point, plain font. */
8585
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);

ij/gui/ImageCanvas.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ private void drawOverlay(Overlay overlay, Graphics g) {
345345
else if (t==0)
346346
t = position;
347347
}
348-
if (((c==0||c==channel) && (z==0||z==slice) && (t==0||t==frame)) || roiManagerShowAllMode)
348+
//IJ.log("drawOverlay: i="+i+", pos="+roi.getPosition());
349+
if (((c==0||c==channel) && (z==0||z==slice) && (t==0||t==frame)) || roiManagerShowAllMode || position == PointRoi.POINTWISE_POSITION)
349350
drawRoi(g, roi, drawLabels?i+LIST_OFFSET:-1);
350351
} else {
351352
int position = stackSize>1?roi.getPosition():0;
@@ -363,7 +364,7 @@ else if (t==1)
363364
position = 0;
364365
if ((roi instanceof PointRoi) && Prefs.showAllPoints)
365366
position = 0;
366-
//IJ.log(c+" "+z+" "+t+" p="+position+"getP="+roi.getPosition()+" "+roiManagerShowAllMode);
367+
//IJ.log("drawOverlay: i="+i+", pos="+roi.getPosition()+", pos2="+position);
367368
if (position==0 || position==currentImage || roiManagerShowAllMode)
368369
drawRoi(g, roi, drawLabels?i+LIST_OFFSET:-1);
369370
}

ij/gui/PointRoi.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class PointRoi extends PolygonRoi {
5757
private int nMarkers;
5858
private boolean addToOverlay;
5959
public static PointRoi savedPoints;
60-
private boolean positionSet;
6160

6261
static {
6362
setDefaultType((int)Prefs.get(TYPE_KEY, HYBRID));
@@ -423,8 +422,6 @@ private synchronized void incrementCounter(ImagePlus imp) {
423422
counters[nPoints-1] = (short)counter;
424423
if (imp!=null)
425424
positions[nPoints-1] = imp.getStackSize()>1 ? imp.getCurrentSlice() : 0;
426-
//if (positions[nPoints-1]==0 || positions[nPoints-1]==1 || counters[nPoints-1]==0)
427-
//IJ.log("incrementCounter: "+nPoints+" "+counters.length+" "+counters[nPoints-1]+" "+positions[nPoints-1]+" "+imp);
428425
}
429426
if (rt!=null && WindowManager.getFrame(getCountsTitle())!=null)
430427
displayCounts();
@@ -728,8 +725,7 @@ public void setPosition(int n) {
728725
if (n != POINTWISE_POSITION)
729726
Arrays.fill(positions, n);
730727
}
731-
hyperstackPosition = false;
732-
positionSet = true;
728+
super.setPosition(0);
733729
}
734730

735731
/** Returns the stack position (image number) of the points in this Roi, if
@@ -738,16 +734,19 @@ public void setPosition(int n) {
738734
* if there are different stack positions for different points.
739735
*/
740736
public int getPosition() {
741-
//if (positions==null || nPoints<1 || !positionSet)
737+
int position = 0;
742738
if (positions==null || nPoints<1)
743-
return 0;
739+
position = 0;
740+
else if (nPoints==1)
741+
position = super.getPosition();
744742
else {
745-
int position = positions[0];
746-
for (int i=1; i<nPoints; i++)
743+
position = positions[0];
744+
for (int i=1; i<nPoints; i++) {
747745
if (positions[i] != position)
748-
return POINTWISE_POSITION;
749-
return position;
746+
position = POINTWISE_POSITION;
747+
}
750748
}
749+
return position;
751750
}
752751

753752
/** Returns the stack slice of the point with the given index, or 0 if no slice defined for this point */

ij/gui/Roi.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public class Roi extends Object implements Cloneable, java.io.Serializable, Iter
115115
private String name;
116116
private int position;
117117
private int channel, slice, frame;
118-
protected boolean hyperstackPosition;
119118
private Overlay prototypeOverlay;
120119
private boolean subPixel;
121120
private boolean activeOverlayRoi;
@@ -1848,7 +1847,6 @@ public static synchronized void setGroupName(int groupNumber, String name) {
18481847
temp[i] = groupNames[i];
18491848
groupNames = temp;
18501849
}
1851-
//IJ.log("setGroupName: "+groupNumber+" "+name+" "+groupNames.length);
18521850
groupNames[groupNumber-1] = name;
18531851
groupNamesChanged = true;
18541852
}
@@ -2201,7 +2199,6 @@ public void setPosition(int n) {
22012199
if (n<0) n=0;
22022200
position = n;
22032201
channel = slice = frame = 0;
2204-
hyperstackPosition = false;
22052202
}
22062203

22072204
/** Returns the stack position (image number) for displaying this ROI,
@@ -2237,12 +2234,14 @@ public void setPosition(int channel, int slice, int frame) {
22372234
if (frame<0) frame=0;
22382235
this.frame = frame;
22392236
position = 0;
2240-
hyperstackPosition = true;
22412237
}
22422238

22432239
/** Returns 'true' if setPosition(C,Z,T) has been called. */
22442240
public boolean hasHyperStackPosition() {
2245-
return hyperstackPosition;
2241+
if (getPosition()==PointRoi.POINTWISE_POSITION)
2242+
return false;
2243+
else
2244+
return channel>0 || slice>0 || frame>0;
22462245
}
22472246

22482247
/** Sets the position of this ROI based on the stack position of the specified image. */
@@ -2269,7 +2268,7 @@ public final int getCPosition() {
22692268
* if this ROI is not associated with a particular slice.
22702269
*/
22712270
public final int getZPosition() {
2272-
return slice==0&&!hyperstackPosition ? getPosition() : slice;
2271+
return slice==0&&!hasHyperStackPosition() ? getPosition() : slice;
22732272
}
22742273

22752274
/** Returns the frame position of this ROI, or zero

ij/plugin/OverlayCommands.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ void addImage(boolean createImageRoi) {
251251
}
252252

253253
private void setPosition(ImagePlus imp, Roi roi) {
254+
//IJ.log("Overlay.setPosition: "+roi.size());
255+
if (roi instanceof PointRoi && roi.size()>1)
256+
return;
254257
int stackSize = imp.getStackSize();
255258
if (roi.hasHyperStackPosition() && imp.isHyperStack())
256259
return;

ij/plugin/frame/RoiManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ boolean restore(ImagePlus imp, int index, boolean setSlice) {
703703
Roi roi = (Roi)rois.get(index);
704704
if (imp==null || roi==null)
705705
return false;
706-
//IJ.log("restore: "+roi.getPosition()+" "+roi.getZPosition()+" "+imp.getNSlices()+" "+imp.getStackSize());
707706
if (setSlice) {
708707
boolean hyperstack = imp.isHyperStack();
709708
int position = roi.getPosition();
@@ -1575,7 +1574,6 @@ void setProperties(Color color, int lineWidth, Color fillColor) {
15751574
if (group>=0)
15761575
roi.setGroup(group);
15771576
if (rpRoi!=null) {
1578-
//IJ.log("new pos="+rpRoi.getPosition());
15791577
if (rpRoi.hasHyperStackPosition())
15801578
roi.setPosition(rpRoi.getCPosition(), rpRoi.getZPosition(), rpRoi.getTPosition());
15811579
else
@@ -2717,7 +2715,6 @@ public void mouseWheelMoved(MouseWheelEvent event) {
27172715
index += rot;
27182716
if (index<0) index = 0;
27192717
if (index>=getCount()) index = getCount();
2720-
//IJ.log(index+" "+rot);
27212718
select(index);
27222719
if (IJ.isWindows())
27232720
list.requestFocusInWindow();

release-notes.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
</head>
66
<body>
77

8+
<li> <u>1.54r2 5 September 2025</u>
9+
<ul> Fixed several bugs with displaying and positioning
10+
point selections in the ROI Manager and in overlays.
11+
</ul>
12+
813
<li> <u>1.54q 2 September 2025</u>
914
<ul>
1015
<li> Thanks to 'AFMiJ', updated <i>Image&gt;Adjust&gt;Brightness/Contrast</i>

0 commit comments

Comments
 (0)