Changeset 5159


Ignore:
Timestamp:
06/09/09 19:22:30 (11 years ago)
Author:
melissa
Message:

Fixed tag length and JPEG plane offset bugs.

File:
1 edited

Legend:

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

    r5129 r5159  
    272272    else if (isJPEG || isJP2K) { 
    273273      // plane is compressed using JPEG or JPEG-2000 
    274       byte[] b = new byte[(int) (in.length() - in.getFilePointer())]; 
     274      long end = no < offsets.length - 1 ? offsets[no + 1] : in.length(); 
     275      byte[] b = new byte[(int) (end - in.getFilePointer())]; 
    275276      in.read(b); 
    276277      if (b[2] != (byte) 0xff) { 
     
    581582        boolean found = false; 
    582583        while (!found) { 
    583           for (int q=0; q<buf.length-3; q++) { 
    584             if (buf[q] == (byte) 0xff && buf[q + 1] == secondCheck) { 
     584          for (int q=0; q<buf.length-2; q++) { 
     585            if (buf[q] == (byte) 0xff && buf[q + 1] == secondCheck && 
     586              buf[q + 2] == (byte) 0xff) 
     587            { 
    585588              if (isJPEG || 
    586589                (isJP2K && buf[q + 2] == (byte) 0xff && buf[q + 3] == 0x51)) 
     
    967970    elementLength = getLength(stream, tag); 
    968971 
    969     if (elementLength == 0 && groupWord == 0x7fe0) { 
     972    if (elementLength == 0 && (groupWord == 0x7fe0 || tag == 0x291014)) { 
    970973      elementLength = getLength(stream, tag); 
    971974    } 
Note: See TracChangeset for help on using the changeset viewer.