Skip to content

Conversation

@LauLauThom
Copy link

This is a proposal to lift the maximum value for the group attribute of ROIs, from currently 255 to Integer.MAX_VALUE
This attribute is used for instance to group ROIs into categories, ROIs with the same group number would belong to the same category and will be depicted with the same color.

Currently, the group is limited to a max value of 255, I think because the original implementation was using a 8-bit LUT to get the color for a given ROI group. It turns out the Glasbey LUT used to depict the ROI can yield distinct color beyond this range (see (glasbeyLut.getRGB(group) in Roi.getGroupColor).
The rest of the code seems to also deal with the higher range without any issue.

The current implementation also allows storing corresponding names for the group. Those are stored in a String[]. The maximum size of an array is also Integer.MAX_VALUE, right ?

This proposal was motivated by people I had a chat with, who had the idea to use the group attribute to group ROIs across multiples Z-planes into pseudo 3D Rois.
But I think there could be other valid use cases where the current limitation of 255 might be problematic.

@LauLauThom LauLauThom marked this pull request as draft December 13, 2025 21:21
@LauLauThom LauLauThom force-pushed the increase-roigroup-max branch from cad2608 to ec04c7d Compare December 13, 2025 21:30
@LauLauThom LauLauThom marked this pull request as ready for review December 13, 2025 21:31
@ctrueden
Copy link
Member

@rasband What do you think? Do you like this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants