Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Coordinates saving functionality and some UI alignments. Done by Nikhil.
authorlingutln <lingutln@localhost>
Tue, 5 Jun 2012 20:53:56 +0000 (20:53 +0000)
committerlingutln <lingutln@localhost>
Tue, 5 Jun 2012 20:53:56 +0000 (20:53 +0000)
svn path=/; revision=342

Annotation/src/ie/dcu/apps/ist/PainterRegistry.java
Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/segment/SegmentationContext.java
Annotation/src/ie/dcu/segment/SegmentationMask.java
Annotation/src/ie/dcu/segment/painters/CombinedPainter.java

index 7b437b019b7cb50c03df6829882234733e74aecb..ed5d6fca2959ea558a4e03491f7f551af3c2cde2 100644 (file)
@@ -16,10 +16,13 @@ public class PainterRegistry {
        private void init() {
                add(new CombinedPainter());
                add(new OriginalPainter());
-               add(new MarkupPainter());
-               add(new MaskPainter());
-               add(new ForegroundOnlyPainter());
-               add(new OutlineOverlayPainter());
+               /*
+                * Commented different views of segmentation. Currently original and combined painter are enabled
+                */
+               //add(new MarkupPainter());
+               //add(new MaskPainter());
+               //add(new ForegroundOnlyPainter());
+               //add(new OutlineOverlayPainter());
        }
        
        
index 9e0d223ec4d9399ba284cfb5515a7b1700fbd932..7bd57665c9279276db5e15e26f20e82505ceba7c 100644 (file)
@@ -210,7 +210,7 @@ public class SegmentationView extends Composite {
        private void createToolMainToolbar() {
                ToolBarManager m = new ToolBarManager(mainToolbar);
                m.add(getAction(Tool.Foreground));
-               m.add(getAction(Tool.Background));
+               //m.add(getAction(Tool.Background));
                m.add(getAction(Tool.OperatingMode));
                m.add(getAction(Tool.FormSegment));
                m.add(new Separator());
index 4d4e21e425a88eefbc75721cc84f9f1db35c4af6..89ea60002191437109a7fbcf2a0d4290571b6a29 100644 (file)
@@ -215,10 +215,13 @@ public class SegmentationContext {
                
        public static void disableAllSegments()
        {
-               for(SegmentationMask currentSegmentMask : segmentationMaskObjects)
+               if (!(segmentationMaskObjects.isEmpty()))
                {
-                       currentSegmentMask.enabled = false;
-               }       
+                       for(SegmentationMask currentSegmentMask : segmentationMaskObjects)
+                       {
+                               currentSegmentMask.enabled = false;
+                       }
+               }
        }
        
        /**
@@ -464,6 +467,7 @@ public class SegmentationContext {
                String speciesTermName = "", collectionId = "", comment = "", curatorName = "",speciesTermId = "";
                int width = 0,height = 0;
                int noOfSegments = 0;
+               int noOfChildern = 0;
                String [][] tempStorage = null;
                SegmentationContext ctx = null;
                
@@ -472,7 +476,7 @@ public class SegmentationContext {
                        while ((entry = in.getNextEntry()) != null) {
                                String name = entry.getName();
                                
-                               if (name.equals("image.png")) {
+                               if (name.equals("image")) {
                                        imageData = SwtUtils.loadImageData(in);
                                        ctx = new SegmentationContext(imageData, file);
                                        width = imageData.width;
@@ -480,13 +484,7 @@ public class SegmentationContext {
                                }
                                
                                else if (name.startsWith("markup")) {
-                                       String[] temp;
-                                       temp = name.split("-");
-                                       int layerNumber = Integer.parseInt(temp[1].substring(0, temp[1].indexOf(".")));
                                        SegmentationMask mask = new SegmentationMask(width,height);
-                                       mask.layerNumber = layerNumber;
-                                       
-                                       
                                        InputStream input = zip.getInputStream(entry);
                                        segmentationMaskObjects.add(setMaskPixelValues(input,mask,width,height));
                                }
@@ -522,7 +520,8 @@ public class SegmentationContext {
                                        // getting collection ids
                                        NodeList nlist = docEle.getElementsByTagName("segment");
                                        noOfSegments = nlist.getLength();
-                                       tempStorage = new String[nlist.getLength()][4];
+                                       noOfChildern = nlist.item(0).getChildNodes().getLength();
+                                       tempStorage = new String[noOfSegments][noOfChildern];
                                                if(nlist != null && nlist.getLength() > 0)
                                                {
                                                        for(int i = 0 ; i < nlist.getLength();i++) 
@@ -540,7 +539,7 @@ public class SegmentationContext {
                                                                
                                                        }
                                                }
-                                       SegmentationView.speciesCombo.setText(speciesTermName);
+                                               SegmentationView.speciesCombo.setText(speciesTermName);
                                        SegmentationView.speciesCombo.setData(speciesTermName,speciesTermId);
                                        SegmentationView.curatorCombo.setText(curatorName);
                                                SegmentationView.collectionId.setText(collectionId);
@@ -551,17 +550,17 @@ public class SegmentationContext {
                                                System.out.println("XML exception"+e.toString());
                                        }
                                }
-                               
                        }
                } 
-           catch(Exception ex)
+           catch(Exception e)
            {
+               System.out.println("Exception is "+e.toString());
            }
                finally
                {
                        for(int i = 0 ; i < noOfSegments;i++) 
                        {
-                               for(int x = 0 ; x < 4;x++) 
+                               for(int x = 0 ; x < noOfChildern;x++) 
                                {
                                        if (x == 1)
                                        {
index c9a0783eff81aa95a56c9772a2d1ee37b92a4fe0..56cb6f39be287ab01c9746d90473c86179dac685 100644 (file)
@@ -67,6 +67,9 @@ public class SegmentationMask extends ByteMatrix{
        
        //The layering number of the segmentation mask.
        public int layerNumber;
+
+       //The color of the mask
+       public String maskColor;
        
        @Deprecated
        //The name(label) associated with each segment. - replaced with Term object
index b9e2842ce89217a79bc2051d0d9953602124df71..9e2064a76d855a13e573afb2ae6fd83fbdadab32 100644 (file)
@@ -106,6 +106,7 @@ public class CombinedPainter implements SegmentationPainter {
                if (isNewMaskDataRequired(mask)) {
                        mask.maskImageData = createMaskData(mask.getBounds());
                } 
+               byte main_index = 9;
                // Blit in pixels
                for (int y = 0, i = 0; y < mask.height; y++) {
                        int rowOffset = y * mask.maskImageData.bytesPerLine;
@@ -131,12 +132,13 @@ public class CombinedPainter implements SegmentationPainter {
                                // the buffer), so we can't directly copy in at the same index as the
                                // mask.
                                mask.maskImageData.data[x + rowOffset] = index;
-                               //System.out.println(mask.maskImageData.data[x + rowOffset]);
+                               
                                // However, the alpha data is always aligned correctly
                                mask.maskImageData.alphaData[i] = alpha;
                                
                                // Next location in the mask
                                i++;
+                               main_index = index;
                        }
                }
        // Create new mask
@@ -262,7 +264,7 @@ public class CombinedPainter implements SegmentationPainter {
        }
        
        public void dispose() {
-               /*// Dispose mask
+/*             // Dispose mask
                if (maskImage != null) {
                        if (!maskImage.isDisposed()) {
                                maskImage.dispose();