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;
}
case OperatingMode:
setLabellingMode(a.action.isChecked());
break;
+ case FormSegment:
+ formSegmetationObject();
+ break;
case ZoomIn:
zoomIn();
break;
import ie.dcu.matrix.ByteMatrix;
import java.io.*;
+import java.util.ArrayList;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
*
* @author Kevin McGuinness
*/
-public class SegmentationMask extends ByteMatrix {
+public class SegmentationMask extends ByteMatrix implements Cloneable{
/**
* Serialization UID
* 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}.
super(height, width);
this.width = width;
this.height = height;
+ objects = new ArrayList<ByteMatrix>();
clear();
}
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).
package ie.dcu.segment;
+import org.eclipse.swt.graphics.Rectangle;
+
/**
* Class that represents a independent segmentation mask.
* @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
}
+
+
}
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