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);
// 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('.');
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();
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:");
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("")) {
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>();
map.addArea(area);
}
+
+ // Generating coordinates files
+
+
}
// Create an entry for the imageMap (code for saving image map file into the zip file)
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();
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(out);
+
transformer.transform(source, result);
}catch (ParserConfigurationException pce) {
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;
this.speciesName = speciesName;
}
- public int getCollectionId() {
+ public String getCollectionId() {
return collectionId;
}
- public void setCollectionId(int collectionId) {
+ public void setCollectionId(String collectionId) {
this.collectionId = collectionId;
}
}
}
SegmentationView.speciesCombo.setText(speciesTermName);
+ SegmentationView.speciesCombo.setData(speciesTermName,speciesTermId);
SegmentationView.curatorCombo.setText(curatorName);
SegmentationView.collectionId.setText(collectionId);
SegmentationView.comment.setText(comment);
}
-
- public static Document loadXMLFromZip(InputStream in) throws Exception
+ public static Document loadXMLFromZip(InputStream in) throws Exception
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();