Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Modifications, done by Nikhil.
authorlingutln <lingutln@localhost>
Mon, 19 Dec 2011 19:00:19 +0000 (19:00 +0000)
committerlingutln <lingutln@localhost>
Mon, 19 Dec 2011 19:00:19 +0000 (19:00 +0000)
svn path=/; revision=228

Annotation/src/ie/dcu/apps/ist/PainterRegistry.java
Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/segment/painters/LabelPainter.java [deleted file]
Annotation/src/ie/dcu/segment/painters/SegmentationPainter.java

index b115e2ff6c61ad3cf1b576081b73b35edbb0e0c5..7b437b019b7cb50c03df6829882234733e74aecb 100644 (file)
@@ -20,7 +20,6 @@ public class PainterRegistry {
                add(new MaskPainter());
                add(new ForegroundOnlyPainter());
                add(new OutlineOverlayPainter());
-               add(new LabelPainter());
        }
        
        
index 5633d7d567296877a3a29d79a5fa0a405e185733..80268f9c9406294ff9cc66d75ccef25ed8976d04 100644 (file)
@@ -793,7 +793,7 @@ public class SegmentationView extends Composite {
         Assign the label to the segment on clicking assign button and update the image segment. 
         */
        private void assignLabel() {
-               SegmentationPainter painter = painters.get("Display Label");
+               SegmentationPainter painter = painters.get("Foreground Only");
                setPainter(painter);
        }
        
diff --git a/Annotation/src/ie/dcu/segment/painters/LabelPainter.java b/Annotation/src/ie/dcu/segment/painters/LabelPainter.java
deleted file mode 100644 (file)
index 131d2f5..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-package ie.dcu.segment.painters;
-
-
-import ie.dcu.segment.*;
-import ie.dcu.swt.ObservableImage;
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Shows the foreground region of the image. The background is greyed out.
- * 
- * @author Kevin McGuinness
- */
-public class LabelPainter implements SegmentationPainter {
-       
-       private ImageData maskData;
-       private Image maskImage;
-
-
-       public String getName() {
-               return "Display Label";
-       }
-
-       public String getDescription() {
-               return "Shows the segmented piece with label attached on hovering the mouse.";
-       }
-       
-       public ImageData getMaskData() {
-               return maskData;
-       }
-
-       public void paint(SegmentationContext ctx, ObservableImage im) {
-               GC gc = im.beginPaint();
-
-               // Paint image
-               gc.drawImage(ctx.getImage(), 0, 0);
-
-               // Paint mask
-               createVisibleMask(ctx.getMask());
-               gc.drawImage(maskImage, 0, 0);
-               
-               // Commit changes
-               im.endPaint();
-       }
-
-       
-       private void createVisibleMask(SegmentationMask mask) {
-               dispose();
-               
-               if (isNewMaskDataRequired(mask.getBounds())) {
-                       maskData = createMaskData(mask.getBounds());
-               } 
-               // Blit in pixels
-               byte[] buff = new byte[maskData.width];
-               for (int y = 0, i = 0; y < mask.height; y++) {
-                       for (int x = 0; x < mask.width; x++) {
-                               switch (mask.values[i++]) {
-                               case SegmentationMask.BACKGROUND:
-                                       // black
-                                       buff[x] = 1; 
-                                       break;
-                               default:
-                                       // transparent
-                                       buff[x] = 0; 
-                               }
-                       }
-                       maskData.setPixels(0, y, buff.length, buff, 0);
-               }
-               
-               // Create new mask
-               maskImage = new Image(Display.getCurrent(), maskData);
-       }
-       
-       
-       private boolean isNewMaskDataRequired(Rectangle bounds) {
-               if (maskData == null) {
-                       return true;
-               } else {
-                       return maskData.width != bounds.width || maskData.height != bounds.height;
-               }
-       }
-
-
-       private static ImageData createMaskData(Rectangle bounds) {
-               RGB[] colors = new RGB[] {
-                       new RGB(255,255,255),
-                       new RGB(128,128,128)
-               };
-               
-               // Create binary indexed palette
-               PaletteData palette = new PaletteData(colors);
-               
-               // Create 1 bit indexed image 
-               ImageData data = new ImageData(
-                               bounds.width, bounds.height, 1, palette);
-               
-               // Set transparent pixel
-               data.transparentPixel = 0;
-               // Create and return the image
-               return data;
-       }
-       
-
-       public void dispose() {
-               // Dispose mask
-               if (maskImage != null) {
-                       if (!maskImage.isDisposed()) {
-                               maskImage.dispose();
-                       }
-                       maskImage = null;
-               }
-       }
-}
\ No newline at end of file
index 3bfc477ac34030c0ea4a7e4212a20d21cadbd99c..f69d6e9b74cad531005878f72042df461a563ab4 100644 (file)
@@ -24,7 +24,7 @@ public interface SegmentationPainter {
        public ImageData getMaskData();
 
        /**
-        * Returns a masked image.
+        * Returns a masked imageData.
         */
        public String getDescription();