@@ -57,6 +57,7 @@ public class PointRoi extends PolygonRoi {
5757 private int nMarkers ;
5858 private boolean addToOverlay ;
5959 public static PointRoi savedPoints ;
60+ private boolean positionSet ;
6061
6162 static {
6263 setDefaultType ((int )Prefs .get (TYPE_KEY , HYBRID ));
@@ -721,6 +722,7 @@ public void setPosition(int n) {
721722 Arrays .fill (positions , n );
722723 }
723724 hyperstackPosition = false ;
725+ positionSet = true ;
724726 }
725727
726728 /** Returns the stack position (image number) of the points in this Roi, if
@@ -729,9 +731,9 @@ public void setPosition(int n) {
729731 * if there are different stack positions for different points.
730732 */
731733 public int getPosition () {
732- if (positions == null || nPoints < 1 ) {
734+ if (positions == null || nPoints < 1 || ! positionSet )
733735 return 0 ;
734- } else {
736+ else {
735737 int position = positions [0 ];
736738 for (int i =1 ; i <nPoints ; i ++)
737739 if (positions [i ] != position )
@@ -1024,9 +1026,9 @@ public boolean addToOverlay() {
10241026
10251027 public String toString () {
10261028 if (nPoints >1 )
1027- return ("Roi[Points, count=" +nPoints +"]" );
1029+ return ("Roi[Points, count=" +nPoints +", pos=" + getPositionAsString ()+ " ]" );
10281030 else
1029- return ("Roi[Point, x=" +x +", y=" +y +"]" );
1031+ return ("Roi[Point, x=" +x +", y=" +y +", pos=" + getPositionAsString ()+ " ]" );
10301032 }
10311033
10321034 /** @deprecated */
0 commit comments