Changeset 4771


Ignore:
Timestamp:
02/02/09 12:19:06 (11 years ago)
Author:
melissa
Message:

Fixed how exposure times and ND filter settings are parsed from Deltavision files.

File:
1 edited

Legend:

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

    r4752 r4771  
    7979  protected DVExtHdrFields[][][] extHdrFields = null; 
    8080 
     81  private Float[] ndFilters; 
     82 
    8183  // -- Constructor -- 
    8284 
     
    331333    title = title.length() == 0 ? null : title; 
    332334    store.setImageDescription(title, 0); 
     335 
     336    ndFilters = new Float[getSizeC()]; 
    333337 
    334338    // if matching log file exists, extract key/value pairs from it 
     
    353357      } 
    354358      store.setPlaneTimingExposureTime( 
    355         new Float(extHdrFields[z][w][t].getExpTime() / 1000), 0, 0, i); 
     359        new Float(extHdrFields[z][w][t].getExpTime()), 0, 0, i); 
    356360 
    357361      // stage position 
     
    369373      store.setLogicalChannelEmWave(new Integer(waves[w]), 0, w); 
    370374      store.setLogicalChannelExWave( 
    371         new Integer((int) extHdrFields[0][w][0].getExFilter()), 0, w); 
    372       if (!logFound) { 
    373         store.setLogicalChannelNdFilter( 
    374           new Float(extHdrFields[0][w][0].getNdFilter()), 0, w); 
    375       } 
     375        new Integer((int) extHdrFields[0][w][0].getExWavelen()), 0, w); 
     376      if (ndFilters[w] == null) { 
     377        ndFilters[w] = new Float(extHdrFields[0][w][0].getNdFilter()); 
     378      } 
     379      store.setLogicalChannelNdFilter(ndFilters[w], 0, w); 
    376380    } 
    377381 
     
    537541        else if (key.equals("ND filter")) { 
    538542          try { 
    539             Float nd = new Float(value); 
     543            float nd = Float.parseFloat(value.replaceAll("%", "")); 
     544            nd = (float) Math.pow(10, -1 * nd); 
    540545            int cIndex = getZCTCoords(currentImage)[1]; 
    541             store.setLogicalChannelNdFilter(nd, 0, cIndex); 
     546            ndFilters[cIndex] = new Float(nd); 
    542547          } 
    543548          catch (NumberFormatException exc) { } 
     
    772777    protected DVExtHdrFields(RandomAccessStream in) { 
    773778      try { 
     779        // NB: this is consistent with the Deltavision Opener plugin 
     780        // for ImageJ (http://rsb.info.nih.gov/ij/plugins/track/delta.html) 
    774781        photosensorReading = in.readFloat(); 
    775782        timeStampSeconds = in.readFloat(); 
     
    779786        minInten = in.readFloat(); 
    780787        maxInten = in.readFloat(); 
     788        in.skipBytes(4); 
    781789        expTime = in.readFloat(); 
    782         in.skipBytes(4); 
    783  
    784         // DV files store the ND (neutral density) Filter 
    785         // (normally expressed as a %T (transmittance)) as an OD 
    786         // (optical density) rating. 
    787         // To convert from one to the other the formula is %T = 10^(-OD) X 100. 
    788         ndFilter = (float) Math.pow(10.0, -1 * in.readFloat()); 
    789         exFilter = in.readFloat(); 
    790         emFilter = in.readFloat(); 
     790 
     791        ndFilter = in.readFloat(); 
    791792        exWavelen = in.readFloat(); 
    792793        emWavelen = in.readFloat(); 
     
    810811    public float getExpTime() { return expTime; } 
    811812    public float getNdFilter() { return ndFilter; } 
    812     public float getExFilter() { return exFilter; } 
    813     public float getEmFilter() { return emFilter; } 
    814813    public float getExWavelen() { return exWavelen; } 
    815814    public float getEmWavelen() { return emWavelen; } 
Note: See TracChangeset for help on using the changeset viewer.