@@ -55,6 +55,7 @@ public class Roi extends Object implements Cloneable, java.io.Serializable, Iter
5555 public static final int FERET_ARRAYSIZE = 16 ; // Size of array with Feret values
5656 public static final int FERET_ARRAY_POINTOFFSET = 8 ; // Where point coordinates start in Feret array
5757 private static final String NAMES_KEY = "group.names" ;
58+ private static final String MAX_ROI_GROUP = Integer .MAX_VALUE ;
5859
5960 static final int NO_MODS =0 , ADD_TO_ROI =1 , SUBTRACT_FROM_ROI =2 ; // modification states
6061
@@ -1807,7 +1808,7 @@ public static int getDefaultGroup() {
18071808 * @see #getGroupColor
18081809 */
18091810 public static void setDefaultGroup (int group ) {
1810- if (group <0 || group >255 )
1811+ if (group <0 || group >MAX_ROI_GROUP )
18111812 throw new IllegalArgumentException ("Invalid group: " +group );
18121813 defaultGroup = group ;
18131814 groupColor = getGroupColor (group );
@@ -1820,7 +1821,7 @@ public int getGroup() {
18201821
18211822 /** Returns the group name associtated with the specified group. */
18221823 public static String getGroupName (int groupNumber ) {
1823- if (groupNumber <1 || groupNumber >255 )
1824+ if (groupNumber <1 || groupNumber >MAX_ROI_GROUP )
18241825 return null ;
18251826 if (groupNames ==null && groupNamesString ==null )
18261827 return null ;
@@ -1835,7 +1836,7 @@ public static String getGroupName(int groupNumber) {
18351836 }
18361837
18371838 public static synchronized void setGroupName (int groupNumber , String name ) {
1838- if (groupNumber <1 || groupNumber >255 )
1839+ if (groupNumber <1 || groupNumber >MAX_ROI_GROUP )
18391840 return ;
18401841 if (groupNamesString ==null && groupNames ==null )
18411842 groupNames = new String [groupNumber ];
@@ -1884,7 +1885,7 @@ public static void setGroupNames(String names) {
18841885
18851886 /** Sets the group of this Roi, and updates stroke color accordingly. */
18861887 public void setGroup (int group ) {
1887- if (group <0 || group >255 )
1888+ if (group <0 || group >MAX_ROI_GROUP )
18881889 throw new IllegalArgumentException ("Invalid group: " +group );
18891890 if (group >0 )
18901891 setStrokeColor (getGroupColor (group ));
0 commit comments