Login  Register

Re: Using API to create mask with multiple rectangles

Posted by Leonard Sitongia on Nov 19, 2007; 9:37pm
URL: http://imagej.273.s1.nabble.com/Using-API-to-create-mask-with-multiple-rectangles-tp3697968p3697970.html

I don't get masks in ImageJ.  If I

                imageJ = new ImagePlus("Original", imageIVOA);
                ip = imageJ.getProcessor();
                ip.setColor(Color.WHITE);
               
                ip.setRoi(100, 100, 100, 100);
                ip.setRoi(500, 100, 100, 100);

                ip.fill(); // Make it visible
             
Then I get an image with only the second rectangle filled with white.

If I try to get the combination of both rectangles as a mask by doing

                ImageProcessor mask = ip.getMask();
                ip.fill(mask); // Make it visible

I still get only the second rectangle.  As the API says, the fill
applies to what is in the mask and the ROI.  If the mask contains both
rectangles, then the ROI must be the last one set, and the intersection
is the last one.

==Leonard