Login  Register

Re: Roi Manager Problem

Posted by Bill Mohler on May 04, 2011; 6:26pm
URL: http://imagej.273.s1.nabble.com/Roi-Manager-Problem-tp3684713p3684715.html

...  Actually, I just looked over my own ImageCanvas.java modifications,
and I found that I must have previously encountered the problem because
I had implemented a solution in my copy.  It also seems to solve the
problem by modifying a different method to limit accessible ROIs to
those in the current slice:


     void drawAllROIs(Graphics g) {

...
//        if (labelRects==null || labelRects.length!=n)
         labelRects = new Rectangle[n];

...
             if (Prefs.showAllSliceOnly && imp.getStackSize()>1) {
                 if (hyperstack) {

                     int c = roi.getCPosition();
                     int z = roi.getZPosition();
                     int t = roi.getTPosition();
                     if ((c==0||c==channel) && (z==0||z==slice) &&
(t==0||t==frame))
                         drawRoi(g, roi, drawLabels?i:-1);

                         labelRects[i] = new Rectangle(roi.getBounds());
                     }
                 } else {
                     int position = roi.getPosition();
                     if (position==0)
                         position = getSliceNumber(roi.getName());
                     if (position==0 || position==currentImage)
                         drawRoi(g, roi, -1);
                         drawRoi(g, roi, drawLabels?i:-1);

                         labelRects[i] = new Rectangle(roi.getBounds());

                }
             }
         }
         ((Graphics2D)g).setStroke(Roi.onePixelWide);
     }


I also found one error in mousePressed(e) that can mess up the clicking
of ROIs in edit mode when the image is zoomed in or out:

the line
                 if (!(roi!=null && (roi.contains(ox,
oy)||roi.isHandle(x, y)>=0)) && roiManagerSelect(x, y))


  should read
                if (!(roi!=null && (roi.contains(ox,
oy)||roi.isHandle(x, y)>=0)) && roiManagerSelect(ox, oy))


Best,
Bill



On 5/4/11 1:56 PM, Bill Mohler wrote:

> Peter-
>
> I just came upon the same problem (by chance) just after reading your
> post.  Thanks for the simple solution!
>
> Bill
>
> On 5/4/11 12:42 AM, Peter Haub wrote:
>>          // Check slice number
>>          slice = getSliceNumber(list.getItem(i));
>>          if (slice != imp.getCurrentSlice()) continue;

--

William A. Mohler

Associate Professor
Dept. of Genetics and Developmental Biology
University of Connecticut Health Center

*Physical Address:***

Room R1159

Cell and Genome Sciences Building

400 Farmington Ave.

Farmington, CT

*Mail Address:*

MC-6403

263 Farmington Ave.

Farmington, CT06030-6403

[hidden email] <mailto:[hidden email]>
*Mobile: (860) 985-2719*

skype: wmohler
Office: (860) 679-1833, room R1159
Lab: (860) 679-1834, room R1265
Fax: (314) 689-1833

http://genetics.uchc.edu/Faculty/assoc_professors/mohler.html
PThink before you print