Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ij/gui/Roi.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class Roi extends Object implements Cloneable, java.io.Serializable, Iter
public static final int FERET_ARRAYSIZE = 16; // Size of array with Feret values
public static final int FERET_ARRAY_POINTOFFSET = 8; // Where point coordinates start in Feret array
private static final String NAMES_KEY = "group.names";
private static final String MAX_ROI_GROUP = Integer.MAX_VALUE;

static final int NO_MODS=0, ADD_TO_ROI=1, SUBTRACT_FROM_ROI=2; // modification states

Expand Down Expand Up @@ -1807,7 +1808,7 @@ public static int getDefaultGroup() {
* @see #getGroupColor
*/
public static void setDefaultGroup(int group) {
if (group<0 || group>255)
if (group<0 || group>MAX_ROI_GROUP)
throw new IllegalArgumentException("Invalid group: "+group);
defaultGroup = group;
groupColor = getGroupColor(group);
Expand All @@ -1820,7 +1821,7 @@ public int getGroup() {

/** Returns the group name associtated with the specified group. */
public static String getGroupName(int groupNumber) {
if (groupNumber<1 || groupNumber>255)
if (groupNumber<1 || groupNumber>MAX_ROI_GROUP)
return null;
if (groupNames==null && groupNamesString==null)
return null;
Expand All @@ -1835,7 +1836,7 @@ public static String getGroupName(int groupNumber) {
}

public static synchronized void setGroupName(int groupNumber, String name) {
if (groupNumber<1 || groupNumber>255)
if (groupNumber<1 || groupNumber>MAX_ROI_GROUP)
return;
if (groupNamesString==null && groupNames==null)
groupNames = new String[groupNumber];
Expand Down Expand Up @@ -1884,7 +1885,7 @@ public static void setGroupNames(String names) {

/** Sets the group of this Roi, and updates stroke color accordingly. */
public void setGroup(int group) {
if (group<0 || group>255)
if (group<0 || group>MAX_ROI_GROUP)
throw new IllegalArgumentException("Invalid group: "+group);
if (group>0)
setStrokeColor(getGroupColor(group));
Expand Down
Loading