Changeset 4033


Ignore:
Timestamp:
05/11/08 13:47:21 (12 years ago)
Author:
melissa
Message:

Added logic to handle BGR images.

File:
1 edited

Legend:

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

    r3999 r4033  
    103103  private boolean isRLE = false; 
    104104  private boolean inverted; 
     105  private boolean bgr = false; 
    105106 
    106107  private String date, time, imageType; 
     
    258259        in.read(buf, row * w * c * bpp, w * c * bpp); 
    259260        in.skipBytes(c * bpp * (core.sizeX[0] - w - x)); 
     261      } 
     262    } 
     263 
     264    if (bgr && core.rgb[0]) { 
     265      int stride = bpp * getRGBChannelCount(); 
     266      for (int i=0; i<buf.length; i+=stride) { 
     267        for (int q=0; q<bpp; q++) { 
     268          byte tmp = buf[i + q]; 
     269          buf[i + q] = buf[i + stride - bpp + q]; 
     270          buf[i + stride - bpp + q] = tmp; 
     271        } 
    260272      } 
    261273    } 
     
    588600 
    589601    if (info != null && tag != ITEM) { 
    590       if (info.trim().equals("")) info = oldValue; 
     602      info = info.trim(); 
     603      if (info.equals("")) info = oldValue; 
    591604 
    592605      String key = (String) TYPES.get(new Integer(tag)); 
     
    622635      else if (key.equals("Content Date")) date = info; 
    623636      else if (key.equals("Image Type")) imageType = info; 
     637      else if (key.equals("Transfer Syntax UID")) { 
     638        if (!bgr) bgr = info.equals("1.2.840.10008.1.2"); 
     639      } 
    624640 
    625641      if (((tag & 0xffff0000) >> 16) != 0x7fe0) { 
Note: See TracChangeset for help on using the changeset viewer.