Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Data storage functionality completed. Done by Nikhil.
authorlingutln <lingutln@localhost>
Thu, 31 May 2012 19:34:56 +0000 (19:34 +0000)
committerlingutln <lingutln@localhost>
Thu, 31 May 2012 19:34:56 +0000 (19:34 +0000)
svn path=/; revision=340

Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java
Annotation/src/ie/dcu/apps/ist/actions/SaveAction.java
Annotation/src/ie/dcu/apps/ist/dialogs/ExportDialog.java
Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java
Annotation/src/ie/dcu/apps/ist/export/imagemap/ImageMap.java
Annotation/src/ie/dcu/segment/SegmentationContext.java

index 3a62a7f56e862c4bbe379f5e66c2811602642a64..f72882f75de3eaa9c7d923d69b73fafbfb469bc1 100644 (file)
@@ -51,8 +51,8 @@ public class ExportImageMapAction extends AppAction{
                                        exporter.setHtmlFile(result.html);
                                        
                                        // Taking html file name and making the same as filename of imagemap
-                                       int dotIndex = result.html.indexOf('.');
-                                       String zipFile = result.html.substring(0, dotIndex); 
+                                       int dotIndex = result.image.indexOf('.');
+                                       String zipFile = result.image.substring(0, dotIndex); 
                                        exporter.setZipFile(zipFile+IMGMAP_EXTENSION);
                                        
                                        exporter.setImageFile(result.image);
index 2821edb861c5048960d4dc98d191c4b446d76a0f..e1fe18a509ff206f5764239846ebdcfdac5dbc4d 100644 (file)
@@ -52,7 +52,7 @@ public class SaveAction extends AppAction {
                                        // Setup exporter
                                        Exporter exporter = new Exporter(image);
                                        exporter.setEffect(result.effect);
-                                       exporter.setHtmlFile(result.html);
+                                       exporter.setHtmlFile("imagemap.html");
                                        
                                        // Taking html file name and making the same as filename of imagemap
                                        int dotIndex = result.html.indexOf('.');
index 680763771832f940b52fd4aad1f065b2461bf5a8..8feeb306b40e31256b8ca9a39fd43544634d9571 100644 (file)
@@ -37,7 +37,8 @@ public class ExportDialog extends Dialog {
                
                Result() {
                        folder = new File(folderText.getText().trim());
-                       html = htmlText.getText().trim();
+                       //html = htmlText.getText().trim();
+                       html = "imagemap.html";
                        image = imageText.getText().trim();
                        link = linkText.getText().trim();
                        description = descriptionText.getText();
@@ -133,11 +134,11 @@ public class ExportDialog extends Dialog {
                label(widgets, "Export folder:");
                folderText = text(widgets, "");
                browseButton = button(widgets, "Browse...");
-               label(widgets, "HTML file name:");
-               htmlText = text(widgets, "imagemap.html");
-               spacer(widgets);
-               label(widgets, "Image file name:");
-               imageText = text(widgets, "image.png");
+               //label(widgets, "HTML file name:");
+               //htmlText = text(widgets, "imagemap.html");
+               //spacer(widgets);
+               label(widgets, "File name:");
+               imageText = text(widgets, "image");
                spacer(widgets);
                hline(widgets);
                label(widgets, "Export shape:");
@@ -217,12 +218,12 @@ public class ExportDialog extends Dialog {
                        return false;
                }
                
-               String htmlFile = htmlText.getText().trim();
+               /*String htmlFile = htmlText.getText().trim();
                if (htmlFile.equals("")) {
                        validationError("The HTML file name cannot be empty");
                        htmlText.setFocus();
                        return false;
-               }
+               }*/
                
                String imageFile = imageText.getText().trim();
                if (imageFile.equals("")) {
index 037b02c5bbca83a61bf4cc993b20361d08e0e050..557a0a9e792f79827c42c009044660e4685deaa4 100644 (file)
@@ -119,10 +119,7 @@ public class Exporter {
                map.setImageName(imageName);
                map.setCuratorName(SegmentationView.curatorCombo.getText());
                map.setSpeciesName(SegmentationView.speciesCombo.getText());
-               if(!(SegmentationView.collectionId.getText().equals("")))
-               {
-                       map.setCollectionId(Integer.parseInt(SegmentationView.collectionId.getText()));
-               }
+               map.setCollectionId(SegmentationView.collectionId.getText());
                map.setComments(SegmentationView.comment.getText());
                
                List<String> preloads = new ArrayList<String>();
@@ -228,6 +225,10 @@ public class Exporter {
                                        
                                        map.addArea(area);
                                }
+                               
+                               // Generating coordinates files
+                               
+                               
                        }
                        
                        // Create an entry for the imageMap (code for saving image map file into the zip file)
@@ -321,7 +322,26 @@ public class Exporter {
                          String annotationId = mask.ontologyTerm.getAccessionId();
                          Element annotationIdElem = document.createElement("annotation_id");
                          annotationIdElem.appendChild(document.createTextNode(annotationId));
-                         segmentElement.appendChild(annotationIdElem);                   
+                         segmentElement.appendChild(annotationIdElem);
+                         
+                         // Functionality for saving polygon coordinates
+                         
+                         ContourTracer tracer = new ContourTracer(mask, SegmentationMask.FOREGROUND);
+                         List<Polygon> trace = tracer.trace();
+                         
+                         String polygonCoords = ""; 
+                         for (Polygon polygon : trace) 
+                         {
+                                 for (int i = 0; i < polygon.npoints; i++) 
+                                 {
+                                         polygonCoords = polygonCoords+polygon.xpoints[i]+","+polygon.ypoints[i]+",";
+                                 }
+                         }
+                         
+                         Element polygonCoordsElem = document.createElement("polygon_coords");
+                         polygonCoordsElem.appendChild(document.createTextNode(polygonCoords));
+                         segmentElement.appendChild(polygonCoordsElem);
+                         
                  }
                  
                  TransformerFactory transformerFactory = TransformerFactory.newInstance();
@@ -329,6 +349,7 @@ public class Exporter {
                  
                  DOMSource source = new DOMSource(document);
                  StreamResult result =  new StreamResult(out);
+                 
                  transformer.transform(source, result);
                  
                }catch (ParserConfigurationException pce) {
index f09ba48072aff8f864c890558cc835bb9aa78dd4..670c1bf34efb7435041fb5102e24d861381ed951 100644 (file)
@@ -31,7 +31,7 @@ public class ImageMap {
        private String mapName;
        private String curatorName;
        private String speciesName;
-       private int collectionId;
+       private String collectionId;
        private String comments;
        private final List<MapArea> areas;
        private final List<String> preloads;
@@ -111,11 +111,11 @@ public class ImageMap {
                this.speciesName = speciesName;
        }
        
-       public int getCollectionId() {
+       public String getCollectionId() {
                return collectionId;
        }
 
-       public void setCollectionId(int collectionId) {
+       public void setCollectionId(String collectionId) {
                this.collectionId = collectionId;
        }
        
index 4831a5b719b52fbf92b05174d0e918013262f208..4d4e21e425a88eefbc75721cc84f9f1db35c4af6 100644 (file)
@@ -541,6 +541,7 @@ public class SegmentationContext {
                                                        }
                                                }
                                        SegmentationView.speciesCombo.setText(speciesTermName);
+                                       SegmentationView.speciesCombo.setData(speciesTermName,speciesTermId);
                                        SegmentationView.curatorCombo.setText(curatorName);
                                                SegmentationView.collectionId.setText(collectionId);
                                                SegmentationView.comment.setText(comment);
@@ -632,8 +633,7 @@ public class SegmentationContext {
                
        }
        
-       
-    public static Document loadXMLFromZip(InputStream in) throws Exception
+       public static Document loadXMLFromZip(InputStream in) throws Exception
     {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();