Changeset 6329


Ignore:
Timestamp:
05/17/10 16:57:54 (10 years ago)
Author:
melissa
Message:

Fixed a couple of bugs exposed by the test suite.

Location:
trunk/components
Files:
3 edited

Legend:

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

    r6230 r6329  
    202202  // -- Helper methods -- 
    203203 
    204   private void parseTags(MetadataStore store) throws FormatException, IOException { 
     204  private void parseTags(MetadataStore store) 
     205    throws FormatException, IOException 
     206  { 
    205207    LOGGER.info("Reading tags"); 
    206208 
  • trunk/components/bio-formats/src/loci/formats/in/IvisionReader.java

    r6230 r6329  
    219219      LOGGER.info("Looking for XML metadata"); 
    220220      in.findString(false, "<?xml"); 
    221       in.seek(in.getFilePointer() - 5); 
    222  
    223       String xml = in.readString((int) (in.length() - in.getFilePointer())); 
    224       xml = xml.substring(xml.indexOf("<"), xml.lastIndexOf(">") + 1); 
    225       IvisionHandler handler = new IvisionHandler(); 
    226       XMLTools.parseXML(xml, handler); 
     221      if (in.getFilePointer() < in.length()) { 
     222        in.seek(in.getFilePointer() - 5); 
     223 
     224        String xml = in.readString((int) (in.length() - in.getFilePointer())); 
     225        xml = xml.substring(xml.indexOf("<"), xml.lastIndexOf(">") + 1); 
     226        IvisionHandler handler = new IvisionHandler(); 
     227        XMLTools.parseXML(xml, handler); 
     228      } 
     229      else LOGGER.debug("XML metadata not found"); 
    227230    } 
    228231 
  • trunk/components/test-suite/src/loci/tests/testng/FormatReaderTest.java

    r6234 r6329  
    425425        int sizeC = retrieve.getPixelsSizeC(i).getValue().intValue(); 
    426426        int nChannelComponents = retrieve.getChannelCount(i); 
    427  
    428         if (sizeC != nChannelComponents) msg = "ChannelComponent"; 
     427        int samplesPerPixel = retrieve.getChannelSamplesPerPixel(i, 0); 
     428 
     429        if (sizeC != nChannelComponents * samplesPerPixel) { 
     430          msg = "ChannelComponent"; 
     431        } 
    429432 
    430433        // Z, C and T indices should be populated if PlaneTiming is present 
    431434 
    432         Double deltaT = retrieve.getPlaneDeltaT(i, 0); 
    433         Double exposure = retrieve.getPlaneExposureTime(i, 0); 
    434         Integer z = retrieve.getPlaneTheZ(i, 0); 
    435         Integer c = retrieve.getPlaneTheC(i, 0); 
    436         Integer t = retrieve.getPlaneTheT(i, 0); 
     435        Double deltaT = null; 
     436        Double exposure = null; 
     437        Integer z = null, c = null, t = null; 
     438 
     439        if (retrieve.getPlaneCount(i) > 0) { 
     440          deltaT = retrieve.getPlaneDeltaT(i, 0); 
     441          exposure = retrieve.getPlaneExposureTime(i, 0); 
     442          z = retrieve.getPlaneTheZ(i, 0); 
     443          c = retrieve.getPlaneTheC(i, 0); 
     444          t = retrieve.getPlaneTheT(i, 0); 
     445        } 
    437446 
    438447        if ((deltaT != null || exposure != null) && 
     
    612621          int imageCount = reader.getImageCount(); 
    613622          totalPlanes += imageCount; 
    614           for (int j=0; j<imageCount; j++) reader.openImage(j); 
     623          byte[] buf = new byte[FormatTools.getPlaneSize(reader)]; 
     624          for (int j=0; j<imageCount; j++) reader.openBytes(j, buf); 
    615625        } 
    616626        long t2 = System.currentTimeMillis(); 
Note: See TracChangeset for help on using the changeset viewer.