From: lingutln Date: Wed, 4 Jan 2012 20:50:36 +0000 (+0000) Subject: Layered Segmentation related. Done by Nikhil. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=725627ae09d9413673572b8a79c3e01ef48382de;p=old-jaiswallab-svn%2F.git Layered Segmentation related. Done by Nikhil. svn path=/; revision=250 --- diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 42d6593..d955db7 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -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; diff --git a/Annotation/src/ie/dcu/segment/SegmentationMask.java b/Annotation/src/ie/dcu/segment/SegmentationMask.java index c1d8cd9..c3e820a 100644 --- a/Annotation/src/ie/dcu/segment/SegmentationMask.java +++ b/Annotation/src/ie/dcu/segment/SegmentationMask.java @@ -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 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(); 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