Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Latest commits.Done by Nikhil.
authorlingutln <lingutln@localhost>
Fri, 20 Jan 2012 19:10:50 +0000 (19:10 +0000)
committerlingutln <lingutln@localhost>
Fri, 20 Jan 2012 19:10:50 +0000 (19:10 +0000)
svn path=/; revision=266

Annotation/src/ie/dcu/segment/painters/CombinedPainter.java

index ece842cc487429afdc99261b0ef882ecb7116496..9281baae44156d281cd2b9831b9da52f773bb529 100644 (file)
@@ -40,7 +40,7 @@ public class CombinedPainter implements SegmentationPainter {
                // Paint image
                gc.drawImage(ctx.getImage(), 0, 0);
                int numberOfMaskObjects = ctx.getSegmentationMasks().size();
-               // Paint all masks skipping the enabled mask.
+               // Paint all masks and its borders skipping the enabled mask.
                if(numberOfMaskObjects > 0)
                {
                        // For drawing all the disabled masks.
@@ -58,11 +58,8 @@ public class CombinedPainter implements SegmentationPainter {
                                        gc.drawImage(maskBorderImage, 0, 0);
                                }
                        }
-               }
-               // Painting the enabled mask.
-               if(numberOfMaskObjects > 0)
-               {
-                       // For drawing all the previous masks.
+                       
+                       // For drawing the enabled mask and its border..
                        for(SegmentationMask segmentMask : ctx.getSegmentationMasks())
                        {
                                // Blending of background pixel values while pasting the last mask only
@@ -79,6 +76,7 @@ public class CombinedPainter implements SegmentationPainter {
                        gc.drawImage(maskImage, 0, 0);
                        createVisibleMaskBorder(ctx.getMask());
                        gc.drawImage(maskBorderImage, 0, 0);
+                       
                }
                // Very initial mask, which has not yet been turned into an object.
                else
@@ -119,11 +117,11 @@ public class CombinedPainter implements SegmentationPainter {
                                switch (mask.values[i]) {
                                case SegmentationMask.BACKGROUND:
                                        alpha = enabled ? (byte) 128 : (byte) 0;
-                                       index = 2;
+                                       index = 0;
                                        break;
                                case SegmentationMask.FOREGROUND:
                                        alpha = (byte) 128;
-                                       index = 1;
+                                       index = (byte) ((i%3)+1);
                                        break;
                                default:
                                        alpha = 0;
@@ -205,7 +203,7 @@ public class CombinedPainter implements SegmentationPainter {
                        maskBorderData.setPixels(0, mask.height-1, buff.length, buff, 0);
                }
                
-               // Create new mask
+               // Create new maskBorder
                maskBorderImage = new Image(Display.getCurrent(), maskBorderData);
        }
        
@@ -227,10 +225,10 @@ public class CombinedPainter implements SegmentationPainter {
 
        private static ImageData createMaskData(Rectangle bounds) {
                RGB[] colors = new RGB[] {
-                       new RGB(128,128,128),
-                       //new RGB(255,255,255),
-                       new RGB(255,180,180),
-                       new RGB(0, 0, 0)
+                               new RGB(0, 0, 0),
+                               new RGB(255,180,180),
+                               new RGB(180,255,180),
+                               new RGB(180,180,255)
                };
                
                // Create 3 color indexed palette