Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Layered Segmentation related. Done by Nikhil.
authorlingutln <lingutln@localhost>
Wed, 4 Jan 2012 20:50:36 +0000 (20:50 +0000)
committerlingutln <lingutln@localhost>
Wed, 4 Jan 2012 20:50:36 +0000 (20:50 +0000)
svn path=/; revision=250

Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/segment/SegmentationMask.java
Annotation/src/ie/dcu/segment/SegmentationObject.java
Annotation/src/ie/dcu/segment/painters/ForegroundOnlyPainter.java

index 42d6593a540ddf8578c3ad916bf9fb78ee70fd82..d955db7b424f47c167d688595463041cf1e2a830 100644 (file)
@@ -472,6 +472,16 @@ public class SegmentationView extends Composite {
                updateToolStates();
        }
        
+       /**
+        * Forms a segmentation object based on the current view skipping previous segmentation objects.
+       */
+       
+       public void formSegmetationObject() {
+       
+               view.getContext().getMask().formSegmentationObject();
+       }
+       
+       
        public boolean isAutoApply() {
                return this.auto;
        }
@@ -762,6 +772,9 @@ public class SegmentationView extends Composite {
                case OperatingMode:
                        setLabellingMode(a.action.isChecked());
                        break;
+               case FormSegment:
+                       formSegmetationObject();
+                       break;
                case ZoomIn:
                        zoomIn();
                        break;
index c1d8cd90a5adf3c71dc0c3ec901f7db4a58eceff..c3e820af333aab8511c288a32e38698b2e0fdcc9 100644 (file)
@@ -3,6 +3,7 @@ package ie.dcu.segment;
 import ie.dcu.matrix.ByteMatrix;
 
 import java.io.*;
+import java.util.ArrayList;
 
 import org.eclipse.swt.*;
 import org.eclipse.swt.graphics.*;
@@ -17,7 +18,7 @@ import org.eclipse.swt.graphics.*;
  * 
  * @author Kevin McGuinness
  */
-public class SegmentationMask extends ByteMatrix {
+public class SegmentationMask extends ByteMatrix implements Cloneable{
        
        /**
         * Serialization UID
@@ -53,8 +54,12 @@ public class SegmentationMask extends ByteMatrix {
         * The height of the segmentation mask.
         */
        public final int height;
-
-
+       
+       /**
+        * For storing independent Segmentation objects
+        */
+       private ArrayList<ByteMatrix> objects;
+       
        /**
         * Create a segmentation mask using the specified dimensions. All pixels in
         * the mask are initially set to {@link SegmentationMask#UNKNOWN}.
@@ -68,6 +73,7 @@ public class SegmentationMask extends ByteMatrix {
                super(height, width);
                this.width = width;
                this.height = height;
+               objects = new ArrayList<ByteMatrix>();
                clear();
        }
        
@@ -90,7 +96,20 @@ public class SegmentationMask extends ByteMatrix {
        public final void clear() {
                fill(UNKNOWN);
        }
-
+       
+       /**
+        * forms a segmentation object and stores it in an arrayList
+        */
+       public final void formSegmentationObject() {
+               ByteMatrix object = new SegmentationObject(getBounds());
+               object = new SegmentationMask(height, height).clone();
+               objects.add(object);
+               System.out.println("Object size : "+objects.size());
+               for(int i = 0; i<objects.size();i++)
+               {
+                       System.out.println("Layer number is "+(SegmentationObject)objects.get(i));
+               }
+       }
 
        /**
         * Get the offset of pixel (x, y).
index e18ba3f874d10e5c66fea09f3f1d05c666b8e14f..5242291cb2ec196672b09ce1479ee80627120872 100644 (file)
@@ -1,5 +1,7 @@
 package ie.dcu.segment;
 
+import org.eclipse.swt.graphics.Rectangle;
+
 
 /**
  * Class that represents a independent segmentation mask.
@@ -11,16 +13,23 @@ package ie.dcu.segment;
  * @author Nikhil
  */
 
-public final class SegmentationObject extends SegmentationMask{
+public final class SegmentationObject extends SegmentationMask implements Cloneable{
 
-       /**
-        * 
-        */
        private static final long serialVersionUID = 8321845179859248904L;
-
+       private final SegmentationMask mask = new SegmentationMask(getBounds());
+       private int layerNumber;
+       
        public SegmentationObject(int width, int height) {
                super(width, height);
                // TODO Auto-generated constructor stub
+               layerNumber += 1;
+       }
+       
+       public SegmentationObject(Rectangle bounds) {
+               this(bounds.width, bounds.height);
+               // TODO Auto-generated constructor stub
        }
        
+       
+       
 }
index bc2bcb0c09572243276e22ea8cf9046d165e14a1..ccd7702a2a405752093624e4d94c2284d9bc2d26 100644 (file)
@@ -56,6 +56,7 @@ public class ForegroundOnlyPainter implements SegmentationPainter {
                byte[] buff = new byte[maskData.width];
                for (int y = 0, i = 0; y < mask.height; y++) {
                        for (int x = 0; x < mask.width; x++) {
+                               System.out.println("Mask values coming as "+mask.values[i]);
                                switch (mask.values[i++]) {
                                case SegmentationMask.BACKGROUND:
                                        // black