Changeset 5980


Ignore:
Timestamp:
03/02/10 11:13:51 (10 years ago)
Author:
melissa
Message:

Fixed a few more bugs with reading/writing AVI files. Exported RGB AVIs should now open in QuickTime Player.

Location:
trunk/components/bio-formats/src/loci/formats
Files:
2 edited

Legend:

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

    r5974 r5980  
    508508    core[0].imageCount = offsets.size(); 
    509509 
    510     core[0].indexed = lut != null; 
    511510    core[0].sizeZ = 1; 
    512511    core[0].sizeT = getImageCount(); 
     
    518517    } 
    519518    else if (bytesPerPlane == 0 || bmpBitsPerPixel == 24) { 
    520       core[0].rgb = 
    521         (bmpBitsPerPixel > 8 || (bmpCompression != 0)) && lut == null; 
     519      core[0].rgb = bmpBitsPerPixel > 8 || (bmpCompression != 0); 
    522520      core[0].sizeC = isRGB() ? 3 : 1; 
    523521    } 
     
    530528    core[0].falseColor = false; 
    531529    core[0].metadataComplete = true; 
     530    core[0].indexed = lut != null && !isRGB(); 
    532531 
    533532    if (bmpBitsPerPixel <= 8) { 
  • trunk/components/bio-formats/src/loci/formats/out/AVIWriter.java

    r5977 r5980  
    2525 
    2626import java.awt.image.IndexColorModel; 
    27 import java.io.File; 
    2827import java.io.IOException; 
    2928import java.util.Vector; 
     
    5756 
    5857  private int bytesPerPixel; 
    59   private File file; 
    6058  private int xDim, yDim, zDim, tDim, xPad; 
    6159  private int microSecPerFrame; 
     
    145143      frameOffset2 = 35 * 4; 
    146144      savestrfSize = 42 * 4; 
    147       savestrnPos = savestrfSize + 44 + (bytesPerPixel == 1 ? 4 * 256 : 0); 
     145      savestrnPos = savestrfSize + 44 + 1024; 
    148146      saveJUNKsignature = savestrnPos + 24; 
    149147      saveLIST2Size = 4088; 
     
    158156      dataSignature[3] = 98; // b 
    159157 
    160       tDim = 1; 
    161       zDim = 1; 
     158      tDim = meta.getPixelsSizeZ(series, 0).intValue(); 
     159      zDim = meta.getPixelsSizeT(series, 0).intValue(); 
    162160      yDim = meta.getPixelsSizeY(series, 0).intValue(); 
    163161      xDim = meta.getPixelsSizeX(series, 0).intValue(); 
     
    363361        DataTools.writeShort(out, (short) bitsPerPixel, true); 
    364362 
    365         //writeInt(bytesPerPixel * xDim * yDim * zDim * tDim); // biSizeImage # 
    366363        DataTools.writeInt(out, 0, true); // biSizeImage # 
    367364        DataTools.writeInt(out, 0, true); // biCompression - compression type 
     
    371368        DataTools.writeInt(out, 0, true); 
    372369 
    373         int nColors = (int) Math.pow(2, bitsPerPixel); 
     370        int nColors = 256; 
    374371        DataTools.writeInt(out, nColors, true); 
    375372 
     
    405402 
    406403        out.seek(savestrfSize); 
    407         DataTools.writeInt(out, 
    408           (int) (savestrnPos - (savestrfSize + 4)), true); 
     404        DataTools.writeInt(out, (int) (savestrnPos - (savestrfSize + 4)), true); 
    409405        out.seek(savestrnPos); 
    410406 
Note: See TracChangeset for help on using the changeset viewer.