Changeset 2295


Ignore:
Timestamp:
02/19/07 09:36:36 (13 years ago)
Author:
melissa
Message:

Fixed multi-series detection logic to account for compression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/OpenlabReader.java

    r2292 r2295  
    584584        int w = DataTools.read2SignedBytes(in, false); 
    585585        int newSize = (int) (nextTag - in.getFilePointer()); 
    586         if ((w == oldWidth) && ((i % 4) == 3) && (newSize != oldSize)) { 
     586        if ((w == oldWidth) && ((i % 4) == 3) &&  
     587          (newSize - oldSize >= (width[0] * height[0]) / 2))  
     588        { 
    587589          layerInfoList[1].add(tmp.get(i)); 
    588590          layerInfoList[0].remove(tmp.get(i)); 
     
    627629 
    628630    int[] bpp = new int[numSeries]; 
    629  
    630     int oldSeries = getSeries(currentId); 
    631     for (int i=0; i<bpp.length; i++) { 
    632       setSeries(currentId, i); 
    633       bpp[i] = openBytes(id, 0).length / (width[i] * height[i]); 
    634     } 
    635     setSeries(currentId, oldSeries); 
    636  
    637     if (bytesPerPixel == 3) bytesPerPixel = 1; 
    638     if (bytesPerPixel == 0) bytesPerPixel++; 
    639  
    640     // finish populating metadata hashtable 
    641     addMeta("Version", new Integer(version)); 
    642     addMeta("Number of Series", new Integer(numSeries)); 
    643     for (int i=0; i<numSeries; i++) { 
    644       addMeta("Width (Series " + i + ")", new Integer(width[i])); 
    645       addMeta("Height (Series " + i + ")", new Integer(height[i])); 
    646       addMeta("Bit depth (Series " + i + ")", 
    647         new Integer(bpp[i] * 8)); 
    648       addMeta("Number of channels (Series " + i + ")", 
    649         new Integer(channelCount[i])); 
    650       addMeta("Number of images (Series " + i + ")", 
    651         new Integer(numImages[i])); 
    652     } 
    653631 
    654632    sizeX = width; 
     
    669647    minMaxFinished = new boolean[numSeries]; 
    670648    Arrays.fill(minMaxFinished, false); 
     649     
     650    int oldSeries = getSeries(currentId); 
     651    for (int i=0; i<bpp.length; i++) { 
     652      setSeries(currentId, i); 
     653      bpp[i] = openBytes(id, 0).length / (width[i] * height[i]); 
     654    } 
     655    setSeries(currentId, oldSeries); 
     656 
     657    if (bytesPerPixel == 3) bytesPerPixel = 1; 
     658    if (bytesPerPixel == 0) bytesPerPixel++; 
     659 
     660    // finish populating metadata hashtable 
     661    addMeta("Version", new Integer(version)); 
     662    addMeta("Number of Series", new Integer(numSeries)); 
     663    for (int i=0; i<numSeries; i++) { 
     664      addMeta("Width (Series " + i + ")", new Integer(width[i])); 
     665      addMeta("Height (Series " + i + ")", new Integer(height[i])); 
     666      addMeta("Bit depth (Series " + i + ")", 
     667        new Integer(bpp[i] * 8)); 
     668      addMeta("Number of channels (Series " + i + ")", 
     669        new Integer(channelCount[i])); 
     670      addMeta("Number of images (Series " + i + ")", 
     671        new Integer(numImages[i])); 
     672    } 
    671673 
    672674    // populate MetadataStore 
Note: See TracChangeset for help on using the changeset viewer.