Ignore:
Timestamp:
07/10/10 09:44:20 (10 years ago)
Author:
melissa
Message:

Fixed channel data is parsed from Leica LIF files that have had one or more channels removed after acquisition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/in/LeicaHandler.java

    r6663 r6687  
    104104  private Vector<Detector> detectors = new Vector<Detector>(); 
    105105  private Vector<Laser> lasers = new Vector<Laser>(); 
     106  private Hashtable<String, Channel> channels = 
     107    new Hashtable<String, Channel>(); 
    106108 
    107109  private MetadataLevel level; 
     
    208210          store.setDetectorSettingsID(id, numDatasets, c); 
    209211        } 
    210       } 
    211  
     212 
     213        String[] keys = channels.keySet().toArray(new String[0]); 
     214        Arrays.sort(keys); 
     215        for (int c=0; c<keys.length; c++) { 
     216          Channel ch = channels.get(keys[c]); 
     217          store.setDetectorSettingsID(ch.detector, numDatasets, c); 
     218          store.setChannelExcitationWavelength(ch.exWave, numDatasets, c); 
     219          store.setChannelName(ch.name, numDatasets, c); 
     220          store.setDetectorSettingsGain(ch.gain, numDatasets, c); 
     221        } 
     222      } 
     223 
     224      channels.clear(); 
    212225      xPos.clear(); 
    213226      yPos.clear(); 
     
    490503        } 
    491504        catch (NumberFormatException e) { } 
     505        Channel channel = channels.get(numDatasets + "-" + c); 
     506        if (channel == null) channel = new Channel(); 
    492507        if (id.endsWith("ExposureTime")) { 
    493508          store.setPlaneExposureTime(new Double(value), numDatasets, c); 
    494509        } 
    495510        else if (id.endsWith("Gain")) { 
    496           store.setDetectorSettingsGain(new Double(value), numDatasets, c); 
     511          channel.gain = new Double(value); 
    497512 
    498513          String detectorID = 
    499514            MetadataTools.createLSID("Detector", numDatasets, 0); 
    500  
    501           store.setDetectorSettingsID(detectorID, numDatasets, c); 
     515          channel.detector = detectorID; 
    502516          store.setDetectorID(detectorID, numDatasets, 0); 
    503517          store.setDetectorType(DetectorType.CCD, numDatasets, 0); 
    504518        } 
    505519        else if (id.endsWith("WaveLength")) { 
    506           store.setChannelExcitationWavelength( 
    507             new PositiveInteger(new Integer(value)), numDatasets, c); 
     520          channel.exWave = new PositiveInteger(new Integer(value)); 
    508521        } 
    509522        // NB: "UesrDefName" is not a typo. 
    510523        else if (id.endsWith("UesrDefName") && !value.equals("None")) { 
    511           store.setChannelName(value, numDatasets, c); 
    512         } 
     524          channel.name = value; 
     525        } 
     526        channels.put(numDatasets + "-" + c, channel); 
    513527      } 
    514528    } 
     
    862876      multiBands.add(m); 
    863877    } 
     878    else if (qName.equals("ChannelInfo")) { 
     879      int index = Integer.parseInt(attributes.getValue("Index")); 
     880      channels.remove(numDatasets + "-" + index); 
     881    } 
    864882    else count = 0; 
    865883    if (numDatasets == oldSeriesCount) storeSeriesHashtable(numDatasets, h); 
     
    10531071  } 
    10541072 
     1073  class Channel { 
     1074    public String detector; 
     1075    public Double gain; 
     1076    public PositiveInteger exWave; 
     1077    public String name; 
     1078  } 
     1079 
    10551080} 
Note: See TracChangeset for help on using the changeset viewer.