From f218cbbc6c50571e006792cd72d5a069c0e20eb0 Mon Sep 17 00:00:00 2001 From: lingutln Date: Mon, 21 May 2012 22:32:44 +0000 Subject: [PATCH] Data retrieval(Fully done). Data storage(except saving boundary coordinates). Done by Nikhil. svn path=/; revision=332 --- Annotation/src/ie/dcu/apps/ist/AppWindow.java | 2 +- .../ist/actions/ExportImageMapAction.java | 2 +- .../ie/dcu/apps/ist/actions/OpenAction.java | 1 - .../apps/ist/dialogs/PopUpLabelDialog.java | 2 +- .../apps/ist/export/imagemap/Exporter.java | 112 ++++++++- .../src/ie/dcu/apps/ist/labelling/Labels.java | 15 +- .../dcu/apps/ist/labelling/SpeciesTerm.java | 36 +++ .../dcu/apps/ist/views/SegmentationView.java | 20 +- .../ist/widgets/AnnotatedImageControl.java | 4 +- .../ie/dcu/segment/SegmentationContext.java | 224 ++++++++++++++---- .../src/ie/dcu/segment/SegmentationMask.java | 66 ++++++ .../dcu/segment/painters/CombinedPainter.java | 11 +- 12 files changed, 406 insertions(+), 89 deletions(-) create mode 100644 Annotation/src/ie/dcu/apps/ist/labelling/SpeciesTerm.java diff --git a/Annotation/src/ie/dcu/apps/ist/AppWindow.java b/Annotation/src/ie/dcu/apps/ist/AppWindow.java index 8c7ad07..09e3e75 100644 --- a/Annotation/src/ie/dcu/apps/ist/AppWindow.java +++ b/Annotation/src/ie/dcu/apps/ist/AppWindow.java @@ -704,7 +704,7 @@ public class AppWindow extends ApplicationWindow implements FileDropListener { { if(view.getContext().getEnabledMask().getImageData().getPixel(pt.x,pt.y) != 0 && (view.getPainter().getName().equals("Combined")) && SegmentationView.getLabelMode()) { - String segmentName = view.getContext().getEnabledMask().segmentName; + String segmentName = view.getContext().getEnabledMask().ontologyTerm.getName(); view.getCanvas().setToolTipText(segmentName); SegmentationView.comboLabel.setText(segmentName); return; diff --git a/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java b/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java index 191e737..3a62a7f 100644 --- a/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java +++ b/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java @@ -59,7 +59,7 @@ public class ExportImageMapAction extends AppAction{ exporter.setObjectLink(result.link); exporter.setExportShape(result.shape); exporter.setObjectDescription(result.description); - + // Export try { exporter.export(result.folder,masks); diff --git a/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java b/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java index 051817d..797723a 100644 --- a/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java +++ b/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java @@ -48,7 +48,6 @@ public class OpenAction extends AppAction { else if (name.toLowerCase().endsWith(IMGMAP_EXTENSION)) { // Load Imagemap from Disk - System.out.println("Coming here"); window.setContext(SegmentationContext.loadImageMap(file)); status("Opened segmentation context %s successfully", name); } diff --git a/Annotation/src/ie/dcu/apps/ist/dialogs/PopUpLabelDialog.java b/Annotation/src/ie/dcu/apps/ist/dialogs/PopUpLabelDialog.java index e5cfb00..410fda0 100644 --- a/Annotation/src/ie/dcu/apps/ist/dialogs/PopUpLabelDialog.java +++ b/Annotation/src/ie/dcu/apps/ist/dialogs/PopUpLabelDialog.java @@ -116,7 +116,7 @@ public class PopUpLabelDialog extends Dialog { { //For removing all previously assigned labels labelCombo.remove(0,labelCombo.getItemCount()-1); - terms = labels.getLabelsFromJSON(labelCombo.getText()); + terms = labels.getOntologyTerms(labelCombo.getText()); } int i = 0; for (OntologyTerm term : terms) diff --git a/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java b/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java index 42fcf05..202e720 100644 --- a/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java +++ b/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java @@ -3,7 +3,6 @@ package ie.dcu.apps.ist.export.imagemap; import ie.dcu.apps.ist.views.SegmentationView; import ie.dcu.image.ContourTracer; import ie.dcu.segment.SegmentationMask; -import ie.dcu.util.FileUtils; import java.awt.Polygon; import java.awt.image.*; @@ -13,6 +12,13 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.imageio.ImageIO; +import javax.xml.parsers.*; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; /** * Exports HTML image maps from a segmentation mask and an image. @@ -20,7 +26,7 @@ import javax.imageio.ImageIO; * @author Kevin McGuinness */ public class Exporter { -// private final List masks; + private final BufferedImage image; private File file; @@ -134,6 +140,11 @@ public class Exporter { ImageIO.write(image, "png", out); + // Saving the annotation specific metadata + ZipEntry metadata = new ZipEntry("metadata.xml"); + out.putNextEntry(metadata); + saveMetadata(out,masks); + for(SegmentationMask mask : masks) { ContourTracer tracer = new ContourTracer(mask, SegmentationMask.FOREGROUND); @@ -172,10 +183,9 @@ public class Exporter { // Saving the marked up annotations ZipEntry markupData = new ZipEntry("markup-"+mask.layerNumber+".dat"); - out.putNextEntry(markupData); + saveMaskByteValues(out,mask); - mask.getAnnotations().save(out); } } @@ -213,20 +223,21 @@ public class Exporter { imageName, mask.layerNumber)); area.addAttr("onmouseout", String.format("rollover(document.%s, image0)", imageName)); - area.addAttr("title",mask.segmentName); + area.addAttr("title",mask.ontologyTerm.getName()); } map.addArea(area); } } - // Create an entry for the imageMap - ZipEntry entryImageMap = new ZipEntry(htmlFile); + + // Create an entry for the imageMap (code for saving image map file into the zip file) + /*ZipEntry entryImageMap = new ZipEntry(htmlFile); // Start the entry out.putNextEntry(entryImageMap); // Exporting to zip file - map.exportToFile(out); + map.exportToFile(out);*/ // Exporting to Folder map.exportToFile(new File(folder, htmlFile)); @@ -238,6 +249,91 @@ public class Exporter { } } + private void saveMaskByteValues(OutputStream o, SegmentationMask mask) throws IOException + { + DataOutputStream out = new DataOutputStream(new BufferedOutputStream(o)); + byte[] intensityValues = mask.values; + boolean[] values = new boolean[intensityValues.length]; + for(int x =0; x < intensityValues.length;x++) + { + values[x] = (intensityValues[x] == 2 ? false:true); + out.writeBoolean(values[x]); + } + } + + private void saveMetadata(OutputStream o, List masks) throws IOException + { + DataOutputStream out = new DataOutputStream(new BufferedOutputStream(o)); + + try + { + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + + Document document = documentBuilder.newDocument(); + Element rootElement = document.createElement("Image_data"); + document.appendChild(rootElement); + + Element imageElement = document.createElement("image_filename"); + rootElement.appendChild(imageElement); + + Element speciesElement = document.createElement("species"); + speciesElement.setAttribute("name", SegmentationView.speciesCombo.getText()); + speciesElement.setAttribute("ubio_id", "Ubio:12345"); + rootElement.appendChild(speciesElement); + + Element curatorElement = document.createElement("curator_name"); + curatorElement.setTextContent(SegmentationView.curatorCombo.getText()); + rootElement.appendChild(curatorElement); + + Element commentElement = document.createElement("comment"); + commentElement.setTextContent(SegmentationView.comment.getText()); + rootElement.appendChild(commentElement); + + Element collectionIdElement = document.createElement("collection_id"); + collectionIdElement.setTextContent(SegmentationView.collectionId.getText()); + rootElement.appendChild(collectionIdElement); + + Element segmentsElement = document.createElement("segments"); + rootElement.appendChild(segmentsElement); + + for (SegmentationMask mask : masks) + { + Element segmentElement = document.createElement("segment"); + segmentsElement.appendChild(segmentElement); + + String url = "url"; + Element urlElem = document.createElement("url"); + urlElem.appendChild(document.createTextNode(url)); + segmentElement.appendChild(urlElem); + + String layer = ""+mask.layerNumber; + Element layerElem = document.createElement("layer"); + layerElem.appendChild(document.createTextNode(layer)); + segmentElement.appendChild(layerElem); + + String annotationTerm = mask.ontologyTerm.getName(); + Element annotationTermElem = document.createElement("annotation_term"); + annotationTermElem.appendChild(document.createTextNode(annotationTerm)); + segmentElement.appendChild(annotationTermElem); + } + + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + + DOMSource source = new DOMSource(document); + StreamResult result = new StreamResult(out); + transformer.transform(source, result); + + }catch (ParserConfigurationException pce) { + pce.printStackTrace(); + }catch (TransformerException tfe) { + tfe.printStackTrace(); + } + } + + private List getPreloads(List trace, int layerNumber) { List preloads = new ArrayList(); diff --git a/Annotation/src/ie/dcu/apps/ist/labelling/Labels.java b/Annotation/src/ie/dcu/apps/ist/labelling/Labels.java index 4a77f4c..862d974 100644 --- a/Annotation/src/ie/dcu/apps/ist/labelling/Labels.java +++ b/Annotation/src/ie/dcu/apps/ist/labelling/Labels.java @@ -2,7 +2,6 @@ package ie.dcu.apps.ist.labelling; import ie.dcu.apps.ist.AppWindow; -import java.awt.List; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.StringReader; @@ -10,8 +9,6 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; import javax.xml.bind.DatatypeConverter; import javax.xml.parsers.*; @@ -35,7 +32,7 @@ public class Labels * ArrayList containing each Label item * */ - public ArrayList getLabelsFromJSON(String content) { + public ArrayList getOntologyTerms(String content) { ArrayList terms = new ArrayList(); // temporary variable for storing each list element in the loop try @@ -80,8 +77,9 @@ public class Labels - public Map getLabelsFromXML(String content) { - Map map = new HashMap(); + public ArrayList getSpeciesTerms(String content) { + ArrayList speciesTerms = new ArrayList(); + String namBankId,nameBankString; try { @@ -110,7 +108,8 @@ public class Labels Element el = (Element)nlist.item(i); namBankId = new String(DatatypeConverter.parseBase64Binary(getTagValue("namebankID", el))); nameBankString = new String(DatatypeConverter.parseBase64Binary(getTagValue("nameString", el))); - map.put(namBankId,nameBankString); + SpeciesTerm species = new SpeciesTerm(nameBankString,namBankId); + speciesTerms.add(species); } } in.close(); @@ -123,7 +122,7 @@ public class Labels catch(Exception ex) { } - return map; + return speciesTerms; } public static Document loadXMLFromString(String xml) throws Exception diff --git a/Annotation/src/ie/dcu/apps/ist/labelling/SpeciesTerm.java b/Annotation/src/ie/dcu/apps/ist/labelling/SpeciesTerm.java new file mode 100644 index 0000000..71e5dec --- /dev/null +++ b/Annotation/src/ie/dcu/apps/ist/labelling/SpeciesTerm.java @@ -0,0 +1,36 @@ +/** + * + */ +package ie.dcu.apps.ist.labelling; + +/** + * @author nikhil + * Contains attributes associated with terms received from ontologies. + */ +public class SpeciesTerm { + + private String speciesName; + private String speciesId; + + // constructor + public SpeciesTerm(String speciesName, String speciesId) { + this.speciesName = speciesName; + this.speciesId = speciesId; + } + + public String getSpeciesName() { + return this.speciesName; + } + + public String getSpeciesId() { + return this.speciesId; + } + + public void setSpeciesId(String speciesId) { + this.speciesId = speciesId; + } + public void setSpeciesName(String speciesName) { + this.speciesName = speciesName; + } + +} diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index fd827a0..995c547 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -268,11 +268,7 @@ public class SegmentationView extends Composite { term.setName((String)comboLabel.getData(comboLabel.getText())); term.setAccessionId(parseAccessionIdFromComboLabel(comboLabel)); view.getContext().getEnabledMask().ontologyTerm = term; - /* TODO: remove this and reference SegmentationMask.ontologyTerm.getName() instead - * (find tooltip and any other reference as well) - */ - view.getContext().getEnabledMask().segmentName = (String) comboLabel.getData(comboLabel.getText()); - } + } execute(Tool.AssignButton, null); } }); @@ -296,7 +292,7 @@ public class SegmentationView extends Composite { { //For removing all previously assigned labels combo.remove(0,combo.getItemCount()-1); - terms = labels.getLabelsFromJSON(combo.getText()); + terms = labels.getOntologyTerms(combo.getText()); assign.setEnabled(!(combo.getText().isEmpty())); } int i = 0; @@ -316,14 +312,18 @@ public class SegmentationView extends Composite { */ public void dropdownLabelsFromXML(SelectionEvent e) { - Map speciesMap = new HashMap(); - speciesMap = labels.getLabelsFromXML(speciesCombo.getText()); - for (String species : speciesMap.values()) + ArrayList speciesTerms = new ArrayList(); + speciesTerms = labels.getSpeciesTerms(speciesCombo.getText()); + int i = 0; + for (SpeciesTerm speciesTerm : speciesTerms) { - speciesCombo.add(species); + speciesCombo.add(speciesTerm.getSpeciesName(),i); + speciesCombo.setData(speciesTerm.getSpeciesName(), speciesTerm.getSpeciesId()); + i++; } searchSpecies.setEnabled(!(speciesCombo.getText().isEmpty())); speciesCombo.setListVisible(true); + } /* diff --git a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java index 091b311..c161f8d 100644 --- a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java +++ b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java @@ -336,7 +336,6 @@ public class AnnotatedImageControl extends Composite { */ private void recreate() { if (ctx == null) { - // Set null image (disposing the old one) view.setImage(null, true); @@ -356,7 +355,8 @@ public class AnnotatedImageControl extends Composite { // Create initial image ObservableImage buffer = new ObservableImage( - SwtUtils.createImage(ctx.getBounds()) + // change here + SwtUtils.createImage(ctx.getMask().getBounds()) ); // Set the image (disposing the old one) diff --git a/Annotation/src/ie/dcu/segment/SegmentationContext.java b/Annotation/src/ie/dcu/segment/SegmentationContext.java index 19e3ad4..9053b53 100644 --- a/Annotation/src/ie/dcu/segment/SegmentationContext.java +++ b/Annotation/src/ie/dcu/segment/SegmentationContext.java @@ -1,5 +1,7 @@ package ie.dcu.segment; +import ie.dcu.apps.ist.labelling.SpeciesTerm; +import ie.dcu.apps.ist.views.SegmentationView; import ie.dcu.segment.annotate.*; import ie.dcu.segment.util.*; import ie.dcu.swt.SwtUtils; @@ -9,9 +11,18 @@ import java.io.*; import java.util.ArrayList; import java.util.zip.*; +import javax.xml.bind.DatatypeConverter; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.Display; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; /** * Instances of this class manage the context of an interactive segmentation @@ -19,6 +30,7 @@ import org.eclipse.swt.widgets.Display; * {@link Segmenter} when the segmentation is initialized or updated. The * segmentation context encapsulates the image being segmented, the current * segmentation mask, the and the annotations that have been applied to the + * * image. * * @@ -50,12 +62,12 @@ public class SegmentationContext { /** * For storing independent Segmentation objects (i.e the masks which are formed into objects) */ - private ArrayList segmentationMaskObjects; + private static ArrayList segmentationMaskObjects; // lazy create (use getters for these fields) - private AnnotationManager annotations; + private static AnnotationManager annotations; // SegmentationMask which has not yet been turned into an Object - private SegmentationMask currentSegmentMask; + private static SegmentationMask currentSegmentMask; private Image image; private Rectangle bounds; @@ -141,13 +153,14 @@ public class SegmentationContext { return bounds; } - public final void formSegmentationObject() { + public final static void formSegmentationObject() { // Makes needsHighlighting False for all the previous segments. disableAllSegments(); // Set needsHighlighting True for the current segment. currentSegmentMask.enabled = true; - currentSegmentMask.setAnnotations(getAnnotations()); + //currentSegmentMask.setAnnotations(getAnnotations()); segmentationMaskObjects.add(currentSegmentMask); + // Making a new segmentationObject after storing the current SegmentationObject currentSegmentMask = null; annotations.clear(); @@ -200,7 +213,7 @@ public class SegmentationContext { } } - public void disableAllSegments() + public static void disableAllSegments() { for(SegmentationMask currentSegmentMask : segmentationMaskObjects) { @@ -356,7 +369,6 @@ public class SegmentationContext { out.putNextEntry(entry); // Store the markup - System.out.println("Near seg context save"); getAnnotations().save(out); // close entry @@ -370,7 +382,6 @@ public class SegmentationContext { // Set new filename this.file = file; } - System.out.println("After all the saving is done"); } /** @@ -400,7 +411,7 @@ public class SegmentationContext { imageData = SwtUtils.loadImageData(in); } else if (name.equals("mask.png")) { - //segmentObject = (SegmentationObject) SegmentationMask.read(in); + segmentMask = (SegmentationMask) SegmentationMask.read(in); } else if (name.equals("markup.dat")) { annotations = new AnnotationManager(); @@ -430,7 +441,6 @@ public class SegmentationContext { ctx.currentSegmentMask = segmentMask; ctx.annotations = annotations; - return ctx; } @@ -448,68 +458,184 @@ public class SegmentationContext { public static SegmentationContext loadImageMap(File file) throws IOException { ZipInputStream in = new ZipInputStream(new BufferedInputStream( new FileInputStream(file))); - + ZipFile zip = new ZipFile(file); ImageData imageData = null; SegmentationMask segmentMask = null; - AnnotationManager annotations = null; - - SegmentationContext ctx = new SegmentationContext(imageData, file); + String speciesTermName = "", collectionId = "", comment = "", curatorName = "",speciesTermId = ""; + int width = 0,height = 0; + int noOfSegments = 0; + String [][] tempStorage = null; + SegmentationContext ctx = null; try { ZipEntry entry; while ((entry = in.getNextEntry()) != null) { - String name = entry.getName(); - + if (name.equals("image.png")) { - System.out.println("Loading Original image"); imageData = SwtUtils.loadImageData(in); - - } else if (name.startsWith("segment")) { + ctx = new SegmentationContext(imageData, file); + width = imageData.width; + height = imageData.height; + } + + else if (name.startsWith("markup")) { String[] temp; temp = name.split("-"); - System.out.println("Temp array coming as "+temp[0]+" and "+temp[1]); - //SegmentationMask mask = ctx.getMask(); - //ctx.formSegmentationObject(); + int layerNumber = Integer.parseInt(temp[1].substring(0, temp[1].indexOf("."))); + SegmentationMask mask = new SegmentationMask(width,height); + mask.layerNumber = layerNumber; - SegmentationMask mask = SegmentationMask.read(in); - ctx.formSegmentationObject(); - //segmentationMaskObjects.add(currentSegmentMask); - - } else if (name.equals("markup.dat")) { - annotations = new AnnotationManager(); - annotations.load(in); + + InputStream input = zip.getInputStream(entry); + segmentationMaskObjects.add(setMaskPixelValues(input,mask,width,height)); + } + else if (name.startsWith("metadata")) + { + try + { + InputStream is = zip.getInputStream(entry); + Document doc = loadXMLFromZip(is); + Element docEle = doc.getDocumentElement(); + + // getting species attributes + NodeList speciesNode = docEle.getElementsByTagName("species"); + Element speciesEle = (Element)speciesNode.item(0); + speciesTermName = speciesEle.getAttribute("name"); + speciesTermId = speciesEle.getAttribute("ubio_id"); + + // getting curator names + NodeList curatorNode = docEle.getElementsByTagName("curator_name"); + Element curatorEle = (Element)curatorNode.item(0); + curatorName = curatorEle.getTextContent(); + + // getting comment + NodeList commentNode = docEle.getElementsByTagName("comment"); + Element commentEle = (Element)commentNode.item(0); + comment = commentEle.getTextContent(); + + // getting collection ids + NodeList collectionNode = docEle.getElementsByTagName("collection_id"); + Element collectionEle = (Element)collectionNode.item(0); + collectionId = collectionEle.getTextContent(); + + // getting collection ids + NodeList nlist = docEle.getElementsByTagName("segment"); + noOfSegments = nlist.getLength(); + tempStorage = new String[nlist.getLength()][3]; + if(nlist != null && nlist.getLength() > 0) + { + for(int i = 0 ; i < nlist.getLength();i++) + { + Element segEle = (Element)nlist.item(i); + NodeList segDetails = segEle.getChildNodes(); + if(segDetails != null && segDetails.getLength() > 0) + { + for(int x = 0 ; x < segDetails.getLength();x++) + { + Element segDet = (Element)segDetails.item(x); + tempStorage[i][x] = segDet.getTextContent(); + } + } + + } + } + SegmentationView.speciesCombo.setText(speciesTermName); + SegmentationView.curatorCombo.setText(curatorName); + SegmentationView.collectionId.setText(collectionId); + SegmentationView.comment.setText(comment); + } + catch(Exception e) + { + System.out.println("XML exception"+e.toString()); + } + } + + } + } + catch(Exception ex) + { + } + finally + { + for(int i = 0 ; i < noOfSegments;i++) + { + for(int x = 0 ; x < 3;x++) + { + if (x == 1) + { + segmentationMaskObjects.get(i).layerNumber = Integer.parseInt(tempStorage[i][x]); + } + if (x == 2) + { + segmentationMaskObjects.get(i).ontologyTerm.setName(tempStorage[i][x]); + } } - System.out.println("File name is : "+name); - - in.closeEntry(); } - - } finally { in.close(); } + return ctx; +} - if (imageData == null) { - throw new IOException("No image found in context file"); - } - - if (segmentMask == null) { - throw new IOException("No mask found in context file"); + private static SegmentationMask setMaskPixelValues(InputStream in, SegmentationMask mask, int width, int height) throws IOException + { + try + { + DataInputStream input = new DataInputStream(new BufferedInputStream(in)); + int length = width * height; + boolean[] intensity = new boolean[length]; + + int index = 0; + boolean EOF = false; + // see code in export and something to do with sizes Array index out of bounds exception do it today completely + while(!EOF) + { + try + { + intensity[index] = input.readBoolean(); + } + catch(Exception e) + { + EOF = true; + } + index = index+1; + } + int i = 0; + for (int x=0;x