Ignore:
Timestamp:
09/28/10 11:03:11 (10 years ago)
Author:
melissa
Message:

Merged new readers into 4.2: r6758, r6783, r6790, r6797, r6801, r6845.

Location:
branches/4.2
Files:
3 edited
5 copied

Legend:

Unmodified
Added
Removed
  • branches/4.2

  • branches/4.2/components/bio-formats/src/loci/formats/in

  • branches/4.2/components/bio-formats/src/loci/formats/in/PCIReader.java

    r6856 r6997  
    6666  private String creationDate; 
    6767  private int binning; 
    68   private boolean hasZ = false; 
     68  private Vector<Double> uniqueZ; 
    6969 
    7070  // -- Constructor -- 
     
    124124      binning = 0; 
    125125      creationDate = null; 
    126       hasZ = false; 
     126      uniqueZ = null; 
    127127    } 
    128128  } 
     
    136136    imageFiles = new HashMap<Integer, String>(); 
    137137    timestamps = new HashMap<Integer, Double>(); 
     138    uniqueZ = new Vector<Double>(); 
    138139 
    139140    try { 
     
    154155        "No files were found - the .cxd may be corrupt."); 
    155156    } 
     157 
     158    double firstZ = 0d, secondZ = 0d; 
    156159 
    157160    for (String name : allFiles) { 
     
    209212      } 
    210213      else if (relativePath.indexOf("Position_Z") != -1) { 
    211         hasZ = true; 
     214        double zPos = stream.readDouble(); 
     215        if (!uniqueZ.contains(zPos)) uniqueZ.add(zPos); 
     216        if (name.indexOf("Field 1/") != -1) firstZ = zPos; 
     217        else if (name.indexOf("Field 2/") != -1) secondZ = zPos; 
    212218      } 
    213219      else if (relativePath.equals("First Field Date & Time")) { 
     
    243249    } 
    244250 
     251    boolean zFirst = !new Double(firstZ).equals(new Double(secondZ)); 
     252 
    245253    if (getSizeC() == 0) core[0].sizeC = 1; 
    246254 
    247     core[0].sizeZ = getImageCount(); 
    248     core[0].sizeT = 1; 
     255    core[0].sizeZ = uniqueZ.size() == 0 ? 1 : uniqueZ.size(); 
     256    core[0].sizeT = getImageCount() / getSizeZ(); 
    249257    core[0].rgb = getSizeC() > 1; 
    250258    if (imageFiles.size() > getImageCount() && getSizeC() == 1) { 
     
    253261    } 
    254262    core[0].interleaved = false; 
    255     core[0].dimensionOrder = "XYCTZ"; 
     263    core[0].dimensionOrder = zFirst ? "XYCZT" : "XYCTZ"; 
    256264    core[0].littleEndian = true; 
    257265    core[0].indexed = false; 
     
    265273      String parent = file.substring(0, separator); 
    266274      imageFiles.put(getImageIndex(parent), file); 
    267     } 
    268  
    269     if (timestamps.size() >= 3 && !hasZ) { 
    270       double one = timestamps.get(0); 
    271       double two = timestamps.get(1); 
    272       double three = timestamps.get(2); 
    273  
    274       if ((int) (three - two) == (int) (two - one)) { 
    275         core[0].sizeT = getSizeZ(); 
    276         core[0].sizeZ = 1; 
    277       } 
    278275    } 
    279276 
Note: See TracChangeset for help on using the changeset viewer.