Changeset 2567


Ignore:
Timestamp:
04/06/07 13:17:33 (13 years ago)
Author:
melissa
Message:

LeicaReader now properly handles color channels by parsing the channel names
in the metadata.

File:
1 edited

Legend:

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

    r2564 r2567  
    136136      initFile(id); 
    137137    } 
    138     return tiff[series][0].isRGB((String) files[series].get(0)); 
     138    return false;  
    139139  } 
    140140 
     
    165165      throw new FormatException("Invalid image number: " + no); 
    166166    } 
     167    int ndx = no % channelIndices.length;  
    167168    byte[] b = tiff[series][no].openBytes((String) files[series].get(no), 0); 
     169    b = ImageTools.splitChannels(b, core.sizeC[series], false,  
     170      isInterleaved(id))[channelIndices[ndx]];  
    168171    tiff[series][no].close(); 
    169172    return b; 
     
    180183    tiff[series][no].openBytes((String) files[series].get(no), 0, buf); 
    181184    tiff[series][no].close(); 
     185     
     186    int ndx = no % channelIndices.length; 
     187    buf = ImageTools.splitChannels(buf, core.sizeC[series], false,  
     188      isInterleaved(id))[channelIndices[ndx]]; 
    182189    return buf; 
    183190  } 
     
    197204    BufferedImage b = 
    198205      tiff[series][no].openImage((String) files[series].get(no), 0); 
    199     ColorModel cm = ImageTools.makeColorModel(getRGBChannelCount(id), 
    200       b.getRaster().getTransferType(), validBits[series]); 
    201     b = ImageTools.makeBuffered(b, cm); 
     206 
     207    int ndx = no % channelIndices.length; 
     208 
     209    b = ImageTools.splitChannels(b)[channelIndices[ndx]]; 
    202210    tiff[series][no].close(); 
    203211    return b; 
     
    960968        if (nChannels > 4) nChannels = 3; 
    961969        core.sizeC[i] = nChannels; 
     970        channelIndices = new int[nChannels]; 
    962971 
    963972        for (int j=0; j<nChannels; j++) { 
     
    987996 
    988997          String name = DataTools.stripString(new String(temp, pt, length)); 
    989           /* 
    990           if (name.equals("Green") || name.equals("Red") || name.equals("Blue")) 
    991           { 
    992             numChannels[i] = 3; 
    993           } 
    994           */ 
     998           
     999          if (name.equals("Red")) channelIndices[j] = 0;  
     1000          else if (name.equals("Green")) channelIndices[j] = 1;  
     1001          else if (name.equals("Blue")) channelIndices[j] = 2;  
     1002          else if (name.equals("Gray")) channelIndices[j] = 0;  
     1003          else if (name.equals("Yellow")) channelIndices[j] = 0;  
     1004          else if (name.equals("Geo (L&S)")) channelIndices[j] = 0;  
     1005           
    9951006          addMeta("LUT Channel " + j + " name", name); 
    9961007          pt += length; 
     
    10121023        for (int i=0; i<core.sizeC.length; i++) { 
    10131024          setSeries(currentId, i); 
    1014           if (isRGB(currentId)) core.sizeC[i] = 3; 
    1015           else core.sizeC[i] = 1; 
     1025          core.sizeZ[i] /= core.sizeC[i];  
    10161026        } 
    10171027        setSeries(currentId, oldSeries); 
Note: See TracChangeset for help on using the changeset viewer.