Changeset 4111


Ignore:
Timestamp:
06/11/08 17:23:32 (11 years ago)
Author:
melissa
Message:
  • Fixed ArrayIndexOutOfBounds for ZVI files that have no timestamps.
  • Fixed bug with multi-series Openlab files.
Location:
trunk/loci/formats/in
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/OpenlabReader.java

    r4106 r4111  
    119119    FormatTools.assertId(currentId, true, 1); 
    120120    FormatTools.checkPlaneNumber(this, no); 
     121    FormatTools.checkBufferSize(this, buf.length); 
    121122 
    122123    in.seek(planes[planeOffsets[series][no]].planeOffset); 
     
    176177        Location.mapFile("OPENLAB_PICT", new RABytes(b)); 
    177178        pict.setId("OPENLAB_PICT"); 
    178         buf = pict.openBytes(0, x, y, w, h); 
    179         pict.close(); 
     179        pict.openBytes(0, buf, x, y, w, h); 
    180180      } 
    181181      catch (FormatException e) { exc = e; } 
    182182      catch (IOException e) { exc = e; } 
     183      pict.close(); 
    183184 
    184185      if (exc != null) { 
     
    322323        planes[imagesFound].volumeType = in.readShort(); 
    323324        in.skipBytes(16); 
    324         planes[imagesFound].planeName = in.readString(128).trim(); 
     325        long pointer = in.getFilePointer(); 
     326        planes[imagesFound].planeName = in.readCString().trim(); 
     327        in.skipBytes((int) (128 - in.getFilePointer() + pointer)); 
    325328        addMeta("Plane " + imagesFound + " Name", 
    326329          planes[imagesFound].planeName); 
  • trunk/loci/formats/in/ZeissZVIReader.java

    r4103 r4111  
    619619    } 
    620620 
    621     long firstStamp = Long.parseLong((String) timestamps.get(0)); 
    622     store.setImageCreationDate(DataTools.convertDate((long) (firstStamp / 1600), 
    623       DataTools.ZVI), 0); 
     621    long firstStamp = 0; 
     622    if (timestamps.size() > 0) { 
     623      firstStamp = Long.parseLong((String) timestamps.get(0)); 
     624      store.setImageCreationDate(DataTools.convertDate( 
     625        (long) (firstStamp / 1600), DataTools.ZVI), 0); 
     626    } 
     627    else { 
     628      store.setImageCreationDate( 
     629        DataTools.convertDate(System.currentTimeMillis(), DataTools.UNIX), 0); 
     630    } 
    624631 
    625632    for (int plane=0; plane<core.imageCount[0]; plane++) { 
Note: See TracChangeset for help on using the changeset viewer.