Changeset 5491


Ignore:
Timestamp:
09/21/09 17:16:15 (10 years ago)
Author:
melissa
Message:

Fixed LogicalChannel, Detector, and Filter population.

File:
1 edited

Legend:

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

    r5473 r5491  
    113113 
    114114  private String pixelSizeX, pixelSizeY; 
    115   private Vector<String> channelNames, illuminations, dyeNames; 
    116   private Vector<Integer> emWaves, exWaves, wavelengths; 
    117   private String gain, offset, voltage, pinholeSize; 
     115  private Vector<String> illuminations; 
     116  private Vector<Integer> wavelengths; 
     117  private String pinholeSize; 
    118118  private String magnification, lensNA, objectiveName, workingDistance; 
    119119  private String creationDate; 
     120 
     121  private Vector<ChannelData> channels; 
    120122 
    121123  private POITools poi; 
     
    268270      poi = null; 
    269271      lastChannel = 0; 
    270       dyeNames = null; 
    271272      wavelengths = null; 
    272273      illuminations = null; 
     
    275276      imageDepth = 0; 
    276277      pixelSizeX = pixelSizeY = null; 
    277       channelNames = null; 
    278       emWaves = exWaves = null; 
    279       gain = offset = voltage = pinholeSize = null; 
     278      pinholeSize = null; 
    280279      magnification = lensNA = objectiveName = workingDistance = null; 
    281280      creationDate = null; 
    282281      lut = null; 
     282      channels = null; 
    283283    } 
    284284  } 
     
    304304    boolean mappedOIF = !isOIB && !new File(id).getAbsoluteFile().exists(); 
    305305 
    306     channelNames = new Vector<String>(); 
    307     emWaves = new Vector<Integer>(); 
    308     exWaves = new Vector<Integer>(); 
    309     dyeNames = new Vector<String>(); 
    310306    wavelengths = new Vector<Integer>(); 
    311307    illuminations = new Vector<String>(); 
     308    channels = new Vector<ChannelData>(); 
    312309 
    313310    String key = null, value = null, oifName = null; 
     
    531528          pixelSizeY = value; 
    532529        } 
     530        else if (prefix.startsWith("[GUI Channel")) { 
     531          int lastSpace = prefix.lastIndexOf(" ", prefix.indexOf("]")); 
     532          int nextToLastSpace = prefix.lastIndexOf(" ", lastSpace - 1) + 1; 
     533          int index = 
     534            Integer.parseInt(prefix.substring(nextToLastSpace, lastSpace)); 
     535          ChannelData channel = null; 
     536          if (index > channels.size()) { 
     537            channel = new ChannelData(); 
     538          } 
     539          else channel = channels.get(index - 1); 
     540 
     541          if (key.equals("AnalogPMTGain")) channel.gain = new Float(value); 
     542          else if (key.equals("AnalogPMTVoltage")) { 
     543            channel.voltage = new Float(value); 
     544          } 
     545          else if (key.equals("CH Activate")) { 
     546            channel.active = Integer.parseInt(value) != 0; 
     547          } 
     548          else if (key.equals("CH Name")) channel.name = value; 
     549          else if (key.equals("DyeName")) channel.dyeName = value; 
     550          else if (key.equals("EmissionDM Name")) { 
     551            channel.emissionFilter = value; 
     552          } 
     553          else if (key.equals("EmissionWavelength")) { 
     554            channel.emWave = new Integer(value); 
     555          } 
     556          else if (key.equals("ExcitationDM Name")) { 
     557            channel.excitationFilter = value; 
     558          } 
     559          else if (key.equals("ExcitationWavelength")) { 
     560            channel.exWave = new Integer(value); 
     561          } 
     562          if (index > channels.size()) channels.add(channel); 
     563        } 
    533564        else if (prefix.indexOf("[Channel ") != -1 && 
    534565          prefix.indexOf("Parameters] - ") != -1) 
    535566        { 
    536           if (key.equals("CH Name")) channelNames.add(value); 
    537           else if (key.equals("DyeName")) dyeNames.add(value); 
    538           else if (key.equals("EmissionWavelength")) { 
    539             emWaves.add(new Integer(value)); 
    540           } 
    541           else if (key.equals("ExcitationWavelength")) { 
    542             exWaves.add(new Integer(value)); 
    543           } 
    544           else if (key.equals("LightType")) { 
     567          if (key.equals("LightType")) { 
    545568            String illumination = value.toLowerCase(); 
    546569            if (illumination.indexOf("fluorescence") != -1) { 
     
    759782          addGlobalMeta("Image " + ii + " : " + key, value); 
    760783 
    761           if (key.equals("AnalogPMTGain") || key.equals("CountingPMTGain")) { 
    762             gain = value; 
    763           } 
    764           else if (key.equals("AnalogPMTOffset") || 
    765             key.equals("CountingPMTOffset")) 
    766           { 
    767             offset = value; 
    768           } 
    769           else if (key.equals("Magnification")) { 
     784          if (key.equals("Magnification")) { 
    770785            magnification = value; 
    771786          } 
     
    778793          else if (key.equals("ObjectiveLens WDValue")) { 
    779794            workingDistance = value; 
    780           } 
    781           else if (key.equals("PMTVoltage")) { 
    782             voltage = value; 
    783795          } 
    784796          else if (key.equals("PinholeDiameter")) { 
     
    982994 
    983995      for (int c=0; c<core[i].sizeC; c++) { 
    984         if (c < channelNames.size()) { 
    985           store.setLogicalChannelName(channelNames.get(c), i, c); 
    986         } 
    987         if (c < emWaves.size()) { 
    988           store.setLogicalChannelEmWave(emWaves.get(c), i, c); 
    989         } 
    990         if (c < exWaves.size()) { 
    991           store.setLogicalChannelExWave(exWaves.get(c), i, c); 
    992         } 
    993996        if (c < illuminations.size()) { 
    994997          store.setLogicalChannelIlluminationType(illuminations.get(c), i, c); 
     
    9971000    } 
    9981001 
    999     // populate Laser data 
    1000  
    1001     int nLasers = (int) Math.min(dyeNames.size(), wavelengths.size()); 
    1002     for (int i=0; i<nLasers; i++) { 
    1003       // link LightSource to Image 
    1004       String lightSourceID = MetadataTools.createLSID("LightSource", 0, i); 
    1005       store.setLightSourceID(lightSourceID, 0, i); 
    1006       store.setLightSourceSettingsLightSource(lightSourceID, 0, i); 
    1007       if (i < exWaves.size()) { 
    1008         store.setLightSourceSettingsWavelength(exWaves.get(i), 0, i); 
    1009       } 
    1010       store.setLaserLaserMedium(dyeNames.get(i), 0, i); 
    1011       store.setLaserWavelength(wavelengths.get(i), 0, i); 
    1012     } 
    1013  
    1014     // populate Detector data 
    1015  
    1016     if (gain != null) store.setDetectorGain(new Float(gain), 0, 0); 
    1017     if (offset != null) store.setDetectorOffset(new Float(offset), 0, 0); 
    1018     if (voltage != null) store.setDetectorVoltage(new Float(voltage), 0, 0); 
    1019     store.setDetectorType("Unknown", 0, 0); 
    1020  
    1021     // link Detector to Image using DetectorSettings 
    1022     String detectorID = MetadataTools.createLSID("Detector", 0, 0); 
    1023     store.setDetectorID(detectorID, 0, 0); 
    1024     store.setDetectorSettingsDetector(detectorID, 0, 0); 
     1002    int channelIndex = 0; 
     1003    for (int c=0; c<channels.size(); c++) { 
     1004      ChannelData channel = channels.get(c); 
     1005      if (!channel.active) continue; 
     1006      if (channelIndex >= getEffectiveSizeC()) break; 
     1007 
     1008      // populate Detector data 
     1009      String detectorID = MetadataTools.createLSID("Detector", 0, channelIndex); 
     1010      store.setDetectorID(detectorID, 0, channelIndex); 
     1011      store.setDetectorSettingsDetector(detectorID, 0, channelIndex); 
     1012 
     1013      store.setDetectorGain(channel.gain, 0, channelIndex); 
     1014      store.setDetectorVoltage(channel.voltage, 0, channelIndex); 
     1015      store.setDetectorType("Unknown", 0, channelIndex); 
     1016 
     1017      // populate LogicalChannel data 
     1018      String filterSet = MetadataTools.createLSID("FilterSet", 0, channelIndex); 
     1019 
     1020      store.setLogicalChannelName(channel.name, 0, channelIndex); 
     1021      store.setLogicalChannelEmWave(channel.emWave, 0, channelIndex); 
     1022      store.setLogicalChannelExWave(channel.exWave, 0, channelIndex); 
     1023      store.setLogicalChannelFilterSet(filterSet, 0, channelIndex); 
     1024 
     1025      String lightSourceID = 
     1026        MetadataTools.createLSID("LightSource", 0, channelIndex); 
     1027      store.setLightSourceSettingsLightSource(lightSourceID, 0, channelIndex); 
     1028      store.setLightSourceSettingsWavelength(channel.exWave, 0, channelIndex); 
     1029 
     1030      // populate FilterSet data 
     1031      int emIndex = channelIndex * 2; 
     1032      int exIndex = channelIndex * 2 + 1; 
     1033      String emFilter = MetadataTools.createLSID("Filter", 0, emIndex); 
     1034      String exFilter = MetadataTools.createLSID("Filter", 0, exIndex); 
     1035 
     1036      store.setFilterSetID(filterSet, 0, channelIndex); 
     1037      store.setFilterSetEmFilter(emFilter, 0, channelIndex); 
     1038      store.setFilterSetExFilter(exFilter, 0, channelIndex); 
     1039 
     1040      // populate Filter data 
     1041      String[] emTokens = channel.emissionFilter.split("/"); 
     1042      String[] exTokens = channel.excitationFilter.split("/"); 
     1043 
     1044      store.setFilterID(emFilter, 0, emIndex); 
     1045      store.setFilterModel(emTokens[0], 0, emIndex); 
     1046      store.setFilterType("Unknown", 0, emIndex); 
     1047      if (emTokens.length >= 3) { 
     1048        String[] range = emTokens[2].split("-"); 
     1049        store.setTransmittanceRangeCutIn(new Integer(range[0]), 0, emIndex); 
     1050        if (range.length > 1) { 
     1051          store.setTransmittanceRangeCutOut(new Integer(range[1]), 0, emIndex); 
     1052        } 
     1053      } 
     1054 
     1055      store.setFilterID(exFilter, 0, exIndex); 
     1056      store.setFilterModel(exTokens[0], 0, exIndex); 
     1057      store.setFilterType("Unknown", 0, exIndex); 
     1058      if (exTokens.length >= 3) { 
     1059        String[] range = exTokens[2].split("-"); 
     1060        store.setTransmittanceRangeCutIn(new Integer(range[0]), 0, exIndex); 
     1061        if (range.length > 1) { 
     1062          store.setTransmittanceRangeCutOut(new Integer(range[1]), 0, exIndex); 
     1063        } 
     1064      } 
     1065 
     1066      // populate Laser data 
     1067      store.setLightSourceID(lightSourceID, 0, channelIndex); 
     1068      store.setLaserLaserMedium(channel.dyeName, 0, channelIndex); 
     1069      if (channelIndex < wavelengths.size()) { 
     1070        store.setLaserWavelength( 
     1071          wavelengths.get(channelIndex), 0, channelIndex); 
     1072      } 
     1073 
     1074      channelIndex++; 
     1075    } 
    10251076 
    10261077    // populate Objective data 
     
    13401391  } 
    13411392 
     1393  // -- Helper classes -- 
     1394 
     1395  class ChannelData { 
     1396    public boolean active; 
     1397    public Float gain; 
     1398    public Float voltage; 
     1399    public String name; 
     1400    public String emissionFilter; 
     1401    public String excitationFilter; 
     1402    public Integer emWave; 
     1403    public Integer exWave; 
     1404    public String dyeName; 
     1405  } 
     1406 
    13421407} 
Note: See TracChangeset for help on using the changeset viewer.