Changeset 7039


Ignore:
Timestamp:
10/06/10 16:59:39 (9 years ago)
Author:
melissa
Message:

Several metadata population fixes.

Files:
2 edited

Legend:

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

    r7007 r7039  
    104104  private int nextEmWave = 0, nextExWave = 0, nextChName = 0; 
    105105  private double stageX = 0, stageY = 0; 
     106  private int timepoint = 0; 
    106107 
    107108  private int[] channelColors; 
     
    120121  private Hashtable<Integer, String> channelName = 
    121122    new Hashtable<Integer, String>(); 
    122   private double physicalSizeX, physicalSizeY, physicalSizeZ; 
     123  private Double physicalSizeX, physicalSizeY, physicalSizeZ; 
    123124  private String imageDescription; 
    124125 
     
    437438      exWavelength.clear(); 
    438439      channelName.clear(); 
    439       physicalSizeX = physicalSizeY = physicalSizeZ = 0d; 
     440      physicalSizeX = physicalSizeY = physicalSizeZ = null; 
    440441      imageDescription = null; 
     442      timepoint = 0; 
    441443    } 
    442444  } 
     
    724726        int[] zct = getZCTCoords(plane); 
    725727        String exposure = exposureTime.get(new Integer(zct[1])); 
     728        if (exposure == null && exposureTime.size() == 1) { 
     729          exposure = exposureTime.get(exposureTime.keys().nextElement()); 
     730        } 
    726731        Double exp = new Double(0.0); 
    727732        try { exp = new Double(exposure); } 
     
    747752        store.setDetectorSettingsID(detectorID, 0, i); 
    748753        store.setDetectorType(getDetectorType("Other"), 0, i); 
     754 
    749755        store.setDetectorSettingsGain(detectorGain.get(i), 0, i); 
    750756        store.setDetectorSettingsOffset(detectorOffset.get(i), 0, i); 
     
    899905          } 
    900906        } 
    901         else if (key.startsWith("Scale Factor for X")) { 
     907        else if (key.startsWith("Scale Factor for X") && physicalSizeX == null) 
     908        { 
    902909          physicalSizeX = Double.parseDouble(value); 
    903910        } 
    904         else if (key.startsWith("Scale Factor for Y")) { 
     911        else if (key.startsWith("Scale Factor for Y") && physicalSizeY == null) 
     912        { 
    905913          physicalSizeY = Double.parseDouble(value); 
    906914        } 
    907         else if (key.startsWith("Scale Factor for Z")) { 
     915        else if (key.startsWith("Scale Factor for Z") && physicalSizeZ == null) 
     916        { 
    908917          physicalSizeZ = Double.parseDouble(value); 
    909918        } 
    910919        else if (key.startsWith("Emission Wavelength")) { 
    911           if (cIndex != -1 && nextEmWave < effectiveSizeC) { 
     920          if (cIndex != -1 && nextEmWave <= effectiveSizeC) { 
    912921            Integer wave = new Integer(value); 
    913922            if (wave.intValue() > 0) { 
     
    917926        } 
    918927        else if (key.startsWith("Excitation Wavelength")) { 
    919           if (cIndex != -1 && nextExWave < effectiveSizeC) { 
     928          if (cIndex != -1 && nextExWave <= effectiveSizeC) { 
    920929            Integer wave = new Integer(value); 
    921930            if (wave.intValue() > 0) { 
     
    925934        } 
    926935        else if (key.startsWith("Channel Name")) { 
    927           if (cIndex != -1 && nextChName < effectiveSizeC) { 
     936          if (cIndex != -1 && nextChName <= effectiveSizeC) { 
    928937            channelName.put(nextChName++, value); 
    929938          } 
    930939        } 
    931940        else if (key.startsWith("Exposure Time [ms]")) { 
    932           if (cIndex != -1) { 
     941          if (exposureTime.get(new Integer(cIndex)) == null) { 
    933942            double exp = Double.parseDouble(value) / 1000; 
    934943            exposureTime.put(new Integer(cIndex), String.valueOf(exp)); 
     
    10051014        } 
    10061015        else if (key.startsWith("Acquisition Date")) { 
    1007           if (image >= 0) { 
    1008             timestamps.put(new Integer(image), value); 
    1009             addGlobalMeta("Timestamp " + image, value); 
     1016          if (timepoint > 0) { 
     1017            timestamps.put(new Integer(timepoint - 1), value); 
     1018            addGlobalMeta("Timestamp " + timepoint, value); 
    10101019          } 
     1020          timepoint++; 
    10111021        } 
    10121022      } 
  • trunk/components/bio-formats/src/loci/formats/in/ZeissZVIReader.java

    r6881 r7039  
    104104  private int nextEmWave = 0, nextExWave = 0, nextChName = 0; 
    105105  private double stageX = 0, stageY = 0; 
     106  private int timepoint = 0; 
    106107 
    107108  private int[] channelColors; 
     
    120121  private Hashtable<Integer, String> channelName = 
    121122    new Hashtable<Integer, String>(); 
    122   private double physicalSizeX, physicalSizeY, physicalSizeZ; 
     123  private Double physicalSizeX, physicalSizeY, physicalSizeZ; 
    123124  private String imageDescription; 
    124125 
     
    437438      exWavelength.clear(); 
    438439      channelName.clear(); 
    439       physicalSizeX = physicalSizeY = physicalSizeZ = 0d; 
     440      physicalSizeX = physicalSizeY = physicalSizeZ = null; 
    440441      imageDescription = null; 
     442      timepoint = 0; 
    441443    } 
    442444  } 
     
    724726        int[] zct = getZCTCoords(plane); 
    725727        String exposure = exposureTime.get(new Integer(zct[1])); 
     728        if (exposure == null && exposureTime.size() == 1) { 
     729          exposure = exposureTime.get(exposureTime.keys().nextElement()); 
     730        } 
    726731        Double exp = new Double(0.0); 
    727732        try { exp = new Double(exposure); } 
     
    747752        store.setDetectorSettingsID(detectorID, 0, i); 
    748753        store.setDetectorType(getDetectorType("Other"), 0, i); 
     754 
    749755        store.setDetectorSettingsGain(detectorGain.get(i), 0, i); 
    750756        store.setDetectorSettingsOffset(detectorOffset.get(i), 0, i); 
     
    899905          } 
    900906        } 
    901         else if (key.startsWith("Scale Factor for X")) { 
     907        else if (key.startsWith("Scale Factor for X") && physicalSizeX == null) 
     908        { 
    902909          physicalSizeX = Double.parseDouble(value); 
    903910        } 
    904         else if (key.startsWith("Scale Factor for Y")) { 
     911        else if (key.startsWith("Scale Factor for Y") && physicalSizeY == null) 
     912        { 
    905913          physicalSizeY = Double.parseDouble(value); 
    906914        } 
    907         else if (key.startsWith("Scale Factor for Z")) { 
     915        else if (key.startsWith("Scale Factor for Z") && physicalSizeZ == null) 
     916        { 
    908917          physicalSizeZ = Double.parseDouble(value); 
    909918        } 
    910919        else if (key.startsWith("Emission Wavelength")) { 
    911           if (cIndex != -1 && nextEmWave < effectiveSizeC) { 
     920          if (cIndex != -1 && nextEmWave <= effectiveSizeC) { 
    912921            Integer wave = new Integer(value); 
    913922            if (wave.intValue() > 0) { 
     
    917926        } 
    918927        else if (key.startsWith("Excitation Wavelength")) { 
    919           if (cIndex != -1 && nextExWave < effectiveSizeC) { 
     928          if (cIndex != -1 && nextExWave <= effectiveSizeC) { 
    920929            Integer wave = new Integer(value); 
    921930            if (wave.intValue() > 0) { 
     
    925934        } 
    926935        else if (key.startsWith("Channel Name")) { 
    927           if (cIndex != -1 && nextChName < effectiveSizeC) { 
     936          if (cIndex != -1 && nextChName <= effectiveSizeC) { 
    928937            channelName.put(nextChName++, value); 
    929938          } 
    930939        } 
    931940        else if (key.startsWith("Exposure Time [ms]")) { 
    932           if (cIndex != -1) { 
     941          if (exposureTime.get(new Integer(cIndex)) == null) { 
    933942            double exp = Double.parseDouble(value) / 1000; 
    934943            exposureTime.put(new Integer(cIndex), String.valueOf(exp)); 
     
    10051014        } 
    10061015        else if (key.startsWith("Acquisition Date")) { 
    1007           if (image >= 0) { 
    1008             timestamps.put(new Integer(image), value); 
    1009             addGlobalMeta("Timestamp " + image, value); 
     1016          if (timepoint > 0) { 
     1017            timestamps.put(new Integer(timepoint - 1), value); 
     1018            addGlobalMeta("Timestamp " + timepoint, value); 
    10101019          } 
     1020          timepoint++; 
    10111021        } 
    10121022      } 
Note: See TracChangeset for help on using the changeset viewer.