Changeset 5658


Ignore:
Timestamp:
11/02/09 11:40:44 (10 years ago)
Author:
melissa
Message:

Sequential Leica LIFs now populate DetectorSettings and LogicalChannel.SecondaryEmissionFilter.

File:
1 edited

Legend:

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

    r5624 r5658  
    6666  private MetadataStore store; 
    6767 
    68   private int channel = 0; 
    69   private int nextLaser, nextChannel, nextDetector = -1; 
     68  private int nextChannel = 0; 
    7069  private Double zoom, pinhole; 
    7170  private Vector<Integer> detectorIndices; 
     
    7574  private ROI roi; 
    7675  private boolean alternateCenter = false; 
     76 
     77  private boolean linkedInstruments = false; 
     78  private int detectorChannel = 0; 
    7779 
    7880  private Vector<CoreMetadata> core; 
     
    179181        int index = c < detectorIndices.size() ? 
    180182          detectorIndices.get(c).intValue() : detectorIndices.size() - 1; 
    181         if (index < 0 || index >= nChannels || index > nextDetector) break; 
     183        if (index < 0 || index >= nChannels || index >= 0) break; 
    182184        String id = MetadataTools.createLSID("Detector", numDatasets, index); 
    183185        store.setDetectorSettingsDetector(id, numDatasets, c); 
     
    191193    else if (qName.equals("Element")) { 
    192194      multiBands.clear(); 
    193       nextLaser = 0; 
    194       nextDetector = -1; 
    195195      nextROI = 0; 
    196196 
     
    199199      for (int c=0; c<detectorIndices.size(); c++) { 
    200200        int index = detectorIndices.get(c).intValue(); 
    201         if (c >= nChannels || index >= nChannels || index > nextDetector) break; 
     201        if (c >= nChannels || index >= nChannels || index >= 0) break; 
    202202        String id = MetadataTools.createLSID("Detector", numDatasets, index); 
    203203        store.setDetectorSettingsDetector(id, numDatasets, index); 
     
    212212    else if (qName.equals("FilterSetting")) { 
    213213      nextChannel = 0; 
    214       nextFilter = 0; 
    215214    } 
    216215    else if (qName.equals("LDM_Block_Sequential_Master")) { 
     
    235234      canParse = false; 
    236235    } 
     236    else if (qName.startsWith("LDM")) { 
     237      linkedInstruments = true; 
     238    } 
    237239 
    238240    if (!canParse) return; 
     
    271273    } 
    272274    else if (qName.equals("Image")) { 
     275      if (!linkedInstruments) { 
     276        for (Detector d : detectors) { 
     277          if (detectorChannel < numChannels) { 
     278            String id = MetadataTools.createLSID( 
     279              "Detector", numDatasets, detectorChannel); 
     280            store.setDetectorID(id, numDatasets, detectorChannel); 
     281            store.setDetectorType(d.type, numDatasets, detectorChannel); 
     282            store.setDetectorModel(d.model, numDatasets, detectorChannel); 
     283            store.setDetectorZoom(d.zoom, numDatasets, detectorChannel); 
     284            store.setDetectorOffset(d.offset, numDatasets, detectorChannel); 
     285            store.setDetectorVoltage(d.voltage, numDatasets, detectorChannel); 
     286 
     287            if (d.active) { 
     288              store.setDetectorSettingsOffset(d.offset, numDatasets, 
     289                detectorChannel); 
     290              store.setDetectorSettingsDetector( 
     291                id, numDatasets, detectorChannel); 
     292            } 
     293 
     294            detectorChannel++; 
     295          } 
     296        } 
     297 
     298        for (int i=0; i<nextFilter; i++) { 
     299          String id = MetadataTools.createLSID("Filter", numDatasets, i); 
     300          if (i < numChannels) { 
     301            store.setLogicalChannelSecondaryEmissionFilter( 
     302              id, numDatasets, i); 
     303          } 
     304        } 
     305      } 
     306 
    273307      core.add(new CoreMetadata()); 
    274308      numDatasets++; 
     309      linkedInstruments = false; 
     310      detectorChannel = 0; 
    275311      detectors.clear(); 
    276312      lasers.clear(); 
     
    282318      store.setInstrumentID(instrumentID, numDatasets); 
    283319      store.setImageInstrumentRef(instrumentID, numDatasets); 
    284       channel = 0; 
    285320      numChannels = 0; 
    286321      extras = 1; 
     
    520555        Double posX = new Double(variant); 
    521556        for (int image=0; image<nPlanes; image++) { 
    522           int index = image * (coreMeta.rgb ? 1 : coreMeta.sizeC) + channel; 
     557          int index = image * (coreMeta.rgb ? 1 : coreMeta.sizeC); 
    523558          if (index >= nPlanes) continue; 
    524559          store.setStagePositionPositionX(posX, numDatasets, 0, index); 
     
    531566        Double posY = new Double(variant); 
    532567        for (int image=0; image<nPlanes; image++) { 
    533           int index = image * (coreMeta.rgb ? 1 : coreMeta.sizeC) + channel; 
     568          int index = image * (coreMeta.rgb ? 1 : coreMeta.sizeC); 
    534569          if (index >= nPlanes) continue; 
    535570          store.setStagePositionPositionY(posY, numDatasets, 0, index); 
     
    542577        Double posZ = new Double(variant); 
    543578        for (int image=0; image<nPlanes; image++) { 
    544           int index = image * (coreMeta.rgb ? 1 : coreMeta.sizeC) + channel; 
     579          int index = image * (coreMeta.rgb ? 1 : coreMeta.sizeC); 
    545580          if (index >= nPlanes) continue; 
    546581          store.setStagePositionPositionZ(posZ, numDatasets, 0, index); 
Note: See TracChangeset for help on using the changeset viewer.