Changeset 6687 for branches/4.1


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.1/components/bio-formats/src/loci/formats/in/LeicaHandler.java

    r6111 r6687  
    8787  private Vector<Detector> detectors = new Vector<Detector>(); 
    8888  private Vector<Laser> lasers = new Vector<Laser>(); 
     89  private Hashtable<String, Channel> channels = 
     90    new Hashtable<String, Channel>(); 
    8991 
    9092  // -- Constructor -- 
     
    186188      } 
    187189 
     190      String[] keys = channels.keySet().toArray(new String[0]); 
     191      Arrays.sort(keys); 
     192      for (int c=0; c<keys.length; c++) { 
     193        Channel ch = channels.get(keys[c]); 
     194        store.setDetectorSettingsDetector(ch.detector, numDatasets, c); 
     195        store.setLogicalChannelExWave(ch.exWave, numDatasets, c); 
     196        store.setLogicalChannelName(ch.name, numDatasets, c); 
     197        store.setDetectorSettingsGain(ch.gain, numDatasets, c); 
     198      } 
     199 
     200      channels.clear(); 
    188201      xPos.clear(); 
    189202      yPos.clear(); 
     
    450463        } 
    451464        catch (NumberFormatException e) { } 
     465        Channel channel = channels.get(numDatasets + "-" + c); 
     466        if (channel == null) channel = new Channel(); 
    452467        if (id.endsWith("ExposureTime")) { 
    453468          store.setPlaneTimingExposureTime(new Float(value), 
     
    455470        } 
    456471        else if (id.endsWith("Gain")) { 
    457           store.setDetectorSettingsGain(new Float(value), numDatasets, c); 
     472          channel.gain = new Float(value); 
    458473 
    459474          String detectorID = 
    460475            MetadataTools.createLSID("Detector", numDatasets, 0); 
    461476 
    462           store.setDetectorSettingsDetector(detectorID, numDatasets, c); 
     477          channel.detector = detectorID; 
    463478          store.setDetectorID(detectorID, numDatasets, 0); 
    464479          store.setDetectorType("CCD", numDatasets, 0); 
    465480        } 
    466481        else if (id.endsWith("WaveLength")) { 
    467           store.setLogicalChannelExWave(new Integer(value), numDatasets, c); 
     482          channel.exWave = new Integer(value); 
    468483        } 
    469484        // NB: "UesrDefName" is not a typo. 
    470485        else if (id.endsWith("UesrDefName") && !value.equals("None")) { 
    471           store.setLogicalChannelName(value, numDatasets, c); 
    472         } 
     486          channel.name = value; 
     487        } 
     488        channels.put(numDatasets + "-" + c, channel); 
    473489      } 
    474490    } 
     
    775791      multiBands.add(m); 
    776792    } 
     793    else if (qName.equals("ChannelInfo")) { 
     794      int index = Integer.parseInt(attributes.getValue("Index")); 
     795      channels.remove(numDatasets + "-" + index); 
     796    } 
    777797    else count = 0; 
    778798    storeSeriesHashtable(numDatasets, h); 
     
    964984  } 
    965985 
     986  class Channel { 
     987    public String detector; 
     988    public Float gain; 
     989    public Integer exWave; 
     990    public String name; 
     991  } 
     992 
    966993} 
Note: See TracChangeset for help on using the changeset viewer.