Changeset 7442


Ignore:
Timestamp:
12/17/10 17:15:35 (9 years ago)
Author:
melissa
Message:

Populate channel colors even if the MetadataLevel is set to MINIMUM.

This prevents a NPE when calling get8BitLookupTable() and get16BitLookupTable() when the MetadataLevel is MINIMUM.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/NativeND2Reader.java

    r7144 r7442  
    884884    } 
    885885 
     886    colors = new int[getEffectiveSizeC()]; 
     887 
     888    ArrayList<String> channelNames = null; 
     889    if (handler != null) { 
     890      channelNames = handler.getChannelNames(); 
     891      for (int i=0; i<getSeriesCount(); i++) { 
     892        for (int c=0; c<getEffectiveSizeC(); c++) { 
     893          int index = i * getSizeC() + c; 
     894          if (index < channelNames.size()) { 
     895            String channelName = channelNames.get(index); 
     896            Integer channelColor = channelColors.get(channelName); 
     897            colors[c] = channelColor == null ? 0 : channelColor.intValue(); 
     898          } 
     899        } 
     900      } 
     901    } 
     902 
    886903    if (getMetadataOptions().getMetadataLevel() == MetadataLevel.MINIMUM) { 
    887904      return; 
     
    972989    store.setDetectorType(getDetectorType("Other"), 0, 0); 
    973990 
    974     ArrayList<String> channelNames = handler.getChannelNames(); 
    975991    ArrayList<String> modality = handler.getModalities(); 
    976992    ArrayList<String> binning = handler.getBinnings(); 
     
    983999    ArrayList<Hashtable<String, String>> rois = handler.getROIs(); 
    9841000 
    985     colors = new int[getEffectiveSizeC()]; 
    986  
    9871001    for (int i=0; i<getSeriesCount(); i++) { 
    9881002      for (int c=0; c<getEffectiveSizeC(); c++) { 
     
    9951009          String channelName = channelNames.get(index); 
    9961010          store.setChannelName(channelName, i, c); 
    997  
    998           Integer channelColor = channelColors.get(channelName); 
    999           colors[c] = channelColor == null ? 0 : channelColor.intValue(); 
    10001011        } 
    10011012        if (index < modality.size()) { 
Note: See TracChangeset for help on using the changeset viewer.