Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Resolved list drop down problem in Windows machines. Done by Nikhil.
authorlingutln <lingutln@localhost>
Wed, 30 Jan 2013 00:00:33 +0000 (00:00 +0000)
committerlingutln <lingutln@localhost>
Wed, 30 Jan 2013 00:00:33 +0000 (00:00 +0000)
svn path=/; revision=425

Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java

index 877dac87f3b104844d4ced1e47b97eedfbf9d739..712aa19cd3c8f9d962480600a1902f434771b95a 100644 (file)
@@ -12,6 +12,7 @@ import ie.dcu.segment.options.SegmenterOptionDialog;
 import ie.dcu.segment.painters.SegmentationPainter;
 import ie.dcu.swt.*;
 import ie.dcu.swt.event.*;
+import ie.dcu.apps.ist.activelearning.*;
 
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
@@ -49,10 +50,10 @@ public class SegmentationView extends Composite {
        private final AnnotatedImageControl view;
        
        // tool bars
-       private final ToolBar mainToolbar, viewSelectionToolbar, termLookupBar;
+       private final ToolBar mainToolbar, viewSelectionToolbar;
        
        // Composite for Term details
-       private Composite termDetailComposite;
+       private Composite termLookupComposite, termDetailComposite;
        
        // term detail table
        private static Table termDetailTable;
@@ -106,6 +107,7 @@ public class SegmentationView extends Composite {
                Background,
                OperatingMode,
                FormSegment,
+               PredictSegments,
                ZoomIn,
                ZoomOut,
                ZoomOriginal,
@@ -149,7 +151,7 @@ public class SegmentationView extends Composite {
                painters = new PainterRegistry();
                mainToolbar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
                viewSelectionToolbar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
-               termLookupBar = new ToolBar(this, SWT.RIGHT | SWT.FLAT | SWT.BORDER);
+               termLookupComposite = new Composite(this, SWT.RIGHT | SWT.FLAT);
                view = new AnnotatedImageControl(this, SWT.BORDER);
                termDetailComposite = new Composite(this, SWT.RIGHT | SWT.FLAT);
                
@@ -170,7 +172,7 @@ public class SegmentationView extends Composite {
                //create all visual controls
                createToolMainToolbar();
                createToolViewSelectionToolbar();
-               createToolTermLookupBar();
+               createToolTermLookupComposite();
                createTermDetailTable();
                createTermSynonymTable();
                createTermDetailFields();
@@ -208,6 +210,7 @@ public class SegmentationView extends Composite {
                //m.add(getAction(Tool.Background));
                m.add(getAction(Tool.OperatingMode));
                m.add(getAction(Tool.FormSegment));
+               m.add(getAction(Tool.PredictSegments));
                m.add(new Separator());
                m.add(getAction(Tool.ZoomIn));
                m.add(getAction(Tool.ZoomOut));
@@ -280,9 +283,9 @@ public class SegmentationView extends Composite {
        /**
         * Third tool bar for holding the Annotate Combo box. 
         */
-       private void createToolTermLookupBar() {
-               SwtUtils.addLabel(termLookupBar, getAction(Tool.SetLabel).getText());
-               comboLabel = SwtUtils.addCombo(termLookupBar, 250, SWT.SIMPLE);
+       private void createToolTermLookupComposite() {
+               SwtUtils.addLabelToComposite(termLookupComposite, getAction(Tool.SetLabel).getText());
+               comboLabel = SwtUtils.addComboToComposite(termLookupComposite, 250, SWT.SIMPLE);
                comboLabel.setToolTipText( getAction(Tool.SetLabel).getToolTipText());
                comboLabel.addKeyListener(new KeyAdapter() {
                        public void keyReleased(KeyEvent e) {
@@ -294,7 +297,7 @@ public class SegmentationView extends Composite {
                                termDetailLookup(parseAccessionIdFromComboLabel(comboLabel));                                           
                        }
                });
-               assign = SwtUtils.addButton(termLookupBar, 55, "Assign");
+               assign = SwtUtils.addButtonToComposite(termLookupComposite, 55, "Assign");
                assign.addSelectionListener(new SelectionAdapter() {
         public void widgetSelected(SelectionEvent arg0) {
                if(view.getContext().isEnabled())
@@ -307,7 +310,6 @@ public class SegmentationView extends Composite {
                execute(Tool.AssignButton, null);
                }
                });
-               termLookupBar.pack();
        }
        
        /**
@@ -589,13 +591,13 @@ public class SegmentationView extends Composite {
                gd.verticalAlignment = SWT.FILL;
                gd.widthHint = 880;
                view.setLayoutData(gd);
-               
-               // Layout term lookup toolbar
+
+               GridLayout termLookupLayout = new GridLayout(3, false);
+               termLookupComposite.setLayout(termLookupLayout);
+
+               // Layout term lookup composite
                gd = new GridData();
-               gd.horizontalAlignment = SWT.FILL;
-               gd.grabExcessHorizontalSpace = true;
-               gd.heightHint = heightHint;
-               termLookupBar.setLayoutData(gd);
+               termLookupComposite.setLayoutData(gd);
 
                // Layout term detail Composite
                GridLayout termDetailLayout = new GridLayout(2, false);
@@ -833,6 +835,15 @@ public class SegmentationView extends Composite {
                updateToolStates();
        }
        
+       /**
+        * Predicts the segments in the image using active learning.
+       */
+       public void predictSegments() {
+       
+               SIFTDescriptor sift = new SIFTDescriptor();
+//             sift.calculateDescriptors(view.getContext().getImage());
+               updateToolStates();
+       }       
        
        public boolean isAutoApply() {
                return this.auto;
@@ -1127,6 +1138,9 @@ public class SegmentationView extends Composite {
                case FormSegment:
                        formSegmetationObject();
                        break;
+               case PredictSegments:
+                       predictSegments();
+                       break;
                case ZoomIn:
                        zoomIn();
                        break;
@@ -1203,6 +1217,7 @@ public class SegmentationView extends Composite {
                        Tool.Background.action.setEnabled(!getLabelMode() && canZoomIn());
                        Tool.OperatingMode.action.setEnabled(canZoomIn());
                        Tool.FormSegment.action.setEnabled(CanLabel());
+                       Tool.PredictSegments.action.setEnabled(canZoomIn());
                                                
                        // Always enabled if view enabled
                        Tool.SetBrushSize.action.setEnabled(true);