Changeset 3304


Ignore:
Timestamp:
10/23/07 08:15:27 (12 years ago)
Author:
melissa
Message:

Better indexed color support in Zeiss LSM.

Location:
trunk/loci/formats/in
Files:
2 edited

Legend:

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

    r3302 r3304  
    9292      for (int j=0; j<table.length; j++) { 
    9393        for (int i=0; i<table[0].length; i++) { 
    94           if (isLittleEndian()) { 
    95             int n = colorMap[next++]; 
    96             if ((n & 0xffff) > 255) table[j][i] = (byte) ((n & 0xff00) >> 8); 
    97             else table[j][i] = (byte) (n & 0xff); 
    98           } 
    99           else table[j][i] = (byte) ((colorMap[next++] & 0xff00) >> 8); 
     94          table[j][i] = (byte) (colorMap[next++] & 0xff); 
    10095        } 
    10196      } 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r3302 r3304  
    7979      return false; // we went through the IFD; the ID wasn't found. 
    8080    } 
     81  } 
     82 
     83  /* @see loci.formats.IFormatReader#get8BitLookupTable() */ 
     84  public byte[][] get8BitLookupTable() throws FormatException, IOException { 
     85    FormatTools.assertId(currentId, true, 1); 
     86    int[] lut = (int[]) TiffTools.getIFDValue(ifds[0], TiffTools.COLOR_MAP); 
     87    if (lut == null || (core.pixelType[0] != FormatTools.UINT8 && 
     88      core.pixelType[0] != FormatTools.INT8)) 
     89    { 
     90      return null; 
     91    } 
     92    byte[][] bLut = new byte[3][256]; 
     93    for (int i=0; i<bLut[0].length; i++) { 
     94      bLut[0][i] = (byte) ((lut[i] & 0xff0000) >> 16); 
     95      bLut[1][i] = (byte) ((lut[i] & 0xff00) >> 8); 
     96      bLut[2][i] = (byte) (lut[i] & 0xff); 
     97    } 
     98    return bLut; 
     99  } 
     100 
     101  /* @see loci.formats.IFormatReader#get16BitLookupTable() */ 
     102  public short[][] get16BitLookupTable() throws FormatException, IOException { 
     103    FormatTools.assertId(currentId, true, 1); 
     104    int[] lut = (int[]) TiffTools.getIFDValue(ifds[0], TiffTools.COLOR_MAP); 
     105    if (lut == null) return null; 
     106    short[][] s = new short[3][65536]; 
     107    if (lut.length < s.length * s[0].length) return null; 
     108    for (int i=0; i<s.length; i++) { 
     109      for (int j=0; j<s[i].length; j++) { 
     110        s[i][j] = (short) (lut[i*s[i].length + j]); 
     111      } 
     112    } 
     113    return s; 
    81114  } 
    82115 
     
    646679      if (data < 0) data += 4294967296L; 
    647680      put("Type" + i + "-" + suffix, data); 
    648       put("Size" + i + "-" + suffix, in.readInt()); 
     681      int v = in.readInt(); 
     682      put("Size" + i + "-" + suffix, v); 
    649683 
    650684      switch ((int) data) { 
Note: See TracChangeset for help on using the changeset viewer.