Changeset 6801


Ignore:
Timestamp:
08/17/10 10:20:04 (9 years ago)
Author:
melissa
Message:
  • Parse metadata from SimplePCI TIFFs.
  • Slightly better Z/T detection for .cxd files.
Location:
trunk/components/bio-formats/src/loci/formats
Files:
1 added
2 edited

Legend:

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

    r6655 r6801  
    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 
  • trunk/components/bio-formats/src/loci/formats/readers.txt

    r6797 r6801  
    137137loci.formats.in.PhotoshopTiffReader   # tif 
    138138loci.formats.in.FEITiffReader         # tif 
     139loci.formats.in.SimplePCITiffReader   # tif 
    139140 
    140141# standard TIFF reader must go last (it accepts any TIFF) 
Note: See TracChangeset for help on using the changeset viewer.