Changeset 4166


Ignore:
Timestamp:
07/07/08 16:10:21 (12 years ago)
Author:
melissa
Message:

Fixed tag length and plane size calculation bugs.

File:
1 edited

Legend:

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

    r4147 r4166  
    479479    } 
    480480    if (core.imageCount[0] == 0) core.imageCount[0] = 1; 
     481 
     482    while (bitsPerPixel % 8 != 0) bitsPerPixel++; 
     483    if (bitsPerPixel == 24 || bitsPerPixel == 48) bitsPerPixel /= 3; 
     484 
     485    switch (bitsPerPixel) { 
     486      case 8: 
     487        core.pixelType[0] = signed ? FormatTools.INT8 : FormatTools.UINT8; 
     488        break; 
     489      case 16: 
     490        core.pixelType[0] = signed ? FormatTools.INT16 : FormatTools.UINT16; 
     491        break; 
     492      case 32: 
     493        core.pixelType[0] = signed ? FormatTools.INT32 : FormatTools.UINT32; 
     494        break; 
     495    } 
    481496 
    482497    int plane = core.sizeX[0] * core.sizeY[0] * 
     
    549564      new FilterMetadata(getMetadataStore(), isMetadataFiltered()); 
    550565    store.setImageName("", 0); 
    551  
    552     while (bitsPerPixel % 8 != 0) bitsPerPixel++; 
    553     if (bitsPerPixel == 24 || bitsPerPixel == 48) bitsPerPixel /= 3; 
    554  
    555     switch (bitsPerPixel) { 
    556       case 8: 
    557         core.pixelType[0] = signed ? FormatTools.INT8 : FormatTools.UINT8; 
    558         break; 
    559       case 16: 
    560         core.pixelType[0] = signed ? FormatTools.INT16 : FormatTools.UINT16; 
    561         break; 
    562       case 32: 
    563         core.pixelType[0] = signed ? FormatTools.INT32 : FormatTools.UINT32; 
    564         break; 
    565     } 
    566566 
    567567    // populate OME-XML node 
     
    776776      case QQ: 
    777777        // Explicit VR with 16-bit length 
    778         if (tag == 0x00283006) { 
     778        if (tag == 0x00283006) { 
    779779                  return DataTools.bytesToInt(b, 2, 2, core.littleEndian[0]); 
    780780        } 
    781781        int n1 = DataTools.bytesToShort(b, 2, 2, core.littleEndian[0]); 
    782782        int n2 = DataTools.bytesToShort(b, 2, 2, !core.littleEndian[0]); 
     783        if (n1 < 0) return n2; 
     784        if (n2 < 0) return n1; 
    783785        return (int) Math.min(n1, n2); 
    784786      default: 
Note: See TracChangeset for help on using the changeset viewer.