Changeset 4095


Ignore:
Timestamp:
06/04/08 11:09:25 (12 years ago)
Author:
melissa
Message:
  • Fixed NPE when calling FluoviewReader.isThisType on a non-TIFF file.
  • Fixed index calculation bug when stitching RGB files with more than 4 channels.
  • More accurate sizeC calculation for ZVI files.
Location:
trunk/loci/formats
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FileStitcher.java

    r4048 r4095  
    11931193      posT[0] < readers[sno][fno].getSizeT()) 
    11941194    { 
    1195       if (readers[sno][fno].isRGB()) posC[0] /= lenC[sno][0]; 
    11961195      ino = FormatTools.getIndex(readers[sno][fno], posZ[0], posC[0], posT[0]); 
    11971196    } 
  • trunk/loci/formats/in/FluoviewReader.java

    r4094 r4095  
    446446    String com = TiffTools.getComment(ifd); 
    447447    if (com == null) com = ""; 
     448    if (ifd == null) return false; 
    448449    return com.indexOf(FLUOVIEW_MAGIC_STRING) != -1 && 
    449450      ifd.containsKey(new Integer(MMHEADER)) || 
  • trunk/loci/formats/in/ZeissZVIReader.java

    r4074 r4095  
    7171  private float pixelSizeX, pixelSizeY, pixelSizeZ; 
    7272  private String microscopeName; 
    73   private Vector emWave, exWave, channelNames; 
     73  private Vector emWave, exWave; 
     74  private Hashtable channelNames; 
    7475  private Vector whiteValue, blackValue, gammaValue, exposureTime, timestamps; 
    7576  private String userName, userCompany, mag, na; 
     
    256257    emWave = new Vector(); 
    257258    exWave = new Vector(); 
    258     channelNames = new Vector(); 
     259    channelNames = new Hashtable(); 
    259260    whiteValue = new Vector(); 
    260261    blackValue = new Vector(); 
     
    417418    core.sizeT[0] = tIndices.size(); 
    418419 
    419     int min = Integer.MAX_VALUE; 
    420     int max = Integer.MIN_VALUE; 
    421     for (int i=0; i<cIndices.size(); i++) { 
    422       int v = ((Integer) cIndices.get(i)).intValue(); 
    423       if (v < min) min = v; 
    424       if (v > max) max = v; 
    425     } 
    426  
    427     int cSize = max - min + 1; 
    428     if (cSize > cIndices.size()) cSize = cIndices.size() - 1; 
    429  
    430     core.sizeC[0] *= cSize; 
     420    if (channelNames.size() > 0) core.sizeC[0] *= channelNames.size(); 
     421    else core.sizeC[0] *= cIndices.size(); 
    431422 
    432423    core.imageCount[0] = core.sizeZ[0] * core.sizeT[0] * 
     
    449440 
    450441      while (tileRows * tileColumns > totalTiles) { 
    451         //if (core.sizeC[0] > 1) core.sizeC[0]--; 
    452442        totalTiles = 
    453443          offsets.size() / (core.sizeZ[0] * core.sizeC[0] * core.sizeT[0]); 
     
    571561    } 
    572562 
    573     s = (String[]) channelNames.toArray(new String[0]); 
    574     channelNames.clear(); 
    575     for (int i=0; i<s.length; i++) { 
    576       if (!s[i].trim().equals("")) channelNames.add(s[i]); 
    577     } 
     563    String[] channelNumbers = 
     564      (String[]) channelNames.keySet().toArray(new String[0]); 
     565    Arrays.sort(channelNumbers); 
    578566 
    579567    for (int i=0; i<core.sizeC[0]; i++) { 
     
    594582        store.setLogicalChannelExWave(new Integer(ex), 0, idx); 
    595583      } 
    596       if (idx < channelNames.size()) { 
    597         store.setLogicalChannelName((String) channelNames.get(idx), 0, idx); 
     584      if (idx < channelNumbers.length) { 
     585        store.setLogicalChannelName( 
     586          (String) channelNames.get(channelNumbers[idx]), 0, idx); 
    598587      } 
    599588 
     
    936925      else if (key.startsWith("Channel Name")) { 
    937926        if (cIndex != -1) { 
    938           while (cIndex >= channelNames.size()) channelNames.add(""); 
    939           channelNames.setElementAt(value, cIndex); 
     927          channelNames.put(String.valueOf(cIndex), value); 
    940928        } 
    941929      } 
Note: See TracChangeset for help on using the changeset viewer.