What defines the rank in the list of an ROI?

36 views
Skip to first unread message

Perrine Paul-Gilloteaux

unread,
Aug 6, 2014, 8:52:21 AM8/6/14
to icy-so...@googlegroups.com
Hi Icy team,

What defines the ordering of ROIs in the ROI panel and then consequently the sequence.getRois() Array List?
I thought it was their ID, but it is not apparently.
I've created in a plugin an ROI on one sequence, then create a copy on another sequence, moved its position on this other sequence, and do this several times. Surprisingly: the ROI for each sequence does not have the same rank: i.e the copy of one ROI does not have the same index in the List Array as the original ROI in the first sequence. Even if the order of creation was strictly Roi1 Seq 1, Copy to Seq 2 , Roi2 seq 1 , Copy Seq 2 etc..

I want to make sure they match, the only way I could think of was to give them a name that would increase lexicographically and then reorder the array list of Rois of both sequence to find matching points, or to use their ID if I'm assuming the ID is growing with the ordering of creation of ROIs? 
Did I miss something much more simple?
Best,
Perrine

Stephane

unread,
Aug 7, 2014, 8:42:57 AM8/7/14
to icy-so...@googlegroups.com
Hi Perrine,

ROi are not sorted are they are stored as a "Set" in the sequence. We used a set because it is faster when you deal with many ROI. Still that is a problem as people expect ROI to keep their index so i will modify methods returning list to keep the ordering.
The next version will include a new method to get sorted ROI list.
In the meantime you can use this to sort the list of ROI on Id (which as you guessed, is growing on ROI creation) :

Collections.sort(roiList, ROI.idComparator);

Best,

- Stephane
Reply all
Reply to author
Forward
0 new messages