Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Latest Commit, done by Nikhil.
authorlingutln <lingutln@localhost>
Fri, 16 Dec 2011 21:54:59 +0000 (21:54 +0000)
committerlingutln <lingutln@localhost>
Fri, 16 Dec 2011 21:54:59 +0000 (21:54 +0000)
svn path=/; revision=224

Annotation/src/ie/dcu/apps/ist/AppWindow.java
Annotation/src/ie/dcu/segment/painters/CombinedPainter.java
Annotation/src/ie/dcu/segment/painters/ForegroundOnlyPainter.java
Annotation/src/ie/dcu/segment/painters/LabelPainter.java
Annotation/src/ie/dcu/segment/painters/MarkupPainter.java
Annotation/src/ie/dcu/segment/painters/MaskPainter.java
Annotation/src/ie/dcu/segment/painters/OriginalPainter.java
Annotation/src/ie/dcu/segment/painters/OutlineOverlayPainter.java
Annotation/src/ie/dcu/segment/painters/SegmentationPainter.java

index 5f32b244efc06446c9662a62361ab630d1cc4a88..4a552db9f983b910b9b4b7b1f4bcfae3d7ff55fb 100644 (file)
@@ -6,6 +6,7 @@ import ie.dcu.apps.ist.exp.Experiment;
 import ie.dcu.apps.ist.views.*;
 import ie.dcu.segment.*;
 import ie.dcu.segment.annotate.*;
+import ie.dcu.segment.painters.SegmentationPainter;
 import ie.dcu.swt.*;
 import ie.dcu.swt.event.*;
 import ie.dcu.swt.layout.LayoutFactory;
@@ -32,7 +33,7 @@ import org.eclipse.swt.widgets.*;
  */
 public class AppWindow extends ApplicationWindow implements FileDropListener {
        private static final Logger log = Logger.getLogger("AppWindow");
-
+       
        private final Properties props;
 
        private AppPrefsManager prefsManager;
@@ -625,11 +626,14 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
 
                private final ImageControl ctrl;
                private ImageData image;
+               private ImageData maskedImageData;
                private boolean inside;
+               private boolean insideSegment;
                private boolean enabled;
-
-
+               SegmentationPainter painter;
+               
                public ImageObserver(SegmentationView view) {
+                       painter = view.getPainter();
                        view.addContextChangeListener(this);
                        view.getCanvas().addMouseMoveListener(this);
                        ctrl = view.getImageControl();
@@ -645,6 +649,7 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                                Font font = JFaceResources.getDefaultFont();
                                getStatusLineManager().getControl().setFont(font);
                                this.inside = false;
+                               this.insideSegment = false;
                                this.enabled = enabled;
                        }
                }
@@ -673,6 +678,8 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                                Font font = JFaceResources.getDefaultFont();
                                getStatusLineManager().getControl().setFont(font);
                                inside = false;
+                               insideSegment = false;
+                               shell.setToolTipText(null);
                        }
                }
 
@@ -684,10 +691,17 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                                        return ctrl.canvasToImage(pt);
                                }
                        }
+                       
+                       maskedImageData = painter.getMaskImage().getImageData();
+                       if (maskedImageData != null) {
+                               Point pt = new Point(e.x, e.y);
+                               if (ctrl.imageContains(pt)) {
+                                       return ctrl.canvasToImage(pt);
+                               }
+                       }
                        return null;
                }
-
-
+               
                private final RGB getColor(Point pt) {
                                
                        int pixel = image.getPixel(pt.x, pt.y);
@@ -700,12 +714,37 @@ public class AppWindow extends ApplicationWindow implements FileDropListener {
                                Font font = JFaceResources.getFont(MONOSPACE_FONT);
                                getStatusLineManager().getControl().setFont(font);
                        }
-
-                       status(AppStatus.Information, 
-                                       "Location [%4d,%4d] Color [%3d,%3d,%3d]",
-                                       pt.x, pt.y, c.red, c.green, c.blue);
-                       
+                       Listener mouseListener = new Listener() {
+                             public void handleEvent(Event event) {
+                               switch (event.type) {
+                               case SWT.MouseEnter:
+                               case SWT.MouseMove:
+                                     if (insideSegment) {
+                                        // System.out.println("Which painter ? -->  "+painter.getMaskImage().getImageData().y);
+                                         view.getCanvas().setToolTipText(SegmentationView.comboLabel.getText());
+                                         return;
+                                     }
+                                     view.getCanvas().setToolTipText(null);
+                                 break;
+                               }
+                             }
+                           };
+                           view.getCanvas().addListener(SWT.MouseMove, mouseListener);
+                           view.getCanvas().addListener(SWT.MouseExit, mouseListener);
+                           if((SegmentationView.comboLabel.getText()).trim().equals(""))
+                           {
+                               status(AppStatus.Information, 
+                                                       "Location [%4d,%4d] Color [%3d,%3d,%3d]",
+                                                       pt.x, pt.y, c.red, c.green, c.blue);
+                           }
+                           else
+                           {
+                               status(AppStatus.Information, 
+                                                       "Location [%4d,%4d] Color [%3d,%3d,%3d] Label [%s]",
+                                                       pt.x, pt.y, c.red, c.green, c.blue, SegmentationView.comboLabel.getText());
+                           }
                        inside = true;
+                       insideSegment = true;
                }
 
 
index 268a1ddfb42cfc5231cb3956ed9196c3525e411e..36bcd67a09a36874864ab972b00ac2b24fa7a604 100644 (file)
@@ -27,7 +27,10 @@ public class CombinedPainter implements SegmentationPainter {
                return "An overlaid view of the image, segmentation mask, and markup";
        }
 
-
+       public Image getMaskImage() {
+               return maskImage;
+       }
+       
        public void paint(SegmentationContext ctx, ObservableImage im) {
 
                GC gc = im.beginPaint();
index ed8bc4e09a85e2709b8d74bb9d682d6e1aa98e09..adc7b9b19e0e97056200af1dbe7c4a52b4d25bdd 100644 (file)
@@ -26,7 +26,10 @@ public class ForegroundOnlyPainter implements SegmentationPainter {
        public String getDescription() {
                return "Shows the foreground region of the image.";
        }
-
+       
+       public Image getMaskImage() {
+               return maskImage;
+       }
 
        public void paint(SegmentationContext ctx, ObservableImage im) {
                GC gc = im.beginPaint();
index 136293152d06f14f998731d83840a4814dc3c893..dc48ea0222f895536961bef939ed33d4e625507f 100644 (file)
@@ -10,7 +10,7 @@ import org.eclipse.swt.widgets.*;
 /**
  * Shows the foreground region of the image. The background is greyed out.
  * 
- * @author Kevin and Nikhil
+ * @author Kevin McGuinness
  */
 public class LabelPainter implements SegmentationPainter {
        
@@ -22,11 +22,13 @@ public class LabelPainter implements SegmentationPainter {
                return "Display Label";
        }
 
-
        public String getDescription() {
-               return "Shows the segmented piece with label attached.";
+               return "Shows the segmented piece with label attached on hovering the mouse.";
+       }
+       
+       public Image getMaskImage() {
+               return maskImage;
        }
-
 
        public void paint(SegmentationContext ctx, ObservableImage im) {
                GC gc = im.beginPaint();
@@ -111,4 +113,4 @@ public class LabelPainter implements SegmentationPainter {
                        maskImage = null;
                }
        }
-}
+}
\ No newline at end of file
index 24b5fbfc6b1ca7879bcaf86f09a459668ab69ab1..802000d459dcded3dd855470bfd7efe1dbb5543e 100644 (file)
@@ -6,6 +6,7 @@ import ie.dcu.swt.*;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
 
 /**
  * Shows the current markup (annotations) only
@@ -24,7 +25,10 @@ public class MarkupPainter implements SegmentationPainter {
        public String getName() {
                return NAME;
        }
-
+       
+       public Image getMaskImage() {
+               return null;
+       }
 
        public void paint(SegmentationContext ctx, ObservableImage im) {
 
index 192f368816b2e4006e6dbf9baad54065dc2fd4c9..f7a1d40d2e786c0b465b09379298bf5ec1fdd268 100644 (file)
@@ -25,7 +25,10 @@ public class MaskPainter implements SegmentationPainter {
        public String getName() {
                return NAME;
        }
-
+       
+       public Image getMaskImage() {
+               return maskImage;
+       }
 
        public void paint(SegmentationContext ctx, ObservableImage im) {
 
index 97bdfca62dd29115907180214ab71872b9e351ce..3807c7daa99bbc6a31d3889cd3c81ae24219c636 100644 (file)
@@ -22,7 +22,10 @@ public class OriginalPainter implements SegmentationPainter {
        public String getName() {
                return NAME;
        }
-
+       
+       public Image getMaskImage() {
+               return null;
+       }
 
        public void paint(SegmentationContext ctx, ObservableImage im) {
                GC gc = im.beginPaint();
index 41cc8d6db8492f4837c277e1bd5c9a250c67ec47..67b56c48ca09346e4309dc7bb22ae36d23911c5f 100644 (file)
@@ -25,7 +25,10 @@ public class OutlineOverlayPainter implements SegmentationPainter {
                return "Shows an an overlay of foreground border on the image";
        }
 
-
+       public Image getMaskImage() {
+               return maskImage;
+       }
+       
        public void paint(SegmentationContext ctx, ObservableImage im) {
                GC gc = im.beginPaint();
 
index 4989f60059592215d3dea20b6ee153f4858553f9..a15c392d36b90c864cd97cae0fb4c565196ebec9 100644 (file)
@@ -2,6 +2,7 @@ package ie.dcu.segment.painters;
 
 import ie.dcu.segment.SegmentationContext;
 import ie.dcu.swt.ObservableImage;
+import org.eclipse.swt.graphics.*;
 
 /**
  * Interface for classes that can be used to visualize an image and it's
@@ -20,6 +21,11 @@ public interface SegmentationPainter {
        /**
         * Returns a description of the painter.
         */
+       public Image getMaskImage();
+
+       /**
+        * Returns a masked image.
+        */
        public String getDescription();
 
        /**