Changeset 6969


Ignore:
Timestamp:
09/21/10 10:52:36 (9 years ago)
Author:
melissa
Message:

Scan TiffData elements for 1-indexed indices before assembling list of planes.

File:
1 edited

Legend:

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

    r6952 r6969  
    400400 
    401401      int tiffDataCount = meta.getTiffDataCount(i); 
     402      boolean zOneIndexed = false; 
     403      boolean cOneIndexed = false; 
     404      boolean tOneIndexed = false; 
     405 
     406      // pre-scan TiffData indices to see if any of them are indexed from 1 
     407 
     408      for (int td=0; td<tiffDataCount; td++) { 
     409        NonNegativeInteger firstC = meta.getTiffDataFirstC(i, td); 
     410        NonNegativeInteger firstT = meta.getTiffDataFirstT(i, td); 
     411        NonNegativeInteger firstZ = meta.getTiffDataFirstZ(i, td); 
     412        int c = firstC == null ? 0 : firstC.getValue(); 
     413        int t = firstT == null ? 0 : firstT.getValue(); 
     414        int z = firstZ == null ? 0 : firstZ.getValue(); 
     415 
     416        if (c >= effSizeC) cOneIndexed = true; 
     417        if (z >= sizeZ) zOneIndexed = true; 
     418        if (t >= sizeT) tOneIndexed = true; 
     419      } 
     420 
    402421      for (int td=0; td<tiffDataCount; td++) { 
    403422        LOGGER.debug("    TiffData[{}] {", td); 
     
    426445 
    427446        // NB: some writers index FirstC, FirstZ and FirstT from 1 
    428         if (c >= effSizeC) c--; 
    429         if (z >= sizeZ) z--; 
    430         if (t >= sizeT) t--; 
     447        if (cOneIndexed) c--; 
     448        if (zOneIndexed) z--; 
     449        if (tOneIndexed) t--; 
    431450 
    432451        int index = FormatTools.getIndex(order, 
Note: See TracChangeset for help on using the changeset viewer.