Changeset 7418


Ignore:
Timestamp:
12/14/10 07:17:01 (9 years ago)
Author:
callan
Message:

More robust InCellReader XML parsing. (See #623)

Specifically handled:

  • <Gain/>
  • Missing sections of <PlateMap> with sensible defaults
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/InCellReader.java

    r7417 r7418  
    7373  private int imageWidth, imageHeight; 
    7474  private String creationDate; 
    75   private String rowName, colName; 
    76   private int startRow, startCol; 
     75  private String rowName = "A", colName = "1"; 
     76  private int startRow = 0, startCol = 0; 
    7777  private int fieldCount; 
    7878 
     
    227227      metadataFiles = null; 
    228228      imageWidth = imageHeight = 0; 
    229       rowName = colName = null; 
     229      rowName = "A"; 
     230      colName = "1"; 
    230231      firstRow = firstCol = 0; 
    231232      lastCol = 0; 
     
    559560    public void endElement(String uri, String localName, String qName) { 
    560561      if (qName.equals("PlateMap")) { 
    561         imageFiles = new Image[wellRows * wellCols][fieldCount][getSizeT()][]; 
     562        int sizeT = getSizeT(); 
     563        if (sizeT == 0) { 
     564          // There has been no <TimeSchedule> in the <PlateMap> defined to 
     565          // populate channelsPerTimepoint so we have to assume that there is 
     566          // only one timepoint otherwise the imageFiles array below will not 
     567          // be correctly initialized. 
     568          sizeT = 1; 
     569        } 
     570        if (channelsPerTimepoint.size() == 0) { 
     571          // There has been no <TimeSchedule> in the <PlateMap> defined to 
     572          // populate channelsPerTimepoint so we have to assume that all 
     573          // channels are being acquired. 
     574          channelsPerTimepoint.add(core[0].sizeC); 
     575        } 
     576        imageFiles = new Image[wellRows * wellCols][fieldCount][sizeT][]; 
    562577        for (int well=0; well<wellRows*wellCols; well++) { 
    563578          for (int field=0; field<fieldCount; field++) { 
    564             for (int t=0; t<getSizeT(); t++) { 
     579            for (int t=0; t<sizeT; t++) { 
    565580              int channels = channelsPerTimepoint.get(t).intValue(); 
    566581              imageFiles[well][field][t] = new Image[channels * getSizeZ()]; 
     
    856871      } 
    857872      else if (qName.equals("Gain")) { 
    858         Double gain = new Double(attributes.getValue("value")); 
     873        String value = attributes.getValue("value"); 
     874        if (value == null) { 
     875          return; 
     876        } 
     877        Double gain = new Double(value); 
    859878        for (int i=0; i<getSeriesCount(); i++) { 
    860879          setSeries(i); 
Note: See TracChangeset for help on using the changeset viewer.